dpm-ctrl_conn.c File Reference

Relating to managing the connections. More...

#include "dpm-ctrl_main.h"
#include <jnx/pconn.h>
#include "dpm-ctrl_config.h"
#include "dpm-ctrl_conn.h"
#include <sync/dpm_ipc.h>

Go to the source code of this file.

Data Structures

struct  notification_msg_s

Defines

#define RETRY_CONNECT   60
#define CONNECT_RETRIES   1
 max number of connect retries

Typedefs

typedef notification_msg_s notification_msg_t

Functions

static TAILQ_HEAD (notification_buffer_s, notification_msg_s)
static void process_notifications (void)
static void mgmt_client_connection (pconn_client_t *client, pconn_event_t event, void *cookie UNUSED)
static status_t mgmt_client_message (pconn_client_t *session, ipc_msg_t *msg, void *cookie UNUSED)
static void connect_mgmt (evContext ctx, void *uap UNUSED, struct timespec due UNUSED, struct timespec inter UNUSED)
status_t init_connections (evContext ctx)
void close_connections (void)
void notify_status_update (status_msg_type_e action, char *subscriber_name, char *class_name)


Detailed Description

Relating to managing the connections.

These functions and types will manage the connections.

Definition in file dpm-ctrl_conn.c.


Define Documentation

#define RETRY_CONNECT   60

Retry connecting to a component every RETRY_CONNECT if connection is lost

Definition at line 33 of file dpm-ctrl_conn.c.

Referenced by init_connections(), and mgmt_client_connection().


Typedef Documentation

typedef struct notification_msg_s notification_msg_t

A notification message to store in the queue of message to go out to the mgmt component


Function Documentation

void close_connections ( void   ) 

Terminate connection to the mgmt component

Definition at line 436 of file dpm-ctrl_conn.c.

References INSIST_ERR.

Referenced by dpm_quit().

static void connect_mgmt ( evContext  ctx,
void *uap  UNUSED,
struct timespec due  UNUSED,
struct timespec inter  UNUSED 
) [static]

Setup the connection to the mgmt component

Parameters:
[in] ctx The event context for this application
[in] uap The user data for this callback
[in] due The absolute time when the event is due (now)
[in] inter The period; when this will next be called

Definition at line 365 of file dpm-ctrl_conn.c.

References CONNECT_RETRIES, DPM_PORT_NUM, LOG, mgmt_client_connection(), and mgmt_client_message().

Referenced by init_connections(), and mgmt_client_connection().

status_t init_connections ( evContext  ctx  ) 

Initialize the connection to the mgmt component

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

Definition at line 412 of file dpm-ctrl_conn.c.

References connect_mgmt(), LOG, and RETRY_CONNECT.

Referenced by dpm_init(), and wait_for_dfw().

static void mgmt_client_connection ( pconn_client_t *  client,
pconn_event_t  event,
void *cookie  UNUSED 
) [static]

Connection handler for new and dying connections to the mgmt component

Parameters:
[in] client The opaque client information for the source peer
[in] event The event (established, or shutdown are the ones we care about)
[in] cookie user data passed back

Definition at line 167 of file dpm-ctrl_conn.c.

References clear_configuration(), connect_mgmt(), INSIST_ERR, LOG, and RETRY_CONNECT.

Referenced by connect_mgmt().

static status_t mgmt_client_message ( pconn_client_t *  session,
ipc_msg_t *  msg,
void *cookie  UNUSED 
) [static]

Message handler for open connection to the mgmt component

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

Definition at line 254 of file dpm-ctrl_conn.c.

References pol_conf_s::bandwidth_limit, pol_conf_s::bandwidth_percent, pol_conf_s::burst_size_limit, pol_conf_s::bw_in_percent, pol_conf_s::bw_u, configuration_complete(), configure_managed_interface(), configure_policer(), configure_subscriber(), policer_info_s::if_exceeding, int_info_s::index, INSIST_ERR, LOG, MSG_CONF_COMP, MSG_CONF_RESET, MSG_INTERFACE, MSG_POLICER, MSG_SUBSCRIBER, sub_info_s::name, int_info_s::name, policer_info_s::name, reset_configuration(), and int_info_s::subunit.

Referenced by connect_mgmt().

void notify_status_update ( status_msg_type_e  action,
char *  subscriber_name,
char *  class_name 
)

Notify the mgmt component about a subscriber status update

Parameters:
[in] action login/logout action
[in] mdi_mlr the subscriber name
[in] class_name the subscriber class name

Definition at line 471 of file dpm-ctrl_conn.c.

References notification_msg_s::action, subscriber_status_s::class, INSIST_ERR, notification_msg_s::message, subscriber_status_s::name, and process_notifications().

static void process_notifications ( void   )  [static]

Try to process all notification requests that have been buffered. This should be called with a notify* call below

Definition at line 144 of file dpm-ctrl_conn.c.

References LOG.

Referenced by notify_status_update().

static TAILQ_HEAD ( notification_buffer_s  ,
notification_msg_s   
) [static]

List of notification messages to buffer until main thread processes msgs

Definition at line 53 of file dpm-ctrl_conn.c.

References notification_msg_s::action, INSIST_ERR, LOG, and notification_msg_s::message.


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:54 2010 for SDK Your Net Corporation Dynamic Policy Manager Example: dpm-ctrl 1.0 by Doxygen 1.5.1