Application Setup

Even a basic application needs to create data structures and variables to handle the many data elements involved in network communications.

This application is concerned only with communications among the managment, control, and data components, so its structures are related to pconn, timers, and statistics.

Data Structures For Peer Communication

The management component sets up pointers for a server connection and for the sessions that the control and data components will create to communicate with the management component (The structures are defined in the hellopics-mgmt_conn.c file):

static pconn_server_t     * mgmt_server;     
static pconn_session_t    * ctrl_session;    
static pconn_session_t    * data_session;    

The control component is a client of the management component and a server to the data component; it declares a pconn_client_t pointer in the hellopics-ctrl_conn.c file and a pconn_server_t pointer in the same file:

static pconn_client_t     * mgmt_client; 
static pconn_server_t     * ctrl_server;  

The control component also declares a pconn_session_t pointer to keep track of the session from the data component. This declaration is in hellopics-ctrl_conn.c:

static pconn_session_t    * data_session; 

The data component is a client of both the management and control components, so it declares pconn_client_t client pointers for both in the hellopics-data_conn.c file:

static pconn_client_t     * ctrl_client;    
static pconn_client_t     * mgmt_client;     

For the application developer, pconn_server_t, pconn_session_t, and pconn_client_t are opaque structures; you declare and use them but you should not access the individual fields.

Statistics Structure

In addition to the peer communication structures, the application also declares its own structure for gathering statistics:

hellopics_stats_t  hellopics_stats; 

This structure is defined in the header file hellopics-mgmt_conn.h as follows:

typedef struct hellopics_stats_s {
    uint32_t msgs_sent;     // total number of messages sent to PICs
    uint32_t msgs_received; // total number of messages received from PICs
    uint32_t msgs_missed;   // total number of messages expected but never received from PICs
    uint32_t msgs_badorder; // total number of messages received out of order
} hellopics_stats_t;

The application also creates variables for the timer ID, message-received and sequence tracking, and tracking when components are ready to receive messages.

Clients and Servers

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