equilibrium2-balance_data.c File Reference

Equilibrium II balance service data functions. More...

#include <sync/equilibrium2.h>
#include <sync/equilibrium2_svc.h>
#include "equilibrium2-balance.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 svr_addr_tget_svr_addr (char *name)
 Get server address from server group.
static int take_action (void)
 Take action.
static int first_pkt_proc (void)
 Process the first packet.
static void session_close (void)
 Free related resource when session was closed.
int equilibrium2_balance_data_hdlr (msvcs_data_context_t *ctx, msvcs_data_event_t ev)
 Data event handler for the plugins.

Variables

static msvcs_data_context_t * data_ctx


Detailed Description

Equilibrium II balance service data functions.

Definition in file equilibrium2-balance_data.c.


Function Documentation

int equilibrium2_balance_data_hdlr ( msvcs_data_context_t *  ctx,
msvcs_data_event_t  ev 
)

Data event handler for the plugins.

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

Definition at line 427 of file equilibrium2-balance_data.c.

References classify_ev_class, data_ctx, EQ2_CLASSIFY_SVC_NAME, EQ2_LUCKY_NUM, EV_CLASSIFY_FIRST_PACKET, first_pkt_proc(), session_close(), and take_action().

Referenced by equilibrium2_balance_entry().

static int first_pkt_proc ( void   )  [static]

Process the first packet.

Returns:
Status code

Definition at line 230 of file equilibrium2-balance_data.c.

References data_ctx, get_svc_set(), get_svr_addr(), svc_set_lock, svr_group_lock, and TERM_FROM_SVC_GATE.

Referenced by equilibrium2_balance_data_hdlr().

static svr_addr_t* get_svr_addr ( char *  name  )  [static]

Get server address from server group.

Parameters:
[in] name Server group name
Returns:
Server address on success, 0 on failure

Definition at line 131 of file equilibrium2-balance_data.c.

References svr_addr_s::addr_ssn_count, svr_group_s::group_addr_head, svr_group_s::group_name, and svr_group_head.

Referenced by first_pkt_proc().

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-balance_data.c.

Referenced by take_action().

static int take_action ( void   )  [static]

Take action.

Returns:
Status code

Definition at line 168 of file equilibrium2-balance_data.c.

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

Referenced by equilibrium2_balance_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-balance_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-balance_data.c.

Referenced by equilibrium2_balance_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-balance 1.0 by Doxygen 1.5.1