IP Socket-Based Inter-Process Communication

The Peer Communication (libconn) library provides TCP client and server libraries for applications running on the Routing Engine and the MultiServices PIC.

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:

The connection between the Routing Engine and the MultiServices PIC uses the internal routing instance IRI2 (_juniper_private2_).

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.

Note:
Reliable configuration download is a high-availability alternative to libconn for sending configuration data from the Routing Engine to the MultiServices PIC. It is described in Reliable Configuration Download.

Using libconn Functions

To establish itself as a server for communication with other code, the application calls the function 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.

The functions pconn_client_connect_async() and 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 pconn_client_connect(), pconn_client_recv(), pconn_client_send() and pconn_client_close()).

Asynchronous functions the client can use are pconn_client_connect_async(), pconn_client_send() and pconn_client_close() (the sample applications use these functions.)

Note:
When communicating between the Routing Engine and the MultiServices PIC, it is important to remember that the XLR architecture on the PIC uses 64-bit alignment. This means that a struct sent from the Routing Engine might not yield the same size with sizeof(). Unaligned memory access can be caught, and should be avoided.
For more information on using these functions, see Using the libconn Library For Intermodule Communications. The libconn functions are in sandbox/src/junos/lib/libconn/h/jnx/pconn.h in the backing sandbox, and are documented in the Library Reference documentation for libconn.
2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:26:47 2010 for Juniper Networks Partner Solution Development Platform JUNOS SDK 10.2R1 by Doxygen 1.4.5