opnet 路由表

来源:互联网 发布:学汉语拼音的软件 编辑:程序博客网 时间:2024/05/21 06:21

数据结构IpT_Rte_Module_Data是一个ip_dispatch和其子进程所共有的一个数据结构,下面列出的和路由表相关的

struct IpT_Rte_Module_Data {…IpT_Cmn_Rte_Table*ip_route_table;IpT_Rte_Table*ip_static_rte_table;InetT_Addressdefault_route_addr_array[2];IpT_Rte_Map_Table *        rte_map_table;IpT_Rte_Map_Table *firewall_filter_table;struct IpT_Manet_Info*manet_info_ptr;/* Mobile Ad hoc network information.*/…}

1)IpT_Cmn_Rte_Table* ip_route_table;

是系统所公用的路由表,类比于内核中的内核路由表;

typedef struct IpT_Cmn_Rte_Table{Objidnode_objid;intusage_threshold;/* Vector which keeps track of the process handles*//* of all routing processes (including any multiple*//* processes of the same protocol) that are running*//* on this node.*/PrgT_Vector*routeproc_vptr;/* Vector which keeps track of the redistribution*//* matrix for this node.  Each element in the list*//* will correspond to a routing process running on*//* this node (therefore, the size of this vector *//* and the size of routeproc_vptr will be the*//* same).  Each element will have a corresponding*//* list of all the routing processes it*//* redistributes to.*/PrgT_Vector*redist_matrix_vptr;IpT_Rte_Table_Loadload_type;/* IPv4 and IPv6 Patricia trees.*/OmsT_Ptree*ptree_ptr_array[IPC_NUM_ADDR_FAMILIES];/* Total number of entries in the table.*/intnum_entries;/* Statistics for monitoring routing table updates.*//* The array of stathandles will record statistics*//* separately for All updates, Add, Remove, Changes*//* and also time between two consecutive updates.*//* Uses "IpT_Rte_Table_Updates" as the indices.*/Stathandleupdate_stathandle [6];doublelast_update_time;/* Key to the hash of convergence statistics */OmsT_Convergence_Handleconvg_handle;/* Information about the IPv4 default route*/IpT_Cmn_Rte_Table_Entry*gateway_of_last_resort;IpT_Cmn_Rte_Table_Entry*best_default_route;/* Default routes need to mantained separately.*//* This is for IPv4 only.*/<span style="color:#ff0000;">List*resolved_default_routes;List*unresolved_default_routes;</span>/* Pointer to the Module data of the parent node*/struct IpT_Rte_Module_Data*iprmd_ptr;/* Cache table used to implement destination based*//* load balancing.*/IpT_Cmn_Rte_Dest_Src_Table_Handledest_src_table;/* Number of entries in the above table.*/int dest_src_table_size;/* VRF to which this route table belongs.*/struct IpT_Vrf_Table*vrf_table_ptr;#ifdef OPD_PARALLEL/* Spinlock to serialize access to this route table */PrgT_Mt_Spinlockip_cmn_rte_table_spinlock;#endif /* OPD_PARALLEL */} IpT_Cmn_Rte_Table;


该结构中,成员

<span style="color: rgb(255, 0, 0);">List*resolved_default_routes;List*unresolved_default_routes;</span>
是实际路由表,List是一个链表结构;

其路由表项Entry是由下面的数据结构表示:

typedef struct IpT_Cmn_Rte_Table_Entry{IpT_Dest_Prefixdest_prefix;IpT_Rte_Proc_Idroute_src_proto;doubleroute_insert_time;OpT_uInt16flags;void*route_src_obj_ptr;int admin_distance;    List*               next_hop_list;    List*               backup_list;} IpT_Cmn_Rte_Table_Entry;typedef struct IpT_Dest_Prefix{unsigned charaddr_family;/* InetT_Addr_Family value*/InetT_Subnet_Masksubnet_mask;/* Subnet mask.*/union{IpT_Addressipv4_addr;/* Ipv4 address.*/struct Ipv6T_Address*ipv6_addr_ptr;/* Ipv6 address.*/} address;} InetT_Address_Range;


2)IpT_Rte_Table* ip_static_rte_table;
是保存静态路由表,静态路由表会插入到common table中;
静态路由表Entry:

typedef struct IpT_Rte_Table_Entry   {   Boolean                valid;                      IpT_Dest_Prefix        dest_prefix;   InetT_Address          next_hop;   int                    admin_weight;}IpT_Rte_Table_Entry;

3)InetT_Address default_route_addr_array[2];

表示的系统的默认路由,默认路由是指向其所连接网关的IP地址,这是个具有两个元素的数组,分别表示ipv4和ipv6;


4) struct IpT_Manet_Info* manet_info_ptr;/* Mobile Ad hoc network information.*/

有的Mobile Ad hoc network会有用来建立路由的协议路由表

typedef struct IpT_Manet_Info{Prohandlemgr_prohandle;IpT_Rte_Protocolrte_protocol;AodvT_Route_Table*aodv_route_table_ptr; Booleanmanet_gateway_status;} IpT_Manet_Info;

当协议时aodv协议时,用到aodv路由表:

typedef struct{InetT_Address_Hash_Table_Handleroute_table;IpT_Cmn_Rte_Table*ip_cmn_rte_table_ptr;IpT_Rte_Proc_Idaodv_protocol_id;doubleroute_expiry_time;doubledelete_period;AodvT_Local_Stathandles*stat_handles_ptr;intactive_route_count;} AodvT_Route_Table;
Aodv路由表Entry:

typedef struct{IpT_Dest_Prefix dest_prefix;intdest_seq_num;Booleanvalid_dest_sequence_number_flag;AodvC_Route_Entry_Stateroute_entry_state;InetT_Addressnext_hop_addr;IpT_Port_Info next_hop_port_info;inthop_count;List*precursor_lptr;doubleroute_expiry_time;Evhandleroute_expiry_evhandle;} AodvT_Route_Entry;








0 0
原创粉丝点击