⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ip_rte_v4.h

📁 备
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ip_rte_v4.h */
/* Definitions file for IP routing procedures. */

/****************************************/
/* 	     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_RTE_H_INCL_
#define _IP_RTE_H_INCL_

#include <opnet.h>
#include <nato.h>
#include <ip_addr_v4.h>
#include "oms_data_def.h"
#include "ip_igmp_support.h"
#include <ip_dgram_sup.h>					/* Access IpT_Dgram_Fields */
	
#ifndef HDR_IP_QOS_SUPPORT_H
#  include "ip_qos_support.h"
#endif

#ifndef _MIPV6_DEFS_H_INCL_
#	include "mipv6_defs.h"
#endif



#if defined (__cplusplus)
extern "C" {
#endif

/* Constant that stores the maximum length of the name of	*/
/* an interface or a subinterface							*/
#define IPC_MAX_INTF_NAME_LEN			31

/* Contants related to subinterfaces						*/
#define IPC_SAME_AS_PARENT_STR		"Same as Parent"
#define IPC_SUBIF_MCAST_DISABLED		 0
#define IPC_SUBIF_MCAST_ENABLED			 1
#define IPC_MCAST_SAME_AS_PARENT		-1
#define IPC_MTU_SAME_AS_PARENT			-3
#define IPC_BANDWIDTH_SAME_AS_PARENT	-1
#define IPC_SUBINTF_PHYS_INTF			-1

/* Recommended minimum MTU for an IPv6 interface.			*/
/* RFC 2460 Sec. 5.											*/
#define IPV6C_MIN_MTU					1500

/* Macro representing a MAC layer broadcast address.		*/
#define IPC_PHYS_ADDR_BROADCAST			-1

/* Macro representing an invalid MAC Address.				*/
#define IPC_PHYS_ADDR_INVALID			-2

/* Value of ouput and input streams for logical interfaces	*/
#define IPC_PORT_NUM_INVALID			-1

/* Value of the addr_index field for logical interfaces.	*/
#define IPC_ADDR_INDEX_IVNALID			-1

/* Value corresponding to the symbol map Use link bandwidth	*/
/* of the Bandwidth attribute under Metric Information.		*/
#define IPC_BW_USE_LINK_BW	-1
#define IPC_BW_AUTO_CALC	-2

/* Value corresponding to the symbol map Auto Calculate		*/
/* for the Interface Speed attribute.						*/
#define IPC_INTF_SPEED_AUTO_CALCULATE	-1.0

/* Generic Routing Encapsulation header size.				*/
#define IPC_TUNNEL_GRE_BASE_HDR_SIZE_BITS		32
#define IPC_TUNNEL_GRE_HDR_OPTIONS_SIZE_BITS	32

/* Tunnel related constants	*/
#define IPC_TUNNEL_TOS_INHERITED				-1		
#define	IPC_TUNNEL_TTL_INHERITED				-1
#define IPC_TUNNEL_TOS_DEFAULT					0
#define IPC_TUNNEL_TTL_DEFAULT					255

#define IPC_TUNNEL_PASSENGER_PROTO_IPV4_MASK	0x01
#define IPC_TUNNEL_PASSENGER_PROTO_IPV6_MASK	0x02

#define IP_TUNNEL_PASSENGER_PROTOCOL_IPV6_IS_ENABLED(_tunnel_info_ptr_) \
	((Boolean) (_tunnel_info_ptr_->passenger_proto_flags & IPC_TUNNEL_PASSENGER_PROTO_IPV6_MASK))
#define IP_TUNNEL_PASSENGER_PROTOCOL_IPV4_IS_ENABLED(_tunnel_info_ptr_) \
	((Boolean) (_tunnel_info_ptr_->passenger_proto_flags & IPC_TUNNEL_PASSENGER_PROTO_IPV4_MASK))
#define IP_TUNNEL_PASSENGER_PROTOCOL_ENABLE_IPV6(_tunnel_info_ptr_) \
	(_tunnel_info_ptr_->passenger_proto_flags |= IPC_TUNNEL_PASSENGER_PROTO_IPV6_MASK)
#define IP_TUNNEL_PASSENGER_PROTOCOL_ENABLE_IPV4(_tunnel_info_ptr_) \
	(_tunnel_info_ptr_->passenger_proto_flags |= IPC_TUNNEL_PASSENGER_PROTO_IPV4_MASK)

/* The size of PPP header. This is the total overhead in bits on PPP links.	*/
#define IPC_PPP_HEADER_SIZE_BITS			56

typedef enum IpT_Intf_Lower_Layer_Type
	{
	IpC_Intf_Lower_Layer_Invalid,
	IpC_Intf_Lower_Layer_LAN,
	IpC_Intf_Lower_Layer_FR,
	IpC_Intf_Lower_Layer_ATM,
	IpC_Intf_Lower_Layer_PPP
	}	IpT_Intf_Lower_Layer_Type;

/* Enumerated data type to identify the type IP interface.	*/
/* This is required due to the fact that we send an ICI		*/
/* with a packet to the lower layer, which is case of 		*/
/* "dumb" interfaces like "slip" is not required.			*/
typedef enum IpT_Interface_Type
	{
	IpC_Intf_Type_Unspec,
	IpC_Intf_Type_Dumb,
	IpC_Intf_Type_Smart
	} IpT_Interface_Type;

typedef enum IpT_Interface_Status
	{
	IpC_Intf_Status_Active,
	IpC_Intf_Status_Shutdown,
	IpC_Intf_Status_Loopback,
	IpC_Intf_Status_Tunnel,
	IpC_Intf_Status_Unconnected,
	IpC_Intf_Status_Group
	} IpT_Interface_Status;

/* Enumerated type specifying the source of the packet		*/
/* arriving to the IP routing process model.				*/
typedef enum 
	{
	IpC_Pk_Instrm_Child = -1	/* Packet is from child process. */
	} IpT_Pk_Instrm_Type;

typedef enum
	{
	IpC_Policy_Action_Unknown,
	IpC_Policy_Action_Drop,
	IpC_Policy_Action_Reroute,
	IpC_Policy_Action_Alter_Tos,
	IpC_Policy_Action_Alter_Prec,
	IpC_Policy_Action_Alter_Dscp,
	IpC_Policy_Action_Traverse,
	IpC_Policy_Action_Destination_Reached
	} IpT_Policy_Action;

/* Parent-to-child shared memory used to transfer packets between	*/
/* IP and its child processes (ip_basetraf_src or ip_icmp.)  Both	*/
/* the elements of this shared data structures are filled by the	*/
/* child process just before invoking IP.							*/
typedef struct
	{
	int						child_process_id;		/* Process ID of the child process.		*/

	Packet*					child_pkptr;			/* Packet pointer that the child		*/
													/* process wants to transmit.			*/

	IpT_Mcast_Ptc_Info		ip_mcast_ptc_info;		/* This field is used for communication	*/
													/* between IGMP (child) processes and	*/
													/* IP (parent) process					*/

	int						intf_index;				/* The IPv6 Index of the interface on	*/
													/* which the packet was received. Needed*/
													/* for icmp6 process.					*/
	} IpT_Ptc_Memory;

/* Struct to hold the IP Policy Checker information							*/
typedef struct
	{
	/* The Policy Check Demand ID					*/
	Objid				demand_id;
	Boolean				record_details;
	Boolean				reachable;
	List*				ip_policy_action_lptr;
	} IpT_Policy_Check_Info;

/* Struct to hold the IP Policy Action information	*/
typedef struct
	{
	char*				node_name;
	IpT_Policy_Action	policy_action;
	char*				rte_map_or_filter_name;
	char*				iface_name;	
	} IpT_Policy_Action_Info;

/* Structure to hold the IP protocol-specific info */
/* in type OmsT_Basetraf_Conversation_Info         */
typedef struct
	{
	char*					demand_name;
	InetT_Address 			src_addr; 
	InetT_Address 			dest_addr;
	int 					bgutil_tos;
	OmsT_Tracer_RR_Option 	route_record_option;
	Boolean 				route_recorded; 

	/* Demand object attributes to support Policy Routing 	*/
	InetT_Address 			actual_src_addr; 
	InetT_Address 			actual_dest_addr;
	int 					src_port;
	int 					dest_port;
	int 					protocol;
	IpT_Policy_Check_Info*	policy_check_info_ptr;
	} IpT_Conversation_Info;


/* This field will be added to a tracer packet to store		*/
/* IP specific information, like Src, dest address,			*/
/* port info, and protocol etc.This information will be		*/
/* used while using policy routing on Bgutil packets		*/			
struct IpT_Tracer_Pkt_IP_Info
	{
	InetT_Address 						actual_src_addr; 
	InetT_Address 						actual_dest_addr;
	int 								src_port;
	int 								dest_port;
	int 								protocol;
	IpT_Policy_Check_Info*				ip_policy_check_info_ptr;
	char*								demand_name;
	int									copy_counter; 	/* To keep track of copies that are pointing to orig structure.	*/
	struct IpT_Tracer_Pkt_IP_Info*		orig_struct_ptr;	
	};

typedef struct IpT_Tracer_Pkt_IP_Info	IpT_Tracer_Pkt_IP_Info;	

/* The structure below is needed as a return value */
/* from a unified parsing function which reads tos */
/* protocol, dest and src addresses, dest and src  */
/* port numbers from an IP dgram encapsulating a   */
/* TCP segment, a UDP segment or a bgutil_tracer.  */
typedef struct
	{
	int					packet_tos; 
	int					protocol; 
	InetT_Address		source_address; 
	InetT_Address		dest_address; 
	int					source_port; 
	int					dest_port; 
	Packet*				orig_pkptr;
	} IpT_Pkt_Socket_Info; 

/* Structure to hold the metric components of an IP interface */
typedef struct
	{
	int					    reliability;		
	int					    load;				
	int					    bandwidth;			/* in kbps */
	double					delay;				/* in units of 10 usec */
	} IpT_Intf_User_Metrics;

/* Enumerated type describing types of dynamic routing available.				*/
/* Default indicates the value will be chosen as specified on the IP interface.	*/
typedef enum
	{
	IpC_Rte_Default = -99,
	IpC_Rte_Custom = -2,
	IpC_Rte_None = -1,
	IpC_Rte_Rip = 0,
	IpC_Rte_Igrp,
	IpC_Rte_Ospf,
	IpC_Rte_Bgp,
	IpC_Rte_Eigrp,
	IpC_Rte_Isis,
	IpC_Rte_Dsr,
	IpC_Rte_Tora,
	IpC_Rte_Aodv,
	IpC_Rte_Olsr,
	IpC_Rte_Dymo, // koo
	IpC_Rte_Ripng,
	IpC_Rte_Static
	} IpT_Rte_Protocol;

/* Structure to hold an (IP destination addr, VC name) pair      */
/* for the layer 2 mapping of a multipoint interface. A multi-   */
/* point interface connects to several VCs, each for a different */
/* IP destination address. */
typedef struct
	{
	InetT_Address	ip_dest_addr;
	char* 			vc_name; 
	} IpT_Dest_To_VC_Mapping; 

/* Structure that stores the information like PVCs connected to	*/
/* a subinterface, VLAN/ELAN(s) to which the subinterface		*/
/* belongs etc.													*/
typedef struct
	{
	/* An array of (IP destination addr, ATM VC name) pairs for    */
	/* the ATM Layer 2 Mapping, together with the array dimension. */
	IpT_Dest_To_VC_Mapping* 	atm_pvc_set; 
	int 						num_atm_pvcs;
	
	/* An array of (IP destination addr, FR VC name) pairs for    */
	/* the FR Layer 2 Mapping, together with the array dimension. */
	IpT_Dest_To_VC_Mapping*		fr_pvc_set;
	int							num_fr_pvcs; 
	
	int							vlan_identifier;
	short						num_elan_names;
	char**						elan_names;
	} IpT_Layer2_Mappings;

/* Enumerates the types of lower layer mappings stored in the	*/
/* above structure.												*/
typedef enum
	{
	IpC_Layer2_Mapping_ATM_PVC,
	IpC_Layer2_Mapping_FR_PVC,
	IpC_Layer2_Mapping_VLAN_Identifier,
	IpC_Layer2_Mapping_ELAN_Name
	} IpT_Layer2_Mapping;

/* Enumerates the types of ICIs, which can be received in the	*/
typedef enum IpT_Rte_App_Ici_Type
	{
	IpC_Rte_Mcast_Ici = 0,
	IpC_Rte_Rsvp_Ici  = 1,
	IpC_Rte_Vpn_Ici	  = 2
	} IpT_Rte_App_Ici_Type;

typedef enum IpT_Interface_Mode
	{
	IpC_Interface_Mode_None,
	IpC_Interface_Mode_IPv4_Only,
	IpC_Interface_Mode_IPv4_IPv6,
	IpC_Interface_Mode_IPv6_Only
	} IpT_Interface_Mode;

typedef enum IpT_Tunnel_Mode
	{
	IpC_Tunnel_Mode_IPv6_Manual,
	IpC_Tunnel_Mode_IPv6_Auto,
	IpC_Tunnel_Mode_IPv6_6to4,
	IpC_Tunnel_Mode_GRE,
	IpC_Tunnel_Mode_IPIP,
	IpC_Tunnel_Mode_IPsec,
	IpC_Tunnel_Mode_Unspecified
	} IpT_Tunnel_Mode;

typedef enum IpT_Addr_Status
	{
	IPC_ADDR_STATUS_DUPLICATE = 0,
	IPC_ADDR_STATUS_UNIQUE
	}IpT_Addr_Status;

/* ..and corresponding bit flags.			*/
#define	IPC_RTE_PROTO_RIP		(1<<0)
#define	IPC_RTE_PROTO_IGRP		(1<<1)
#define	IPC_RTE_PROTO_OSPF		(1<<2)
#define	IPC_RTE_PROTO_BGP		(1<<3)
#define IPC_RTE_PROTO_EIGRP     (1<<4)
#define IPC_RTE_PROTO_ISIS		(1<<5)
#define IPC_RTE_PROTO_RIPNG		(1<<6)
#define	IPC_RTE_PROTO_STATIC	(1<<7)

/* Flags indicating the selection of the simulation */
/* attribute "IP Routing Table Export/Import"		*/ 
#define IP_RTE_TABLE_EXPORT_IMPORT_NOT_USED		0
#define IP_RTE_TABLE_EXPORT          			1
#define IP_RTE_TABLE_IMPORT						2
#define IP_RTE_TABLE_NON_DET					-1

/* Macro for interrupt code send by IP to routing processes		*/
#define IP_IMPORT_TABLE							1

/* Data structure to hold a secondary address and mask.		*/
typedef struct IpT_Secondary_Address
	{
	IpT_Address_Range		ip_addr_range;
	InetT_Address_Range		inet_addr_range;
	} IpT_Secondary_Address;

/* Data structure to hold all the secondary addresses of	*/
/* an interface.											*/
typedef struct IpT_Sec_Addr_Table
	{
	int						num_sec_addresses;
	IpT_Secondary_Address*	sec_addr_array;
	} IpT_Sec_Addr_Table;

/* Data structure to hold MPLS information for a particular interface						*/
typedef struct
	{
	Boolean 			iface_mpls_status;	/* Boolean to hold the MPLS status on this iface*/
	
	int					supported_resource_class;
											/* Resource Classes supported by this interface	*/
											/* These RCs will be used while calculating		*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -