📄 ipport.h
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2002/01/22 14:11:02 $* $Source: M:/psisrc/routing/incl/rcs/ipport.h $* $Revision: 1.11 $************************************************************************** File Description: platform specific definitions for IP/UDP/RIP*************************************************************************//* NOTE: COMMENT OUT THE FOLLOWING LINES IF YOU ARE NOT USING THE ROUTING CODE WITH THE FUSION TCP/IP STACK.*/#include "std.h"#include "fns_heap.h"#define RR_MALLOC(a) OS_MALLOC(a,1)extern u32 t_time;#define RIP_GET_SYSTIME t_time/**** END COMMENT OUT IF NOT USING FUSION ****//* In order for SNMP to do route aging there must be a way to get the system time since bootup and store it in the route entry. RIP_GET_SYSTIME provides this mechanism. */#ifndef RIP_GET_SYSTIME#define RIP_GET_SYSTIME 0#endif#include "rribd.h"/* Not yet supported *//* #define IP_LOAD_SHARE */#define RR_RIP 1#ifdef IP_LOAD_SHARE#define MAX_IP_MSPLIT 3#else#define MAX_IP_MSPLIT 1#endif#define IP_HLEN 20#define UDP_HLEN 8#define CIRC_HASH_BITS 3#define CIRC_HASHES (1 << CIRC_HASH_BITS)/* define if all IP TOS supported *//* #define IP_ALL_METRICS *//* ip routing tables */#ifndef IP_DEF_ROUTE_BSZ#define IP_DEF_ROUTE_BSZ 64 #endif#ifndef IP_NONDEF_ROUTE_BSZ#define IP_NONDEF_ROUTE_BSZ 64#endif#ifndef MAX_IP_DEF_RT_BLK#define MAX_IP_DEF_RT_BLK 2#endif#ifndef MAX_IP_NONDEF_BLK#define MAX_IP_NONDEF_BLK 2#endif#ifndef IP_ROUTE_HASHES#define IP_ROUTE_HASHES 32#endif#ifndef IP_MAX_LOCAL_MCAST#define IP_MAX_LOCAL_MCAST 10#endif/* dont make too big since need to look in each bin per tic */#define ARP_HASH_BITS 3#define ARP_HASHES (1 << ARP_HASH_BITS)/* when true, ping and traceroute use raw sockets, else ping uses IcmpEchoRsp and traceroute uses udpRxErr*/#define IP_PING_RAW 0/* Define if routing table change needs external outcall*//* #define IP_RT_SIGNAL */ /* define if patricia tree is used for route storage *//* Note: NOT CURRENTLY SUPPORTED *//* #define IP_USE_PTREE *//* if IP_USE_PTREE is undefined and USE_BTREE is defined for routes in a given hash bin, all routes with matching mask are stored in a balanced binary tree. */#define USE_BTREE /* max number of logical circuits */#define MAX_CIRCUIT 8/* maximum logical interfaces: 1 lan port = 1 logical interface. 1 WAN port can = > 1 logical interface if connect to more than one destination.*/#define RR_MAX_INTF 8 /* highest IP IFID that will be used. Used to create an array for quick IFID to logical circuit mapping.*/#define MAX_IFID RR_MAX_INTF/* DEFINE if networks spans more than one phyisical interface*//* #define IP_VLAN *//* DO NOT CHANGE: multi-homing must now use different logical circuits even without OSPF *//* max number of ip addresses per interface (1-63) must be 1 for ospf (multi-homing done using multiple circuits) */#define MAX_IF_IPADD 1#define ARP_DEF_TTL 60*6 /* minutes (6 hours) */#define ARP_TABLE_SIZE 256#define ARP_REQ_LIST_SIZE 16#define ARP_REQ_TTL 10 /* seconds *//* macro mapping rip ciruit ID to interface ID for snmp */#define RIP_IFID(x) x /* MEMORY ALLOCATION MACROS */extern ibd_pt oframe_alloc(int len);extern void oframe_free (ibd_pt pdu_bd);/* alloc output frame */#define ipOfAlloc(len) oframe_alloc(len)#define ipOfFree(ptr) oframe_free(ptr) /* blocks of routes */#define ipRouteAlloc(len) RR_MALLOC(len)#define ipRipNodeAlloc() RR_MALLOC(sizeof(RNODE))#define ipNodeAlloc() RR_MALLOC(sizeof(INODE))/* circuits */#define ipCircuitAlloc(len) RR_MALLOC(len)#define ipCircuitFree(ptr) OS_FREE(ptr)#define ripCircuitAlloc(len) RR_MALLOC(len)#define ripCircuitFree(ptr) OS_FREE(ptr)/* neighbors */#define RipNeighAlloc() RR_MALLOC(sizeof(RNEIGH))#define RipNeighFree(ptr) OS_FREE(ptr)#define ipArpAlloc(len) RR_MALLOC(len)#define ipArpFree(ptr) OS_FREE(ptr)#define ipReasmAlloc(len) RR_MALLOC(len)#define ipReasmFree(ptr) OS_FREE(ptr)/* igmp group entries */#define igmpAlloc(len) RR_MALLOC(len)#define igmpFree(ptr) OS_FREE(ptr)#define ipStaticRtAlloc(len) RR_MALLOC(len)#define ipStaticRtFree(ptr) OS_FREE(ptr)/* ip security association entries */#define ipSAAlloc(len) RR_MALLOC(len)#define ipSAFree(ptr) OS_FREE(ptr)/* path mtu discovery blocks */#define ipPMTUAlloc(len) RR_MALLOC(len)#define ipPMTUFree(ptr) OS_FREE(ptr)#define ipSrouteAlloc(len) RR_MALLOC(len)#define ipSrouteFree(ptr) OS_FREE(ptr)/* NOTE: this mem copy assumes a 0 len copy is valid !!! */#define ipCopyMem(dst,src,len) rrCopyMem((char *)(dst),(char *)(src),len)#define ipFillMem(dst,data,len) rrFillMem((char *)dst,data,len) /*fill */#define ipDiffMem(dst,src,len) rrDiffMem((char *)dst,(char *)src,len) #define ipLink rrLink#define ipGenLink rrGenLink#define ipULink rrULink/* byte swapping moved to common file rrport.h */#define WTOPDU(add,val) u16_2n(add,val)#define DWTOPDU(add,val) u32_2n(add,val)#define WFROMPDU(add) n2u16(add)#define DWFROMPDU(add) n2u32(add)#define XIPA(xpdua) (rripa)uns_p2l(xpdua)#define WIPA(xpdua,xval) uns_l2p(xpdua,xval)#ifndef MAX#define MAX(a,b) ((a >= b)? a : b)#define MIN(a,b) ((a < b)? a : b)#endif/* counters and config objects used at the forwarding level that may or may not be accessible directly.*/#define RN_IPFORWARDING i_node->rn_ipForwarding#define RN_IPINRECEIVES i_node->rn_ipInReceives#define RN_IPFORWDATAGRAMS i_node->rn_ipForwDatagrams#define ARP_PROXY(xcid) (ipCircFromId(xcid))->rc_arpproxy#define ARP_DORSP(xcid) (ipCircFromId(xcid))->rc_arprsp#define CIRC_IPA(xcid) (ipCircFromId(xcid))->rc_ipa->ip_add#define GETLOCADDR(xcid,xipa) ipGetLocAddr(ipCircFromId(xcid),xipa)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -