/* ****************************************************************************** * SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipcom_forwarder_common.c,v $ $Revision: 1.3 $ * $Source: /home/interpeak/CVSRoot/ipcom/src/ipcom_forwarder_common.c,v $ * $Author: ulf $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** * */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #define IPCOM_FORWARDER_COMMON_C #define IPCOM_FORWARDER_C #include "ipcom_config.h" #if defined(IPCOM_USE_FORWARDER) && !defined(IP_PORT_UNIX) /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ /* Ipcom include files */ #define IPCOM_USE_CLIB_PROTO #include "ipcom_clib.h" #include "ipcom_err.h" #include "ipcom_os.h" #include "ipcom_syslog.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ipnet_usr_sock.h" #include "ipcom_forwarder.h" #ifndef IPCOM_USE_SMP #include "ipcom_mipc.h" #endif #ifdef IPIPSEC2 #include #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ IP_PUBLIC int ipcom_forwarder_fw_enable = 1; /* Start off enabled */ IP_PUBLIC int ipcom_forwarder_fw_started = 0; IP_PUBLIC Ip_u32 ipcom_forwarder_seed = 0x5a014310; /* Start seed for tag generation */ IP_PUBLIC Ipcom_fw_t *ipcom_fw = IP_NULL; #ifdef IPCOM_USE_FWD_TRACE IP_PUBLIC const char *ipcom_fwd_trace_file; IP_PUBLIC const char *ipcom_fwd_trace_func; IP_PUBLIC int ipcom_fwd_trace_line; #endif /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 PUBLIC FUNCTIONS **************************************************************************** */ #ifdef IPCOM_USE_CALCULATE_KEY /* *=========================================================================== * ipcom_forwarder_calculate_pkt_key *=========================================================================== * Context: any * Description: Calculate key based on 'ipcom_pkt' * Parameters: * Returns: * */ IP_PUBLIC Ip_u16 ipcom_forwarder_calculate_pkt_key(Ipcom_pkt *pkt) { Ip_u32 k; Ip_u16 *p = (Ip_u16 *)(pkt->data + pkt->start + LL_ETH_HDR_SZ); k = ((p[6] + p[7]) << 1) + p[8] + p[9]; return k + (k >> 16); } /* *=========================================================================== * ipcom_forwarder_calculate_packet_key *=========================================================================== * Context: any * Description: Calculate key based on 'packet' * Parameters: * Returns: * */ IP_PUBLIC Ip_u16 ipcom_forwarder_calculate_packet_key(void *packet) { Ip_u32 k; Ip_u16 *p = packet; k = ((p[7 + 6] + p[7 + 7]) << 1) + p[7 + 8] + p[7 + 9]; return k + (k >> 16); } #endif /* IPCOM_USE_CALCULATE_KEY */ #else int ipcom_forwarder_common_empty_file; #endif /* IPCOM_USE_FORWARDER */ /* **************************************************************************** * END OF FILE **************************************************************************** */