libconn is the recommended form of communication between daemons because libconn is designed to work optimally with the JUNOS architecture. For example, if you did not use libconn, a switchover to the backup Routing Engine would terminate the connection; libconn handles this transparently and preserves the connection.
Communication can be Routing Engine to Routing Engine, Routing Engine to MultiServices PIC, or MultiServices PIC to MultiServices PIC.
libconn uses the JUNOS library libjipc for receiving and sending data over the IPC pipe. libjipc is also released as part of the SDK and available for you to use. libjipc functionality includes:
Using libconn, the application does not need to be aware of the MultiServices PIC and Routing Engine addresses to which it needs to connect. The library also provides some additional common functions which you would otherwise have to code in your application.
pconn_server_create(). This function takes a params structure as input to specify a server port, the maximum client connections that can be accepted, and an event handler to process the internal state for the connection - for example, the application can be notified of an abnormal shutdown and can then clean up its state.
When the application is acting as a client for another module or another application (the "server"), it can connect to the server asynchronously or synchronously. Synchronous connections are for applications written to use a command (query) and reply model.
The connection library opens a TCP connection to a remote server running on the Routing Engine or on the MultiServices PIC. The function creates the client structure and attaches the event context, connection event handler, and a message handler to it.
pconn_client_connect() handle asynchronous and synchronous connections respectively. Client connection functions also take a
params structure as input.
Synchronous functions the client can use are
Asynchronous functions the client can use are
pconn_client_close() (the sample applications use these functions.)
sizeof(). Unaligned memory access can be caught, and should be avoided.
sandbox/src/junos/lib/libconn/h/jnx/pconn.hin the backing sandbox, and are documented in the Library Reference documentation for libconn.