fastpathlib.h
来自「vxworks 6.x 的全部头文件」· C头文件 代码 · 共 491 行 · 第 1/2 页
H
491 行
/* fastPathLib.h - Definitions for the Fastpath library *//* * Copyright (c) 1984-2005 Wind River Systems, Inc. * * The right to copy, distribute or otherwise make use of this software * may be licensed only pursuant to the terms of an applicable Wind River * license agreement. No license to Wind River intellectual property rights * is granted herein. All rights not licensed by Wind River are reserved * by Wind River. *//*modification history--------------------01r,21apr05,kch Removed unused FF_GET_SCOPE_ID macro.01q,01mar05,niq Fix the ipFFInit API (SPR 102586)01p,02oct04,niq Backward compatibility change01o,28may04,niq Merging from base6 label POST_ITER5_FRZ16_REBASE01n,20nov03,niq Remove copyright_wrs.h file inclusion01m,05nov03,cdw Removal of unnecessary _KERNEL guards.01l,04nov03,rlm Ran batch header path update for header re-org.01k,15sep03,vvv updated path for new headers01j,20mar03,niq Reorganize the locking model and fix locking bugs + Revert to published API names for backwards compatilibility01i,19mar03,niq Expand the ffRouteAdded API01h,13mar03,niq Fastpath forwarding hook integration01g,12mar03,niq Add a few macros - v4/v6 consolidation01f,13feb03,deg include path for if_dl.h fixed01e,06feb03,deg change type of macAddr in ffPubFibEntry to struct sockaddr_dl01d,04feb03,deg include path changed01c,24jan03,deg ff_config_params changed01b,14nov02,deg #include <netinet/vsLib.h> deleted01a,07oct02,deg written*//*DESCRIPTIONThis file contains definitions used by the Fastpath libraryand by the IPv4 & IPv6 Fast Forwarder modules. */#ifndef __INCfastPathLibh#define __INCfastPathLibh/* includes */#include <cfgDefs.h>#include <sys/socket.h>#include <net/if_dl.h>#include <end.h>#include <private/fastPathLibP.h>#include <fastPath/fastPathFib.h>/* defines *//* Fastpath interface version */#define FF_VERSION 0x00000011/* * The following definitions define bitwise OR values for the ffIpv4State * and ffIpv6State variables */#define FF_MODULE_NOT_INITIALIZED 0 /* Module (v4 or v6) not initialized*/#define FF_MODULE_INITIALIZED 1 /* Module (v4 or v6) not initialized*/#define FF_MODULE_STARTED 2 /* Calls can be made to module */#define FF_MODULE_ENABLED 4 /* Fastforwarding is in effect *//* errno values */#define S_fastPathLib_ALREADY_EXISTS (M_fastPathLib | 1)#define S_fastPathLib_ALREADY_REGISTERED (M_fastPathLib | 2)#define S_fastPathLib_INTERNAL_ERROR (M_fastPathLib | 3)#define S_fastPathLib_INVALID_ARG (M_fastPathLib | 4)#define S_fastPathLib_INVALID_OBJ (M_fastPathLib | 5)#define S_fastPathLib_INVALID_PARAMS (M_fastPathLib | 6)#define S_fastPathLib_INVALID_PROTO (M_fastPathLib | 7)#define S_fastPathLib_INVALID_STATE (M_fastPathLib | 8)#define S_fastPathLib_NOT_FOUND (M_fastPathLib | 9)#define S_fastPathLib_NOT_INITIALIZED (M_fastPathLib | 10)/* Definitions for the Fast Forwarder (Hardware or Software) */#define FF_HARDWARE_FORWARDER 0x01#define FF_SOFTWARE_FORWARDER 0x02/* Protocol types supported by FastPath */#define FF_PROTO_IPV4 0x01#define FF_PROTO_IPV6 0x02/* Definition for unlimited FIB size */#define FF_FIB_SIZE_UNLIMITED 0x00/* Metric for routes passed onto the Fast Forwarder modules *//* * We use -1 for FF_REP_ROUTE as the route weight can never equal that value. * We can't use zero as the route weight for all routes is zero for a * host stack */#define FF_NON_REP_ROUTE 0x00 #define FF_REP_ROUTE -1 /* Fastpath mode commands */#define FF_START 0x01 /* Start the Fastpath module*/#define FF_STOP 0x02 /* Stop the Fastpath module */#define FF_ENABLE 0x04 /* Enable packet fast-forwarding */#define FF_DISABLE 0x08 /* Disable packet fast-forwarding */#define FF_IPFF_ENABLE 0x10 /* IP fast-forwarding enabled */#define FF_IPFF_DISABLE 0x20 /* IP fast-forwarding disabled *//* Commands for interface status change call */#define FF_IF_UP 0x01#define FF_IF_DOWN 0x02#define FF_IF_DELETE 0x04#define FF_IF_ADD 0x08#define FF_IFADDR_ADD 0x10#define FF_IFADDR_DELETE 0x20/* Flags for the ffRouteAdded command - bitwise OR */#define FF_INTF_ROUTE 0x01/* Fastpath object locking macros */#define FF_LOCK_INIT(x) ((x) = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE | \ SEM_INVERSION_SAFE)) #define FF_LOCK_DESTROY(x) (semDelete (x))#define FF_OBJ_LOCK(pFFObj) semTake((pFFObj)->ffCacheLock, WAIT_FOREVER)#define FF_OBJ_UNLOCK(pFFObj) semGive((pFFObj)->ffCacheLock)#define FF_OBJ_CACHEWALK_LOCK(pFFObj) \ semTake((pFFObj)->ffCacheWalkLock, WAIT_FOREVER)#define FF_OBJ_CACHEWALK_UNLOCK(pFFObj) \ semGive((pFFObj)->ffCacheWalkLock)#define FF_DO_IP_FORWARDING IP_DO_FORWARDING#define FF_WE_ARE_FORWARDING 0x40000000#define FF_FLAGS_IP_MASK (IP_DO_FORWARDING)#define FF_GET_IP_FLAGS(pFFObj) ((pFFObj->ffFlags) & FF_FLAGS_IP_MASK)#define FF_SET_IP_FLAGS(pFFObj, flags) \ (pFFObj->ffFlags = (pFFObj->ffFlags & ~FF_FLAGS_IP_MASK) | \ (flags & FF_FLAGS_IP_MASK))#define FF_SET_WE_ARE_FORWARDING(pFFObj) \ (pFFObj->ffFlags |= FF_WE_ARE_FORWARDING)#define FF_RESET_WE_ARE_FORWARDING(pFFObj) (pFFObj->ffFlags &= \ ~FF_WE_ARE_FORWARDING)/* Macros used by various components of the system */#define FF_ARE_WE_FORWARDING(pFFObj) (pFFObj->ffFlags & FF_WE_ARE_FORWARDING)#define SHOULD_MAKE_CALLS_TO_FF(pFFObj) ((pFFObj != NULL) && \ FF_MOD_STARTED (pFFObj))#define SHOULD_GIVE_PACKET_TO_FF(pFFObj, pIfp) \ ((pFFObj != NULL) && \ FF_ARE_WE_FORWARDING (pFFObj) && FF_MOD_ENABLED (pFFObj) && \ FF_INTF_ENABLED (pFFObj, pIfp) && pFFObj->ffFuncTable->ffPktSend != NULL)/* Call Fast Forwarder module functions (private macro ) */#define FF_CALL(pFFObj, func, args) (((pFFObj != NULL) && \ (SHOULD_MAKE_CALLS_TO_FF (pFFObj)) && \ (pFFObj->ffFuncTable->func != NULL)) ? \ (*(pFFObj->ffFuncTable->func)) args : \ ERROR)/* Same as above, except that checks have already been made */#define FF_NC_CALL(pFFObj, func, args) \ (((pFFObj != NULL) && (pFFObj->ffFuncTable->func != NULL)) ? \ (*(pFFObj->ffFuncTable->func)) args : ERROR)/* Definitions for the flags field - bitwise OR */#define FF_PUB_ENTRY_FLAG_MAC 0x01#define FF_PUB_ENTRY_FLAG_VALID 0x02#define FF_PUB_ENTRY_FLAG_COMPLETE 0x04/* Macros to test the state of the public FIB entry */#define IS_FF_PUB_ENTRY_MAC(x) ((x)->flags & FF_PUB_ENTRY_FLAG_MAC)#define IS_FF_PUB_ENTRY_NON_MAC(x) (!((x)->flags & FF_PUB_ENTRY_FLAG_MAC))#define IS_FF_PUB_ENTRY_VALID(x) (((x)->flags & FF_PUB_ENTRY_FLAG_VALID))#define IS_FF_PUB_ENTRY_INVALID(x) (!((x)->flags & FF_PUB_ENTRY_FLAG_VALID))#define IS_FF_PUB_ENTRY_COMPLETE(x) (((x)->flags & FF_PUB_ENTRY_FLAG_COMPLETE))#define IS_FF_PUB_ENTRY_INCOMPLETE(x)(!((x)->flags & FF_PUB_ENTRY_FLAG_COMPLETE))#define SET_FF_LIB_LOG_LEVEL(x) ffLibLogLevel = (x)/* Macro to retrieve the hardware assist status of an interface */#define GET_HWASSIST_FLAGS(x) (((struct ifnet *)(x))->if_hwassist) /* Interface to get scope. Might change in the future */#ifdef INET6#define IPADDR_MASKED_ARE_SAME(pD, pN, pG) \ ((pD->sa_family == AF_INET) ? \ ((SOCKADDR_IN(pD) & SOCKADDR_IN(pN)) == \ (SOCKADDR_IN(pG) & SOCKADDR_IN(pN))) : \ ((pD->sa_family == AF_INET6) ? \ (((SA6(pD).s6_addr32[0] & SA6(pN).s6_addr32[0]) == \ (SA6(pG).s6_addr32[0] & SA6(pN).s6_addr32[0])) && \ ((SA6(pD).s6_addr32[1] & SA6(pN).s6_addr32[1]) == \ (SA6(pG).s6_addr32[1] & SA6(pN).s6_addr32[1])) && \ ((SA6(pD).s6_addr32[2] & SA6(pN).s6_addr32[2]) == \ (SA6(pG).s6_addr32[2] & SA6(pN).s6_addr32[2])) && \ ((SA6(pD).s6_addr32[3] & SA6(pN).s6_addr32[3]) == \ (SA6(pG).s6_addr32[3] & SA6(pN).s6_addr32[3]))) : \ (panic ("BAD address family: %d %x @ %s:%d\n", \ pD->sa_family, pD, __FILE__, __LINE__), FALSE)))#else#define IPADDR_MASKED_ARE_SAME(pD, pN, pG) \ ((pD->sa_family == AF_INET) ? \ ((SOCKADDR_IN(pD) & SOCKADDR_IN(pN)) == \ (SOCKADDR_IN(pG) & SOCKADDR_IN(pN))) : \ (panic ("BAD address family: %d %x @ %s:%d\n", \ pD->sa_family, pD, __FILE__, __LINE__), FALSE))#endif /* INET6 *//* typedefs *//* Generic Fast Forwarder object */typedef struct ffObj{ NODE ffNode; /* Internal */ int ffVersion; /* Internal - fastpath module version */ char ffName[FF_NAME_MAX]; /* Name of Fast Forwarder module*/ SEM_ID ffCacheLock; /* To synchronize access */ SEM_ID ffCacheWalkLock;/* To synchronize access */ int ffFlags; /* IP config states */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?