equilibrium2-classify_data.c File Reference

Equilibrium II classify service data functions. More...

#include <sync/equilibrium2.h>
#include <sync/equilibrium2_svc.h>
#include "equilibrium2-classify.h"
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <sys/jnx/jbuf.h>
#include <jnx/mpsdk.h>
#include <jnx/msp_objcache.h>
#include <jnx/multi-svcs/msvcs_flow.h>
#include <jnx/multi-svcs/msvcs_plugin.h>
#include <jnx/multi-svcs/msvcs_session.h>

Go to the source code of this file.

Functions

static uint16_t ip_cksum (void *buf, int len)
static uint16_t tcp_cksum (uint16_t len, void *src_addr, void *dst_addr, void *buf)
static int take_action (void)
static int first_pkt_proc (void)
static void session_close (void)
int equilibrium2_classify_data_hdlr (msvcs_data_context_t *ctx, msvcs_data_event_t ev)

Variables

static msvcs_data_context_t * data_ctx


Detailed Description

Equilibrium II classify service data functions.

Definition in file equilibrium2-classify_data.c.


Function Documentation

int equilibrium2_classify_data_hdlr ( msvcs_data_context_t *  ctx,
msvcs_data_event_t  ev 
)

Data event handler.

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

Definition at line 383 of file equilibrium2-classify_data.c.

References classify_ev_class, classify_pid, data_ctx, EQ2_BALANCE_SVC_NAME, EV_CLASSIFY_FIRST_PACKET, first_pkt_proc(), session_close(), and take_action().

Referenced by equilibrium2_classify_entry().

static int first_pkt_proc ( void   )  [static]

Process the first packet.

Returns:
Status code

Definition at line 188 of file equilibrium2-classify_data.c.

References data_ctx, get_svc_set(), svc_set_lock, and TERM_FROM_SVC_TYPE.

Referenced by equilibrium2_classify_data_hdlr().

static uint16_t ip_cksum ( void *  buf,
int  len 
) [static]

Calculate IP header checksum.

Parameters:
[in] buf Pointer to IP header
[in] len Length of IP header
Returns:
The checksum with network order

Definition at line 50 of file equilibrium2-classify_data.c.

Referenced by take_action().

static void session_close ( void   )  [static]

Free related resource when session was closed.

Definition at line 286 of file equilibrium2-classify_data.c.

References classify_pid, ctrl_ctx, data_ctx, del_svc_set(), EQ2_CLASSIFY_SVC_NAME, get_svc_set(), blob_svc_set_s::ss_gen_num, sp_svc_set_s::ss_policy, sp_svc_set_s::ss_ssn_count, blob_svc_set_s::ss_svc_id, and svc_set_lock.

Referenced by equilibrium2_classify_data_hdlr().

static int take_action ( void   )  [static]

Take action.

Returns:
Status code

Definition at line 127 of file equilibrium2-classify_data.c.

References classify_pid, data_ctx, ip_cksum(), and tcp_cksum().

Referenced by equilibrium2_classify_data_hdlr().

static uint16_t tcp_cksum ( uint16_t  len,
void *  src_addr,
void *  dst_addr,
void *  buf 
) [static]

Calculate TCP checksum.

Parameters:
[in] len Length of TCP segment in byte
[in] src_addr Pointer to the source IP address
[in] dst_addr Pointer to the destination IP address
[in] buf Pointer to the TCP packet
Returns:
The checksum with network order

Definition at line 89 of file equilibrium2-classify_data.c.

Referenced by take_action().


Variable Documentation

msvcs_data_context_t* data_ctx [static]

global copy of data context

Definition at line 35 of file equilibrium2-classify_data.c.

Referenced by equilibrium2_classify_data_hdlr(), first_pkt_proc(), session_close(), and take_action().


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:08 2010 for SDK Your Net Corporation Equilibrium II: equilibrium2-classify 1.0 by Doxygen 1.5.1