📄 ip_cmn_rte_table.h
字号:
/****************************************/
/* Copyright (c) 1987 - 2002 */
/* by OPNET Technologies, Inc. */
/* (A Delaware Corporation) */
/* 7255 Woodmont Av., Suite 250 */
/* Bethesda, MD 20814, U.S.A. */
/* All Rights Reserved. */
/****************************************/
#ifndef _IP_CMN_RTE_TABLE_H_INCL_
#define _IP_CMN_RTE_TABLE_H_INCL_
/** Include directives. **/
#include <opnet.h>
#include <ip_addr_v4.h>
#include <ip_rte_v4.h>
#include <oms_pr.h>
#include <oms_sv.h>
#include <ip_acl_support.h>
#include <ip_rte_map_support.h>
#include <oms_ptree.h>
#include <oms_routing_convergence.h>
#if defined (__cplusplus)
extern "C" {
#endif
/** ----- Data Type Declarations ----- **/
/** A datatype that represents the type **/
/** of entry in a ip routes file. **/
/** 0 denotes dynamic routing protocol routes **/
/** 1 denotes statically configured routes **/
/** 2 denotes directly connected networks **/
/** sourced by ip. **/
typedef enum
{
IpC_Rte_Table_Type_Dyn = 0,
IpC_Rte_Table_Type_Static = 1,
IpC_Rte_Table_Type_Direct = 2
} IpT_Rte_Table_Type;
typedef enum
{
IpC_Rte_Table_Load_Packet = 0,
IpC_Rte_Table_Load_Dest = 1
} IpT_Rte_Table_Load;
/** A datatype that represents the **/
/** set of routing protocols that can **/
/** contribute entries to the common **/
/** IP route table. **/
typedef enum
{
IpC_Dyn_Rte_Invalid = -1,
IpC_Dyn_Rte_Directly_Connected = 0,
IpC_Dyn_Rte_Ospf = 1,
IpC_Dyn_Rte_Rip = 2,
IpC_Dyn_Rte_Igrp = 3,
IpC_Dyn_Rte_Bgp = 4,
IpC_Dyn_Rte_Eigrp = 5,
IpC_Dyn_Rte_Isis = 6,
IpC_Dyn_Rte_Static = 7,
IpC_Dyn_Rte_Ext_Eigrp = 8,
IpC_Dyn_Rte_IBgp = 9,
IpC_Dyn_Rte_Default = 10,
IpC_Dyn_Rte_Ripng = 11,
IpC_Dyn_Rte_Tora = 12,
IpC_Dyn_Rte_Aodv = 13,
IpC_Dyn_Rte_Olsr = 14,
IpC_Dyn_Rte_Mobile_IP = 15,
IpC_Dyn_Rte_LDP = 16,
IpC_Dyn_Rte_Custom = 17,
IpC_Dyn_Rte_Dymo = 18,
IpC_Dyn_Rte_Number = 19 /* KEEP LAST */
} IpT_Rte_Prot_Type;
/** ...and corresponding macros that **/
/** can be used by the clients of this **/
/** package. **/
#define IPC_DYN_RTE_DIRECTLY_CONNECTED IpC_Dyn_Rte_Directly_Connected
#define IPC_DYN_RTE_OSPF IpC_Dyn_Rte_Ospf
#define IPC_DYN_RTE_RIP IpC_Dyn_Rte_Rip
#define IPC_DYN_RTE_IGRP IpC_Dyn_Rte_Igrp
#define IPC_DYN_RTE_BGP IpC_Dyn_Rte_Bgp
#define IPC_DYN_RTE_EIGRP IpC_Dyn_Rte_Eigrp
#define IPC_DYN_RTE_ISIS IpC_Dyn_Rte_Isis
#define IPC_DYN_RTE_STATIC IpC_Dyn_Rte_Static
#define IPC_DYN_RTE_EXT_EIGRP IpC_Dyn_Rte_Ext_Eigrp
#define IPC_DYN_RTE_IBGP IpC_Dyn_Rte_IBgp
#define IPC_DYN_RTE_DEFAULT IpC_Dyn_Rte_Default
#define IPC_DYN_RTE_CUSTOM IpC_Dyn_Rte_Custom
#define IPC_DYN_RTE_RIPNG IpC_Dyn_Rte_Ripng
#define IPC_DYN_RTE_TORA IpC_Dyn_Rte_Tora
#define IPC_DYN_RTE_AODV IpC_Dyn_Rte_Aodv
#define IPC_DYN_RTE_OLSR IpC_Dyn_Rte_Olsr
#define IPC_DYN_RTE_DYMO IpC_Dyn_Rte_Dymo
#define IPC_DYN_RTE_MOBILE_IP IpC_Dyn_Rte_Mobile_IP
#define IPC_DYN_RTE_LDP IpC_Dyn_Rte_LDP
#define IPC_DYN_RTE_NUM ((int) IpC_Dyn_Rte_Number)
/* Used to store the status of VRF table entry */
#define IPC_VRF_TABLE_ENTRY_ACTIVE 1
#define IPC_VRF_TABLE_ENTRY_INACTIVE 2
/** Define a array of strings that contain **/
/** the names of the supported standard **/
/** routing protocols. **/
extern const char* IpC_Dyn_Rte_Prot_Names[IPC_DYN_RTE_NUM];
/** Macro representing the administrative **/
/** weight to be associated with directly **/
/** connected networks. **/
#define IPC_DIRECTLY_CONNECTED_ADMIN_WEIGHT 0
/** Macros representing the metrics or **/
/** costs at which external routes are **/
/** redistributed into various routing **/
/** protocols. **/
#define IPC_EXT_RTE_RIP_DEFAULT_METRIC 0
#define IPC_EXT_RTE_IGRP_DEFAULT_METRIC 1000000000
#define IPC_EXT_RTE_EIGRP_DEFAULT_METRIC 1000000000
#define IPC_EXT_RTE_BGP_DEFAULT_METRIC 0
#define IPC_EXT_RTE_OSPF_DEFAULT_METRIC 100
/** Macros representing the type of **/
/** metric associated with an externally**/
/** derived route. Only OSPF uses this. **/
#define IPC_EXT_RTE_METRIC_TYPE_UNUSED -1
#define IPC_EXT_RTE_METRIC_TYPE_OSPF_EXT1 1
#define IPC_EXT_RTE_METRIC_TYPE_OSPF_EXT2 2
/** Default AS External Type (1 or 2) **/
/** used by OSPF when advertising **/
/** externally derived routing info. **/
#define IPC_EXT_RTE_METRIC_TYPE_OSPF_DEFAULT IPC_EXT_RTE_METRIC_TYPE_OSPF_EXT2
/** Number of address families **/
/** (IPv4 and IPv6) **/
#define IPC_NUM_ADDR_FAMILIES 2
/** Macro representing the integer code **/
/** that is associated with the remote **/
/** interrupt issued by the package to **/
/** various routing protocol processes. **/
#define IPC_EXT_RTE_REMOTE_INTRPT_CODE -100
/* Macro representing the initial value of custom routing protocol's id.*/
#define IPC_INITIAL_CUSTOM_RTE_PROTOCOL_ID 100
/* Macro representing the minor port default value. */
#define IPC_MINOR_PORT_DEFAULT 0
/* Macros which represent the type of routes */
/* which are being redistributed. The */
/* redistribution algorithm will determine */
/* which actions (if any) are performed based */
/* on this value. */
#define IPC_REDIST_TYPE_ADD 0
#define IPC_REDIST_TYPE_WITHDRAW 1
#define IPC_REDIST_TYPE_UPDATE 2
#define IPC_REDIST_TYPE_UPDATE_DIRECT 4
/* Macros which represent the redistribution */
/* type for BGP into other protocols. Also */
/* contains a macro for instances where BGP is */
/* not the protocol being redistributed from. */
#define IPC_REDIST_EBGP_ONLY 0
#define IPC_REDIST_IBGP_AND_EBGP 1
#define IPC_REDIST_NOT_BGP -1
/* Values used while adding IP Cmn Route Table Entries */
#define IPC_CMN_RTE_TABLE_ENTRY_NO_OPTION 0x00
#define IPC_CMN_RTE_TABLE_ENTRY_ADD_INDIRECT_NEXTHOP_OPTION 0x01
/* Most significant 32 bits represent the */
/* routing protocol, and the least significant */
/* 32 bits represent the as_number. */
/* For protocols such as IS-IS where the */
/* process identifier (as number) is a string, */
/* there will be a hash table for mapping the */
/* string to an integer. */
typedef OpT_uInt64 IpT_Rte_Proc_Id;
/* Macro representing that multiple processes are to be */
/* ignored. */
#define IPC_NO_MULTIPLE_PROC 0
/* Macro for creating a routing process ID */
#define IP_CMN_RTE_TABLE_UNIQUE_ROUTE_PROTO_ID(_prot_name,_as_number) ((IpT_Rte_Proc_Id)((((IpT_Rte_Proc_Id)_prot_name) << 32) | ((IpT_Rte_Proc_Id)_as_number)))
/* Macros for retreiving the routing protocol and AS */
/* number for a routing processes ID. */
#define IP_CMN_RTE_TABLE_ROUTEPROC_PROTOCOL(_routeproc_id) ((int)(_routeproc_id >> 32))
#define IP_CMN_RTE_TABLE_ROUTEPROC_AS_NUMBER(_routeproc_id) ((int)(_routeproc_id & 0x00000000ffffffff))
#define IP_CMN_RTE_TABLE_PROTOCOL_IS_DIRECT(_routeproc_id) (IP_CMN_RTE_TABLE_ROUTEPROC_PROTOCOL(_routeproc_id) == IPC_DYN_RTE_DIRECTLY_CONNECTED)
/* Macro representing the function used for a lookup if the source and destination IP addresses aren't available */
#define ip_cmn_rte_table_lookup(fast_address_unused,route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr)\
ip_cmn_rte_table_lookup_cache(fast_address_unused,route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr,IPC_FAST_ADDR_INVALID,IPC_FAST_ADDR_INVALID,0)
/* Macro representing the function used for a recursive lookup if the source and destination IP addresses aren't available */
#define ip_cmn_rte_table_recursive_lookup(fast_address_unused,route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr)\
ip_cmn_rte_table_recursive_lookup_cache(fast_address_unused,route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr,IPC_FAST_ADDR_INVALID,IPC_FAST_ADDR_INVALID)
/* Macro representing the function used for a lookup if the source and destination IP addresses aren't available */
#define inet_cmn_rte_table_lookup(route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr)\
inet_cmn_rte_table_lookup_cache(route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr,IPC_FAST_ADDR_INVALID,IPC_FAST_ADDR_INVALID,0)
/* Macro representing the function used for a recursive lookup if the source and destination IP addresses aren't available */
#define inet_cmn_rte_table_recursive_lookup(route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr)\
inet_cmn_rte_table_recursive_lookup_cache(route_table,dest,next_hop_ptr,port_info_ptr,src_proto_ptr,rte_entry_pptr,IPC_FAST_ADDR_INVALID,IPC_FAST_ADDR_INVALID)
/* Enumerated type representing bit positions for each */
/* route flag. */
typedef enum IpT_Cmn_Rte_Table_Flag_Bitpos
{
IpC_Cmn_Rte_Table_Flag_Bitpos_Default = 0, /* The route is used to resolve the NH of a 0.0.0.0/0 route */
IpC_Cmn_Rte_Table_Flag_Bitpos_Default_Network = 1, /* The route is used to resolve a default network route */
IpC_Cmn_Rte_Table_Flag_Bitpos_Static = 2, /* The route is used to resolve the nh of a static route */
IpC_Cmn_Rte_Table_Flag_Bitpos_Cand_Default = 3 /* The route is a candidate default route. */
} IpT_Cmn_Rte_Table_Flag_Bitpos;
/* Macros indicating bit positions in the flags field of*/
/* a common route table entry. */
#define IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_ROUTE ((OpT_uInt16) (1 << IpC_Cmn_Rte_Table_Flag_Bitpos_Default))
#define IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_NTWK_ROUTE ((OpT_uInt16) (1 << IpC_Cmn_Rte_Table_Flag_Bitpos_Default_Network))
#define IPC_COM_RTE_TABLE_ENTRY_FLAG_STATIC_ROUTE ((OpT_uInt16) (1 << IpC_Cmn_Rte_Table_Flag_Bitpos_Static))
#define IPC_COM_RTE_TABLE_ENTRY_FLAG_CANDIDATE_DEFAULT ((OpT_uInt16) (1 << IpC_Cmn_Rte_Table_Flag_Bitpos_Cand_Default))
/* Macros to set and inspect the various flags. */
#define ip_cmn_rte_table_entry_default_flag_set(_entry) ((_entry)->flags |= IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_ROUTE)
#define ip_cmn_rte_table_entry_default_flag_is_set(_entry) ((Boolean) (0 != ((_entry)->flags & IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_ROUTE)))
#define ip_cmn_rte_table_entry_default_ntwk_flag_set(_entry) ((_entry)->flags |= IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_NTWK_ROUTE)
#define ip_cmn_rte_table_entry_default_ntwk_flag_is_set(_entry) ((Boolean) (0 != ((_entry)->flags & IPC_COM_RTE_TABLE_ENTRY_FLAG_DEFAULT_NTWK_ROUTE)))
#define ip_cmn_rte_table_entry_static_flag_set(_entry) ((_entry)->flags |= IPC_COM_RTE_TABLE_ENTRY_FLAG_STATIC_ROUTE)
#define ip_cmn_rte_table_entry_static_flag_is_set(_entry) ((Boolean) (0 != ((_entry)->flags & IPC_COM_RTE_TABLE_ENTRY_FLAG_STATIC_ROUTE)))
#define ip_cmn_rte_table_entry_cand_default_flag_set(_entry) ((_entry)->flags |= IPC_COM_RTE_TABLE_ENTRY_FLAG_CANDIDATE_DEFAULT)
#define ip_cmn_rte_table_entry_cand_default_flag_is_set(_entry) ((Boolean) (0 != ((_entry)->flags & IPC_COM_RTE_TABLE_ENTRY_FLAG_CANDIDATE_DEFAULT)))
/* Macros to set and inspect Options flag while adding IP Cmn Route Table Entry */
#define ip_cmn_rte_table_entry_add_option_set(_options, _option_type) ((int)(_options |= _option_type))
#define ip_cmn_rte_table_entry_add_option_is_set(_options, _option_type) (_options & _option_type)
/* Data structure describing a custom routing protocol. */
typedef struct
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -