Using the libconn Library For Intermodule Communications

The management modules in the sample applications (running on the Routing Engine) and the control and data modules running on the Multiservices PIC use the SDK Peer Connection library (libconn) to communicate with each other.

In general, communication using this library can be Routing Engine to Routing Engine, Routing Engine to Multiservices PIC, or Multiservices PIC to Multiservices PIC.

Establishing a Connection

The following is a sample call in which the control module in a sample application establishes an asynchronous connection with the data module:

        memset(&params, 0, sizeof(pconn_client_params_t));
        params.pconn_port  = JNX_GW_DATA_PORT;
        params.pconn_peer_info.ppi_peer_type = pdata_pic->peer_type;
        params.pconn_peer_info.ppi_fpc_slot  = pdata_pic->fpc_id;
        params.pconn_peer_info.ppi_pic_slot  = pdata_pic->pic_id;
        params.pconn_event_handler = jnx_gw_ctrl_data_event_handler;
        if (!(pdata_pic->pic_data_conn =
            pconn_client_connect_async(&params, jnx_gw_ctrl.ctxt,
                                       (void *)pdata_pic))) {

Message and Event Handlers

Message and event handler pointers are passed to the connection request. For example, the following code in the sample application's control module calls pconn_client_connect_async() to connect to the data PIC and passes the message handler function jnx_gw_ctrl_data_msg_handler() to read messages from the PIC:

if (!(pdata_pic->pic_data_conn = pconn_client_connect_async ( &params, jnx_gw_ctrl.ctxt, jnx_gw_ctrl_data_msg_handler,
    (void *)pdata_pic)))

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