monitube-mgmt_conn.c File Reference

Relating to managing the connections. More...

#include <sync/common.h>
#include <jnx/pconn.h>
#include <sync/monitube_ipc.h>
#include "monitube-mgmt_config.h"
#include "monitube-mgmt_conn.h"
#include "monitube-mgmt_logging.h"

Go to the source code of this file.

Data Structures

struct  session_s

Defines

#define MONITUBE_MGMT_SERVER_MAX_CONN   20
 max # cnxs (to service component)
#define RETRY_INTERVAL   5
 retry processing notification messages

Typedefs

typedef session_s session_t

Functions

typedef TAILQ_HEAD (session_list_s, session_s)
static TAILQ_HEAD (notification_buffer_s, notification_msg_s)
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 mspic_offline (const char *name)
void notify_monitor_update (const char *mon_name, uint32_t rate)
void notify_address_update (const char *mon_name, in_addr_t address, in_addr_t mask)
void notify_mirror_update (in_addr_t mirror_from, in_addr_t mirror_to)
void notify_monitor_delete (const char *mon_name)
void notify_address_delete (const char *mon_name, in_addr_t address, in_addr_t mask)
void notify_mirror_delete (in_addr_t mirror_from)
void notify_delete_all_monitors (void)
void notify_delete_all_mirrors (void)
void notify_replication_interval (uint8_t r_int)
void process_notifications (void)

Variables

static evContext m_ctx
 Event context for monitube.
static pconn_server_t * mgmt_server
 the server connection info
 notification_msg_t


Detailed Description

Relating to managing the connections.

These functions and types will manage the connections.

Definition in file monitube-mgmt_conn.c.


Typedef Documentation

typedef struct session_s session_t

session item in our session list


Function Documentation

void close_connections ( void   ) 

Close existing connections and shutdown server

Definition at line 373 of file monitube-mgmt_conn.c.

References mgmt_server, MONITUBE_PORT_NUM, and session_s::session.

Referenced by monitube_init(), and monitube_shutdown().

status_t init_server ( evContext  ctx  ) 

Initialize the server socket connection

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

Definition at line 340 of file monitube-mgmt_conn.c.

References LOG, m_ctx, mgmt_server, MONITUBE_MGMT_SERVER_MAX_CONN, MONITUBE_PORT_NUM, receive_connection(), and receive_message().

Referenced by monitube_init().

void mspic_offline ( const char *  name  ) 

Notification about an MS-PIC interface going down

Parameters:
[in] name name of interface that has gone down

Definition at line 406 of file monitube-mgmt_conn.c.

References session_s::session.

Referenced by ifd_down_async_handler().

void notify_address_delete ( const char *  mon_name,
in_addr_t  address,
in_addr_t  mask 
)

Enqueue a message to go to the data component about an address delete

Parameters:
[in] mon_name Monitor's name
[in] address Address in the monitor
[in] mask Address mask

Definition at line 602 of file monitube-mgmt_conn.c.

References maddr_info_s::addr, maddr_info_s::mask, maddr_info_s::mon_name, maddr_info_s::mon_name_len, MSG_DELETE_MON_ADDR, and notification_msg_t.

Referenced by delete_address().

void notify_address_update ( const char *  mon_name,
in_addr_t  address,
in_addr_t  mask 
)

Enqueue a message to go to the data component about an address update

Parameters:
[in] mon_name Monitor's name
[in] address Address in the monitor
[in] mask Address mask

Definition at line 489 of file monitube-mgmt_conn.c.

References maddr_info_s::addr, maddr_info_s::mask, maddr_info_s::mon_name, maddr_info_s::mon_name_len, MSG_CONF_MON_ADDR, and notification_msg_t.

Referenced by receive_connection(), and update_address().

void notify_delete_all_mirrors ( void   ) 

Enqueue a message to go to the data component to delete all mirrors

Definition at line 691 of file monitube-mgmt_conn.c.

References MSG_DELETE_ALL_MIR, and notification_msg_t.

Referenced by delete_all_mirrors().

void notify_delete_all_monitors ( void   ) 

Enqueue a message to go to the data component to delete all monitors

Definition at line 668 of file monitube-mgmt_conn.c.

References MSG_DELETE_ALL_MON, and notification_msg_t.

Referenced by delete_all_monitors().

void notify_mirror_delete ( in_addr_t  mirror_from  ) 

Enqueue a message to go to the data component about an mirror delete

Parameters:
[in] mirror_from Mirror from address

Definition at line 638 of file monitube-mgmt_conn.c.

References del_mir_info_s::mirror_from, MSG_DELETE_MIR, and notification_msg_t.

Referenced by delete_mirror().

void notify_mirror_update ( in_addr_t  mirror_from,
in_addr_t  mirror_to 
)

Enqueue a message to go to the data component about a mirror update

Parameters:
[in] mirror_from Mirror from address
[in] mirror_to Mirror to address

Definition at line 528 of file monitube-mgmt_conn.c.

References update_mir_info_s::mirror_from, update_mir_info_s::mirror_to, MSG_CONF_MIR, and notification_msg_t.

Referenced by receive_connection(), and update_mirror().

void notify_monitor_delete ( const char *  mon_name  ) 

Enqueue a message to go to the data component about a monitor delete

Parameters:
[in] mon_name Monitor's name

Definition at line 562 of file monitube-mgmt_conn.c.

References del_mon_info_s::mon_name, del_mon_info_s::mon_name_len, MSG_DELETE_MON, and notification_msg_t.

Referenced by delete_all_addresses(), and delete_monitor().

void notify_monitor_update ( const char *  mon_name,
uint32_t  rate 
)

Enqueue a message to go to the data component about a monitor update

Parameters:
[in] mon_name Monitor's name
[in] rate Configuration group bps rate

Definition at line 448 of file monitube-mgmt_conn.c.

References update_mon_info_s::mon_name, update_mon_info_s::mon_name_len, MSG_CONF_MON, notification_msg_t, and update_mon_info_s::rate.

Referenced by receive_connection(), and update_monitor().

void notify_replication_interval ( uint8_t  r_int  ) 

Enqueue a message to go to the data component to set the replication interval

Parameters:
[in] r_int New replication interval

Definition at line 717 of file monitube-mgmt_conn.c.

References replication_info_s::interval, MSG_REP_INFO, and notification_msg_t.

Referenced by monitube_config_read(), and receive_connection().

void process_notifications ( void   ) 

Go through the buffered messages and send them to the data component if it's connected.

Definition at line 748 of file monitube-mgmt_conn.c.

References LOG, notification_msg_t, and session_s::session.

Referenced by monitube_config_read().

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

Connection handler for new, dying, or failed 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 110 of file monitube-mgmt_conn.c.

References address_s::address, get_replication_interval(), LOG, address_s::mask, monitor_s::name, next_address(), next_mirror(), next_monitor(), notification_msg_t, notify_address_update(), notify_mirror_update(), notify_monitor_update(), notify_replication_interval(), mirror_s::original, monitor_s::rate, mirror_s::redirect, and session_s::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 to the data component. Called when we receive a message.

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 281 of file monitube-mgmt_conn.c.

References flow_stat_s::flow_addr, flow_stat_s::flow_port, LOG, flow_stat_s::mdi_df, flow_stat_s::mdi_mlr, flow_stat_s::mon_name, flow_stat_s::mon_name_len, MSG_FLOW_STAT_UPDATE, and set_flow_stat().

Referenced by init_server().

static TAILQ_HEAD ( notification_buffer_s  ,
notification_msg_s   
) [static]

Delete all messages in the notifications queue

Definition at line 74 of file monitube-mgmt_conn.c.

References notification_msg_t.

typedef TAILQ_HEAD ( session_list_s  ,
session_s   
)

A notification message to store in the queue of messages to go out to the service component(s)

< action (see: shared/h/sync/monitube_ipc.h)

< length of message to be sent

< data to send (depends on action)

< ptrs to next/prev

Definition at line 52 of file monitube-mgmt_conn.c.


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