ped_conn.c File Reference

Relating to managing the connections. More...

#include <sync/common.h>
#include <sync/policy_ipc.h>
#include <jnx/pconn.h>
#include "ped_config.h"
#include "ped_conn.h"
#include "ped_logging.h"

Go to the source code of this file.

Defines

#define PED_SERVER_MAX_CONN   2
 max # cnxs (just 2 = ctrl & data)
#define IF_NAME_SIZE   64
 max chars for an MS PIC interface name

Functions

static status_t send_peer_info (pconn_session_t *to_session, pconn_session_t *for_session)
 < the IFD name of the PIC running the PFD
static status_t send_addresses (pconn_session_t *to_session)
static status_t configure_pics (void)
static void receive_connection (pconn_session_t *session, pconn_event_t event, void *cookie __unused)
static status_t receive_message (pconn_session_t *session, ipc_msg_t *msg, void *cookie __unused)
status_t init_server (evContext ctx)
void close_connections (void)
void reconfigure_peers (void)
void mspic_offline (char *intername_name)

Variables

static pconn_server_t * mgmt_server
 the server connection info
static pconn_session_t * cpd_session
 the session to the control component (CPD)
static pconn_session_t * pfd_session
 the session to the data component (PFD)
static char cpd_pic_name [IF_NAME_SIZE]
static char pfd_pic_name [IF_NAME_SIZE]
 < the IFD name of the PIC running the CPD


Detailed Description

Relating to managing the connections.

These functions and types will manage the connections to peers (PFD & CPD).

Definition in file ped_conn.c.


Function Documentation

void close_connections ( void   ) 

Close existing connections and shutdown server

Definition at line 437 of file ped_conn.c.

References cpd_pic_name, cpd_session, mgmt_server, PED_PORT_NUM, pfd_pic_name, and pfd_session.

static status_t configure_pics ( void   )  [static]

A helper function to send configuration down to PICs (CPD and PFD)

Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 153 of file ped_conn.c.

References cpd_session, pfd_session, send_addresses(), and send_peer_info().

Referenced by receive_message().

status_t init_server ( evContext  ctx  ) 

Initialize the server socket connection

Parameters:
[in] ctx event context
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 400 of file ped_conn.c.

References cpd_session, mgmt_server, PED_PORT_NUM, PED_SERVER_MAX_CONN, pfd_session, receive_connection(), and receive_message().

Referenced by ped_init().

void mspic_offline ( char *  intername_name  ) 

Called when the KCOM module detects that an ms-* pic has gone offline

Parameters:
[in] intername_name Name of the IFD going down

Definition at line 494 of file ped_conn.c.

References cpd_pic_name, cpd_session, pfd_pic_name, and pfd_session.

Referenced by ifd_async_handler().

static void receive_connection ( pconn_session_t *  session,
pconn_event_t  event,
void *cookie  __unused 
) [static]

Connection handler for new and dying connections

Parameters:
[in] session The session information for the source peer
[in] event The event (established, or shutdown are the ones we care about)
[in] cookie The cookie we passed in. This is the eventlib context here.

Definition at line 193 of file ped_conn.c.

References cpd_pic_name, cpd_session, pfd_pic_name, and pfd_session.

Referenced by init_server().

static status_t receive_message ( pconn_session_t *  session,
ipc_msg_t *  msg,
void *cookie  __unused 
) [static]

Message handler for open connections. We receive all kinds of messages (msg_type_e) except MSG_PEER.

Parameters:
[in] session The session information for the source peer
[in] msg The inbound message
[in] cookie The cookie we passed in. This is the eventlib context here.
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 263 of file ped_conn.c.

References configure_pics(), cpd_pic_name, cpd_session, ID_CPD, ID_PFD, IF_NAME_SIZE, MSG_ID, pfd_pic_name, and pfd_session.

Referenced by init_server().

void reconfigure_peers ( void   ) 

Reconfigure CPD and PFD peers with new addresses in case of a change to any of the two addresses.

Definition at line 469 of file ped_conn.c.

References cpd_session, pfd_session, and send_addresses().

Referenced by ped_config_read().

static status_t send_addresses ( pconn_session_t *  to_session  )  [static]

A helper function to send a PIC the configured addresses. Does not send anything, if the addresses are zero.

Parameters:
[in] to_session The peer to which we are send the information to
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 111 of file ped_conn.c.

References cpd_address, get_cpd_address(), get_pfd_address(), MSG_ADDRESSES, and pfd_address.

Referenced by configure_pics(), and reconfigure_peers().

static status_t send_peer_info ( pconn_session_t *  to_session,
pconn_session_t *  for_session 
) [static]

< the IFD name of the PIC running the PFD

A helper function to send PIC peer information to the other PIC. Either ctrl component info is sent to the data component or vice versa.

Parameters:
[in] to_session The peer to which we are send the information to
[in] for_session The established session for which we will extract the connection information, for sending to the to_session peer
Returns:
SUCCESS if successful; otherwise EFAIL with an error message.

Definition at line 63 of file ped_conn.c.

References MSG_PEER.

Referenced by configure_pics().


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:27:06 2010 for SDK Your Net Corporation Policy Manager Example: Policy Enforcement Daemon 1.0 by Doxygen 1.5.1