monitube2-data_main.c File Reference

Contains plug-in entry point and main handlers. More...

#include "monitube2-data_main.h"
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <sys/jnx/jbuf.h>
#include <jnx/multi-svcs/msvcs_plugin.h>
#include <jnx/multi-svcs/msvcs_state.h>
#include <jnx/multi-svcs/msvcs_events.h>
#include <jnx/multi-svcs/msvcs_flow.h>
#include <jnx/multi-svcs/msvcs_session.h>
#include <jnx/junos_kcom.h>
#include <jnx/junos_kcom_mpsdk_cfg.h>
#include <jnx/msp_pkt_utils.h>
#include <jnx/msp_fdb_api.h>
#include <jnx/msp_hw_ts.h>
#include <jnx/ipc_msp_pub.h>
#include "monitube2-data_config.h"
#include "monitube2-data_conn.h"
#include "monitube2-data_rtp.h"
#include "monitube2-data_packet.h"

Go to the source code of this file.

Functions

static msp_fdb_iter_res_t set_vrf (msp_fdb_rt_info_t *route_info, void *ctxt)
static void retry_attach_fdb (evContext ectx UNUSED, void *uap UNUSED, struct timespec due UNUSED, struct timespec inter UNUSED)
static int monitube_data_hdlr (msvcs_data_context_t *md_ctx, msvcs_data_event_t ev)
static int monitube_ctrl_hdlr (msvcs_control_context_t *mc_ctx, msvcs_control_event_t ev)
int monitube2_entry (void)

Variables

const char * waiting_state = "waiting for primary"
 WAITING_FOR_PRIMARY.
const char * primary_state = "primary active"
 PRIMARY_ACTIVE.
const char * secondary_state = "secondary active"
 SECONDARY_ACTIVE.
const char * none_state = "none active"
 NONE_ACTIVE.
const char * no_op = "none"
 NONE.
const char * switch_op = "switch"
 SWITCH.
const char * revert_op = "revert"
 REVERT.
int plugin_id
evContext * ctx
msp_policy_db_handle_t pdb_handle
void * pdb_shm_handle
static msp_oc_handle_t entry_handle
 handle for OC flow entry allocator
static msp_fdb_handle_t fdb_handle
 handle for FDB (forwarding DB)
static evTimerID retry_timer
 timer set to do fdb attach retry


Detailed Description

Contains plug-in entry point and main handlers.

Definition in file monitube2-data_main.c.


Function Documentation

int monitube2_entry ( void   ) 

The very first entry point into plug-in code called when the plug-in (shared object) is loaded by mspmand. The function name must be defined in in the entry tag of this plugin in the package's XML configuration file.

Returns:
Valid plugin ID on success, -1 on failure

Definition at line 1152 of file monitube2-data_main.c.

References CLOG, monitube_ctrl_hdlr(), monitube_data_hdlr(), plugin_id, PLUGIN_ID, and PLUGIN_NAME.

static int monitube_ctrl_hdlr ( msvcs_control_context_t *  mc_ctx,
msvcs_control_event_t  ev 
) [static]

Control events handler

Parameters:
[in] ctx Pointer to control context
[in] ev Control event
Returns:
Control handler status code

Definition at line 996 of file monitube2-data_main.c.

References CLOG, ctx, no_op, none_state, pdb_handle, pdb_shm_handle, plugin_id, primary_state, retry_attach_fdb(), retry_timer, revert_op, secondary_state, switch_op, and waiting_state.

Referenced by monitube2_entry().

static int monitube_data_hdlr ( msvcs_data_context_t *  md_ctx,
msvcs_data_event_t  ev 
) [static]

Data event handler

Parameters:
[in] ctx Pointer to data context
[in] ev Data event
Returns:
Data handler status code

Definition at line 677 of file monitube2-data_main.c.

References flow_entry_s::base_ts, flow_entry_s::daddr, DLOG, flow_entry_s::dport, entry_handle, fdb_handle, get_monitored_rule_info(), flow_entry_s::m_vrf, flow_entry_s::maddr, flow_entry_s::mdi_df, flow_entry_s::mdi_mlr, flow_entry_s::pl_sum, plugin_id, PLUGIN_NAME, process_packet(), pullup_bytes(), flow_entry_s::rate, set_vrf(), flow_entry_s::source, flow_entry_s::ssrc, flow_entry_s::vb_max, flow_entry_s::vb_min, flow_entry_s::vb_post, and flow_entry_s::vb_pre.

Referenced by monitube2_entry().

static void retry_attach_fdb ( evContext ectx  UNUSED,
void *uap  UNUSED,
struct timespec due  UNUSED,
struct timespec inter  UNUSED 
) [static]

Callback to periodically retry attaching to FDB. It stops being called once successfully attached.

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 640 of file monitube2-data_main.c.

References CLOG, ctx, fdb_handle, init_config(), init_connections(), and retry_timer.

Referenced by monitube_ctrl_hdlr().

static msp_fdb_iter_res_t set_vrf ( msp_fdb_rt_info_t *  route_info,
void *  ctxt 
) [static]

Iterator callback as we search for a VRF

Parameters:
[in] route_info The routing record info retrived from FDB
[in] ctxt The user data passed into the callback msp_fdb_get_all_route_records (this was &flow->m_vrf)
Returns:
the iterator result to stop iterating

Definition at line 612 of file monitube2-data_main.c.

Referenced by monitube_data_hdlr().


Variable Documentation

evContext* ctx

The main evContext on the ctrl plane side

Definition at line 578 of file monitube2-data_main.c.

Referenced by clear_config(), connect_mgmt(), delete_serviceset(), init_config(), init_connections(), mgmt_client_connection(), monitube_ctrl_hdlr(), process_notifications(), remove_rule(), and retry_attach_fdb().

msp_policy_db_handle_t pdb_handle

The policy database handle

Definition at line 583 of file monitube2-data_main.c.

Referenced by apply_rule(), clear_config(), delete_serviceset(), get_monitored_rule_info(), monitube_ctrl_hdlr(), and remove_rule().

void* pdb_shm_handle

The shared mem handle for the PDB

Definition at line 588 of file monitube2-data_main.c.

Referenced by add_address(), apply_rule(), delete_rule(), delete_serviceset(), free_policy(), monitube_ctrl_hdlr(), remove_rule(), and update_rule().

int plugin_id

The id assigned by mspmand unique over all plugins

Definition at line 573 of file monitube2-data_main.c.

Referenced by apply_rule(), clear_config(), delete_serviceset(), get_monitored_rule_info(), monitube2_entry(), monitube_ctrl_hdlr(), monitube_data_hdlr(), and remove_rule().


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:09 2010 for SDK Your Net Corporation Monitube2 IPTV Monitoring Example: monitube2-plugin 1.0 by Doxygen 1.5.1