📄 neighbor_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: neighbor_table.h,v 1.2 2000/12/06 10:36:11 prima Exp $ *//* * Routing table management daemon. *//* *Neighbor table structure. *//*************** added by Y.Ge ****************//* in the implementation of OLSR_V11, * the neighbor_table is regarded * as "LINK TUPLE *//*************** end of revision ****************/struct neighbor_2_list_entry { struct neighbor_2_list_entry *neighbor_2_next; struct neighbor_2_entry *neighbor_2; struct timeval neighbor_2_timer;};/*********** addedd by Y.Ge ***********/struct link_to_main_neighbor { struct main_addr_neigh_entry *main_neighbor;};/*********** end of revision **********/struct neighbor_info { olsr_u32_t neighbor_hash; struct olsr_ip_addr neighbor_addr; struct olsr_ip_addr my_iface_addr; //added by Y.Ge olsr_u8_t my_iface_index; //added by Y.Ge olsr_u8_t neighbor_status; //Y.Ge: actually, it is the link code of the link tuple /***** added by Y.Ge *****/ /* qos OLSR */ /* as HELLO and QoS HELLO are sent seperately (in two messages) */ /* in order to make sure that the received busy information has a one-to-one match with the HELLO */ /* so everytime the node send HELLO, it sends QoS HELLO with the same message sequence number */ /* thus the neighbor busy time can be updated properly */ olsr_u16_t neighbor_hello_seq; //the hello sequence number. olsr_u32_t neighbor_busy_time; //the busy time of the neighbor /***** end of revision *****/ struct timeval neighbor_timer; struct timeval neighbor_link_sym_timer;//added by Y.Ge struct timeval neighbor_link_asym_timer; //added by Y.Ge, int neighbor_2_nocov; struct interface *neighbor_ifp; struct neighbor_2_list_entry *neighbor_2_list; struct link_to_main_neighbor *neighbor_main_info; //added by Y.Ge /* the following is used in hysteresis */ float neighbor_hysavg; /* Last Hysteresis Average, Y.Ge: L_link_quality */ olsr_u16_t neighbor_last_seq; /* Last Hello Seq Number */ float h_time_value; /* the H_time in the most resent HELLO */ struct timeval neighbor_link_lost_timer; /* added by Y.Ge, link lost timer */ struct timeval next_hello_timer; /* added by Y.Ge, time to receive next hello */ int link_pending; // added by Y.Ge};struct neighbor_entry { struct neighbor_entry *neighbor_forw; struct neighbor_entry *neighbor_back; struct neighbor_info neighbor_infos;};#define neighbor_hash neighbor_infos.neighbor_hash#define neighbor_addr neighbor_infos.neighbor_addr /* one-hop neighbor address */#define my_iface_addr neighbor_infos.my_iface_addr /* my interface address that connects to the neighbor*/ //added by Y.Ge#define my_iface_index neighbor_infos.my_iface_index /* my interface index that connects to the neigghbor*/ //added by Y.Ge#define neighbor_status neighbor_infos.neighbor_status /* status of the link between the neighbor and this node (see bellow) *//* qos OLSR */#define neighbor_hello_seq neighbor_infos.neighbor_hello_seq#define neighbor_busy_time neighbor_infos.neighbor_busy_time#define neighbor_2_nocov neighbor_infos.neighbor_2_nocov /* number of neighbors to the one hop neighbor and not yet covered */#define neighbor_timer neighbor_infos.neighbor_timer /* for invalidation */#define neighbor_link_sym_timer neighbor_infos.neighbor_link_sym_timer /* time till which link is considered as sym */#define neighbor_link_asym_timer neighbor_infos.neighbor_link_asym_timer /* time till which link is considered as asym */#define neighbor_ifp neighbor_infos.neighbor_ifp /* interface to take to this neighbor */#define neighbor_2_list neighbor_infos.neighbor_2_list /* list of two hops neighbors accessible by this one hop neighbor */#define neighbor_main_info neighbor_infos.neighbor_main_info /* connect to the main_addr_neighbor_table */#define neighbor_hysavg neighbor_infos.neighbor_hysavg#define neighbor_last_seq neighbor_infos.neighbor_last_seq#define h_time_value neighbor_infos.h_time_value#define neighbor_link_lost_timer neighbor_infos.neighbor_link_lost_timer /* time when the link should be advertised as LOST */#define next_hello_timer neighbor_infos.next_hello_timer /* tine when we should expect the next HELLO */#define link_pending neighbor_infos.link_pending /* link pending */struct neighborhash { struct neighbor_entry *neighbor_forw; struct neighbor_entry *neighbor_back;};struct neighbor_table { olsr_u16_t neighbor_mpr_seq; struct neighborhash *neighborhash;};/* * "Status" of link. *//***************** the followinng is added by Y.Ge ****************//* link type */#define UNSPEC_LINK 0#define ASYM_LINK 1#define SYM_LINK 2#define LOST_LINK 3/* the following definition of link status is commented by Y.Ge *///#define NBS_ASYM 1 /* uni-directional link *///#define NBS_SYM 2 /* bi-directional link *///#define NBS_MPR 3 /* neighbor has been selected as MultiPoint Relay *///#define NBS_LOST 4 /* Loosing a link */ //#define HELLOSTATUS_MAX 4 //commented by Y.Ge#define HELLOSTATUS_MAX 16 //added by Y.Ge (total HELLOSTATUS is the combination of neighbor type and link type, p31 of olsr_v11)#define NBS_PENDING 0 /* Pseudo status, used to test coming into neighbor set */voidolsr_delete_neighbor_2_pointer(struct neighbor_entry *neighbor,struct olsr_ip_addr *address);voidolsr_delete_main_neighbor_pointer (struct neighbor_entry *neighbor); //added by Y.Gestruct neighbor_2_list_entry*olsr_lookup_my_neighbors(struct neighbor_entry *neighbor,struct olsr_ip_addr *neighbor_address);voidolsr_delete_neighbor_table(struct neighbor_entry *neighbor);voidolsr_insert_neighbor_table(struct neighbor_entry *neighbor);/*struct neighbor_entry*olsr_lookup_neighbor_table(struct olsr_ip_addr *dst);*/ //commented by Y.Gestruct neighbor_entry *olsr_lookup_neighbor_table(struct olsr_ip_addr *dst, struct olsr_ip_addr *my_addr); //added by Y.Gevoidolsr_release_neighbor_table();voidolsr_time_out_two_hop_neighbors(struct neighbor_entry *neighbor);voidolsr_time_out_neighborhood_tables();voidolsr_print_neighbor_table();voidolsr_print_trace_neighbor_table(); //added by Y.Gestruct neighbor_entry*olsr_find_sym_neighbor(struct main_addr_neigh_entry *main_neighbor); //added by Y.Ge/* qos OLSR */struct neighbor_entry*olsr_find_highest_bw_neighbor(struct main_addr_neigh_entry *main_neighbor); //added by Y.Ge
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -