📄 routing_table.h
字号:
/* * Copyright (c) 2004 Ying Ge, Communication Research Center Canada. * * Copyright (c) 2002, 2003 Maoyu Wang, Communication Research Center Canada. * * By Ying Ge: * 1. Change the OLSR packet format and message processing procedure based * on the OLSR RFC. * 2. Add support of multiple interfaces to OLSR, including MID message * creating and processing procedure as specified in the OLSR RFC. * 3. Add QoS Support to OLSR * * By Maoyu Wang: * 1. Ported OLSR from IPv4 to IPv6. * 2. Added the Host and Network Association (HNA) functionality into OLSR. * 3. Added the default gateway functionality into OLSR by extending the HNA * message usage. The default gateway functionality supported the mobility * by cooperating with Mobile IPv6 for a mobile node as well as supported * Internet access for MANET nodes. * * DISTRIBUTED WITH NO WARRANTY, EXPRESS OR IMPLIED. * See the GNU Library General Public License (file COPYING in the distribution) * for conditions of use and redistribution *//* * This Copyright notice is in French. An English summary is given * but the referee text is the French one. * * Copyright (c) 2000, 2001 Adokoe.Plakoo@inria.fr, INRIA Rocquencourt, * Anis.Laouiti@inria.fr, INRIA Rocquencourt. * * Ce logiciel informatique est disponible aux conditions * usuelles dans la recherche, c'est-à-dire qu'il peut * être utilisé, copié, modifié, distribué à l'unique * condition que ce texte soit conservé afin que * l'origine de ce logiciel soit reconnue. * Le nom de l'Institut National de Recherche en Informatique * et en Automatique (INRIA), ou d'une personne morale * ou physique ayant participé à l'élaboration de ce logiciel ne peut * être utilisé sans son accord préalable explicite. * * Ce logiciel est fourni tel quel sans aucune garantie, * support ou responsabilité d'aucune sorte. * Certaines parties de ce logiciel sont dérivées de sources developpees par * University of California, Berkeley et ses contributeurs couvertes * par des copyrights. * This software is available with usual "research" terms * with the aim of retain credits of the software. * Permission to use, copy, modify and distribute this software for any * purpose and without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, * and the name of INRIA, or any contributor not be used in advertising * or publicity pertaining to this material without the prior explicit * permission. The software is provided "as is" without any * warranties, support or liabilities of any kind. * This product includes software developed by the University of * California, Berkeley and its contributors protected by copyrights. * * $Id: routing_table.h,v 1.2 2000/12/06 10:36:12 prima Exp $ *//* * Routing table management daemon. */struct rthash { struct rt_entry *rt_forw; struct rt_entry *rt_back;};struct rt_entry_info{ olsr_u32_t rtu_hash; struct olsr_ip_addr rtu_src; olsr_u16_t rtu_src_prefix; struct olsr_ip_addr rtu_dst; olsr_u16_t rtu_dst_prefix; struct olsr_ip_addr rtu_router; olsr_u16_t rtu_router_prefix; olsr_u8_t rtu_flags;//Currently not used olsr_u8_t rtu_state;//Currently not used olsr_u16_t rtu_metric; /* qos OLSR */ olsr_u32_t rtu_busy; //added by Y.Ge, busy time of the route olsr_u8_t rtu_willingness; //added by Y.Ge, willingness of the first hop neighbor olsr_u8_t rtu_local_if; //added by Y.Ge, local interface of the routingg entry olsr_u16_t rtu_ifmetric;//Currently not used struct interface *rtu_ifp;//Currently not used };struct rt_entry { struct rt_entry *rt_forw; struct rt_entry *rt_back; struct rt_entry_info rt_entry_infos;};#define rt_hash rt_entry_infos.rtu_hash /* for host */#define rt_src rt_entry_infos.rtu_src /* Source*/#define rt_dst rt_entry_infos.rtu_dst /* Destination*/#define rt_router rt_entry_infos.rtu_router /* who to forward to */#define rt_src_prefix rt_entry_infos.rtu_src_prefix /* Source prefix*/#define rt_dst_prefix rt_entry_infos.rtu_dst_prefix /* Destination prefix*/#define rt_router_prefix rt_entry_infos.rtu_router_prefix /* Router prefix */#define rt_flags rt_entry_infos.rtu_flags /* kernel flags */#define rt_state rt_entry_infos.rtu_state /* Currently not used*/#define rt_metric rt_entry_infos.rtu_metric /* cost of route */#define rt_busy rt_entry_infos.rtu_busy /* added by Y.Ge, busy time of the route */#define rt_willingness rt_entry_infos.rtu_willingness /* added by Y.Ge, willlingness of the next_hop neighbor */#define rt_local_if rt_entry_infos.rtu_local_if /* added by Y.Ge, local interface */#define rt_ifmetric rt_entry_infos.rtu_ifmetric /* cost of route if, currently not used */#define rt_ifp rt_entry_infos.rtu_ifp /* interface to take, currently not used *//* * "State" of routing table entry. Currently not used */#define RTS_CHANGED 0x1 /* route has been altered recently */#define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */#define RTS_INTERNAL 0x4 /* internal route, not installed */#define RTS_PASSIVE IFF_PASSIVE /* don't time out route */#define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */#define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */#define RTS_SUBNET IFF_SUBNET /* route is for network subnet *//* * Flags are same as kernel, with this addition for af_rtflags: */#define RTF_SUBNET 0x80000 /* pseudo: route to subnet */struct destination_n{ struct rt_entry *destination; struct destination_n *next; };struct rt_entry*olsr_lookup_routing_table(struct olsr_ip_addr *dst);voidolsr_delete_routing_table(struct rt_entry* destination);voidolsr_release_routing_table(struct rthash *table);struct rt_entry *olsr_insert_routing_table(struct olsr_ip_addr *dst);struct rt_entry *olsr_insert_routing_table_from_topo(struct rt_entry *r_last,struct topology_destination_entry *destination);struct destination_n*olsr_fill_routing_table_with_neighbors();void olsr_calculate_routing_table();/* qos OLSR */void olsr_calculate_routing_table_with_qos(); //added by Y.Gevoidolsr_print_trace_routing_table(struct rthash *table);voidolsr_print_routing_table(struct rthash *table);voidqos_olsr_print_routing_table(struct rthash *table); //added by Y.Gevoidqos_olsr_print_trace_routing_table(struct rthash *table);voidolsr_update_default_gateway();struct rt_entry*olsr_add_default_gateway(struct olsr_ip_addr* gateway);voidolsr_del_default_gateway();//CRC HNA add/*-------------------------------------------------------*/voidolsr_copy_routing_table(struct rthash* table);voidolsr_add_routing_table_with_hna();voidolsr_modify_routing_table_from_hna();/*-------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -