The main CCB protocol control thread is provided by the package's src/ccb_protocol.c source file. The control thread loops waiting for event flags indicating that some CCB processing is required.
The main tasks of the control loop are monitoring slave packet reception timing and polling slaves as configured, to ensure they are still connected, and processing asynchronous RX packets from any of the available hardware ports. The CCB bus management messages are handled by this control loop; and validated client-application messages are forwarded to the client-application via a RX message queue for the client-application to use via the relevant read interface. The bus management code can also inject locally generated slave connect/disconnect messages into this RX queue for processing by the client-application (as per the CCB design).
The src/ccb_protocol.c source also implements the I/O driver layer used to present the “/dev/ccb” named device, used by the client-application to allow messages to be sent and received. This works in conjunction with the src/ccb_devio.c source that provides the basic message<->packet framing/deframing support.