monitube-data_conn.c File Reference

Relating to managing the connections. More...

#include "monitube-data_main.h"
#include <jnx/pconn.h>
#include "monitube-data_config.h"
#include "monitube-data_conn.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 UNUSED, void *uap UNUSED, struct timespec due UNUSED, struct timespec inter UNUSED)
status_t init_connections (evContext ctx)
void close_connections (void)
void notify_stat_update (in_addr_t flow_addr, uint16_t flow_dport, double mdi_df, uint32_t mdi_mlr, char *monitor_name)

Variables

volatile boolean is_master
 mastership state of this data component


Detailed Description

Relating to managing the connections.

These functions and types will manage the connections.

Definition in file monitube-data_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 monitube-data_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 525 of file monitube-data_conn.c.

References INSIST_ERR, and notification_msg_s::message.

Referenced by monitube_quit().

static void connect_mgmt ( evContext ctx  UNUSED,
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 452 of file monitube-data_conn.c.

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

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 499 of file monitube-data_conn.c.

References connect_mgmt(), LOG, and RETRY_CONNECT.

Referenced by init_application().

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 173 of file monitube-data_conn.c.

References clear_config(), connect_mgmt(), INSIST_ERR, is_master, 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 272 of file monitube-data_conn.c.

References add_address(), maddr_info_s::addr, clear_mirrors_configuration(), clear_monitors_configuration(), delete_address(), delete_mirror(), delete_monitor(), INSIST_ERR, replication_info_s::interval, LOG, maddr_info_s::mask, slave_info_s::master_address, update_mir_info_s::mirror_from, del_mir_info_s::mirror_from, update_mir_info_s::mirror_to, update_mon_info_s::mon_name, maddr_info_s::mon_name, del_mon_info_s::mon_name, update_mon_info_s::mon_name_len, maddr_info_s::mon_name_len, del_mon_info_s::mon_name_len, MSG_CONF_MASTER, MSG_CONF_MIR, MSG_CONF_MON, MSG_CONF_MON_ADDR, MSG_CONF_SLAVE, MSG_DELETE_ALL_MIR, MSG_DELETE_ALL_MON, MSG_DELETE_MIR, MSG_DELETE_MON, MSG_DELETE_MON_ADDR, MSG_REP_INFO, update_mon_info_s::rate, set_mastership(), set_replication_interval(), update_mirror(), and update_monitor().

Referenced by connect_mgmt().

void notify_stat_update ( in_addr_t  flow_addr,
uint16_t  flow_dport,
double  mdi_df,
uint32_t  mdi_mlr,
char *  monitor_name 
)

Notify the mgmt component about a statistic update

Parameters:
[in] flow_addr flow address (id)
[in] flow_dport flow dst port (in net. byte-order) (id)
[in] mdi_df the delay factor
[in] mdi_mlr the media loss rate
[in] monitor_name the monitor name

Definition at line 565 of file monitube-data_conn.c.

References notification_msg_s::action, flow_stat_s::flow_addr, flow_stat_s::flow_port, INSIST_ERR, flow_stat_s::mdi_df, flow_stat_s::mdi_mlr, notification_msg_s::message, flow_stat_s::mon_name, flow_stat_s::mon_name_len, MSG_FLOW_STAT_UPDATE, and process_notifications().

Referenced by update_stats_for_flow().

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 150 of file monitube-data_conn.c.

References LOG.

Referenced by notify_stat_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 55 of file monitube-data_conn.c.

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


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:02 2010 for SDK Your Net Corporation Monitube IPTV Monitoring Example: monitube-data 1.0 by Doxygen 1.5.1