📄 olsr.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: olsr.h,v 1.2 2000/12/06 10:36:11 prima Exp $ *//* * Routing Table Management Daemon */#ifndef _PROTOCOLS_OLSRD_H#define _PROTOCOLS_OLSRD_H 1#include <sys/socket.h>/*CRC HNA add----------------------------------------------------*/#include <sys/types.h> /*fork() and wait() system call*/#include <sys/wait.h> /*fork() and wait() system call*//*--------------------------------------------------------------*//* * Optimized Link State Routing Protocol *//* * Hello packet informations */struct hellinfo { //olsr_u8_t link_type; /* link type */ /* commented by Y.Ge */ olsr_u8_t link_code; /* added by Y.Ge */ olsr_u8_t res[1]; /* padding */ olsr_u16_t link_msg_size; /* link message size, added by Y.Ge */ //olsr_u16_t next_linktype; /* offset to the next link type */ /*commented by Y.Ge */ struct olsr_ip_addr neigh_addr[1]; /* neighbor address (variable length)*/};struct hellomsg { olsr_u16_t hell_resvd [1]; /* reserved, added by Y.Ge */ olsr_u8_t hell_htime; /* Htime, added by Y.Ge */ olsr_u8_t hell_willingness; /* willingness to participate, added by Y.Ge */ /*olsr_u16_t hell_seqnum;*/ /* msg sequence number */ /* commented by Y.Ge */ /*olsr_u16_t hell_mprseqnum;*/ /* mpr sequence number */ /* commented by Y.Ge */ struct hellinfo hell_info[1]; /* variable length... */}; /* * Topology Control packet informations */struct tcmsg { /*olsr_u16_t tc_seqnum;*/ /* msg sequence number */ /* commented by Y.Ge */ olsr_u16_t tc_mprseqnum; /* mprs sequence number */ /*olsr_u8_t tc_hopcnt;*/ /* maximum number of hops */ /* commented by Y.Ge */ /*olsr_u8_t tc_res[3]; */ /* pad to 32-bit boundary */ /* commented by Y.Ge */ olsr_u8_t tc_res[2]; /* padding, added by Y.Ge */ /*struct olsr_ip_addr tc_origaddr;*/ /* originator address */ /* commented by Y.Ge */ struct olsr_ip_addr tc_mprsaddr[1]; /* mprs address (variable length)*/};/*************************** added by Y.Ge **********************//* * Multiple Interface Declaration (MID) */struct midmsg { struct olsr_ip_addr mid_ifaceaddr[1]; /*olsr interface address (variable length) */};/* * QoS information */ struct qoshellomsg { olsr_u32_t hell_busy[1]; /* busy time of the hello sender */ }; struct qostcmsg{ olsr_u16_t qostc_mprseqnum; /* mprs sequence number, must be the same as the related tcmsg */ olsr_u8_t qostc_res[2]; /* padding */ olsr_u32_t qostc_originator_busy; /* busy time of the TC originator */ olsr_u32_t tc_mpr_busy[1]; /* mpr selector's busy time */ };/************************** end of revision *******************//* * ROUTE_REQUEST response packet informations */struct rtmsg { olsr_u8_t rt_hopcnt; /* number of hops to destination */ olsr_u8_t rt_res[3]; /* pad to 32-bit boundary */ struct olsr_ip_addr rt_destaddr; /* destination address */ struct olsr_ip_addr rt_nextaddr; /* next hop address */};//CRC add for HNA/*-----------------------------------------------------------------------------*//* * Host and Network Association packet informations */struct hnaaddr{ struct olsr_ip_addr addr; olsr_u16_t prefix; olsr_u8_t res[2];};struct hnamsg { /*olsr_u16_t hna_seqnum; // msg sequence number olsr_u16_t hna_msgseqnum; // the sequence number of attached network olsr_u8_t hna_hopcnt; // maximum number of hops olsr_u8_t hna_res[3]; // pad to 32-bit boundary struct olsr_ip_addr hna_origaddr; // originator address */ //commented by Y.Ge struct hnaaddr hna_netaddr[1]; /* network address */};/*-------------------------------------------------------------------------------*//* * OLSR packet */struct olsrmsg { olsr_u8_t olsr_msgtype; /* msg type */ olsr_u8_t olsr_vtime; /* added by Y.Ge, the Vtime */ /*olsr_u8_t olsr_broad;*/ /* msg to broadcast? */ /* commentedd by Y.Ge */ /*olsr_u16_t olsr_nextmsg;*//* next link msg */ /* commented by Y.Ge */ olsr_u16_t olsr_msgsize; /* added by Y.Ge , Messagge Size */ struct olsr_ip_addr olsr_source; /* originator address, new added by CRC - it shold be main address*/ olsr_u8_t olsr_ttl; /* added by Y.Ge, time to live */ olsr_u8_t olsr_hopcount; /* added by Y.Ge, hop count */ olsr_u16_t olsr_msgseq; /* added by Y.Ge, message sequence number*/ union { struct hellomsg un_hello[1]; /* variable length... */ struct tcmsg un_tc[1]; /* variable length... */ //added by Y.Ge, MID struct midmsg un_mid[1]; /* variable length... */ //added by Y.Ge, qos OLSR struct qoshellomsg un_qoshello[1]; struct qostcmsg un_qostc[1]; //CRC add for HNA struct hnamsg un_hna[1]; /* variable length, only need 1*/ struct rtmsg un_rt[1]; /* response to ROUTE_REQUEST */ char un_tracefile[1];/* trace file for trace fonctioonalities */ } olsrun; #define olsr_hello olsrun.un_hello #define olsr_tc olsrun.un_tc /******** added by Y.Ge ********/ #define olsr_mid olsrun.un_mid #define olsr_qos_hello olsrun.un_qoshello #define olsr_qos_tc olsrun.un_qostc /********* end of revision *****/ //CRC HNA add #define olsr_hna olsrun.un_hna #define olsr_rt olsrun.un_rt #define olsr_tracefile olsrun.un_tracefile};struct olsr { olsr_u16_t olsr_packlen; /* packet length */ olsr_u16_t olsr_seqnum; /* added by Y.Ge, the packet sequence number */ /*olsr_u8_t olsr_res[2];*/ /* pad to 32-bit boundary */ /* commented by Y.Ge */ struct olsrmsg olsr_msg[1];}; //CRC HNA add struct gateway{ struct olsr_ip_addr gw_addr; struct timeval gw_timer;};struct olsr_msg_seq{ short hello_seqnum; short tc_seqnum; short mid_seqnum; short hna_seqnum; short rt_seqnum;};/* * Message types. */ /* the numbers are revised by Y.Ge to be consistant with OLSR_V11 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -