aodv.h

説明を見る。
00001 #ifndef AODV_H
00002 #define AODV_H
00003 #include <linux/if_ether.h>
00004 #include <linux/if.h>
00005 
00006 #define AODVPORT               654
00007 #define TRUE            1
00008 #define FALSE           0
00009 
00010 #define MAX(a,b) (((a)>(b))?(a):(b))
00011 
00012 #define ACTIVE_ROUTE_TIMEOUT   3000
00013 #define ALLOWED_HELLO_LOSS     3
00014 #define DELETE_PERIOD           MAX((ACTIVE_ROUTE_TIMEOUT),((ALLOWED_HELLO_LOSS)*(HELLO_INTERVAL)))
00015 #define HELLO_INTERVAL         1000
00016 #define MY_ROUTE_TIMEOUT       2 * (ACTIVE_ROUTE_TIMEOUT)
00017 #define NET_DIAMETER           35
00018 #define NET_TRAVERSAL_TIME 3 * NODE_TRAVERSAL_TIME * NET_DIAMETER / 2
00019 #define NEXT_HOP_WAIT          (NODE_TRAVERSAL_TIME) + 10
00020 #define NODE_TRAVERSAL_TIME    50
00021 #define PATH_TRAVERSAL_TIME  2 * NET_TRAVERSAL_TIME
00022 #define RREQ_RETRIES           2
00023 #define TTL_START              1
00024 #define TTL_INCREMENT          2
00025 #define TTL_THRESHOLD           7
00026 
00027 
00028 #define RREQ                   1
00029 #define RREP                   2
00030 #define RERR                   3
00031 
00032 
00033 #define EVENT_RREQ 1
00034 #define EVENT_RREP 2
00035 #define EVENT_RERR 3
00036 #define EVENT_RREP_ACK 4
00037 #define EVENT_REBROADCAST 5
00038 #define EVENT_HELLO 102
00039 #define EVENT_CLEANUP 101
00040 #define EVENT_NEIGHBOR 103
00041 #define FLAGS_ALL 255
00042 
00043 
00044 
00045 extern u_int8_t USE_LO;
00046 extern struct metric monitor;
00047 extern char g_block_dev[8];
00048 extern char g_aodv_dev[8];
00049 extern u_int32_t g_aodv_subnet;
00050 
00051 struct metric
00052 {
00053 u_int32_t bytes;
00054 u_int32_t packets;
00055 u_int32_t routing_packets;
00056 u_int16_t rreq; 
00057 u_int16_t rrep;
00058 u_int16_t rrer;
00059 u_int64_t last_read;
00060 };
00061 
00062 
00063 
00064 
00065 // Route table
00066 
00067 struct route_table_entry
00068 {
00069     u_int32_t dst_ip;
00070     u_int32_t dst_seq;
00071     u_int32_t old_dst_seq;
00072     u_int8_t hop_count;
00073     u_int32_t next_hop;
00074     struct precursor_entry *precursors;
00075     u_int64_t lifetime;
00076     struct net_device *dev;
00077     u_int8_t link;
00078 u_int8_t        route_valid:1;
00079 u_int8_t        route_seq_valid:1;
00080     struct route_table_entry *next;
00081     struct route_table_entry *prev;
00082     u_int32_t rreq_id;
00083 u_int8_t self_route:1;
00084 };
00085 
00086 
00087 struct precursor_entry
00088 {
00089     u_int32_t ip;
00090     struct precursor_entry *next;
00091     struct precursor_entry *prev;
00092     int ishead;
00093 };
00094 
00095 
00096 // Used to stores a list of the different interfaces
00097 
00098 struct interface_list_entry
00099 {
00100     struct net_device * dev;
00101     struct route_table_entry *route_entry;
00102     int index;
00103     u_int32_t   ip;
00104     char        name[IFNAMSIZ];
00105     struct interface_list_entry *next;
00106     struct socket *sock;
00107     u_int64_t last_hello;
00108     u_int64_t last_broadcast;
00109 };
00110 
00111 struct neighbor_list_entry
00112 {
00113     u_int32_t   ip;
00114     u_int64_t   lifetime;
00115 
00116     unsigned char hw_addr[ETH_ALEN];
00117     struct net_device *dev;
00118     struct route_table_entry *route_entry;
00119     u_int8_t link;
00120     struct neighbor_list_entry *next;
00121 
00122 };
00123 
00124 struct flood_id_queue_entry
00125 {
00126     u_int32_t          src_ip;
00127   u_int32_t dst_ip;
00128     u_int32_t          flood_id;
00129     u_int64_t          lifetime;
00130     struct flood_id_queue_entry *next;
00131 };
00132 
00133 //Used to queue events which Aodv Thread has to act on
00134 
00135 struct event_queue_entry
00136 {
00137 
00138     u_int32_t dst_ip;
00139     u_int32_t src_ip;
00140     struct net_device    *dev;
00141     int       type;
00142     unsigned int       size;
00143     int         id;
00144     u_int8_t    ttl;
00145     void        *data;
00146     u_int64_t time;
00147     unsigned char src_hw_addr[ETH_ALEN];
00148     struct event_queue_entry *next;
00149     struct event_queue_entry *prev;
00150 
00151 };
00152 
00153 struct rebroadcast_queue_entry
00154 {
00155 
00156     u_int32_t dst_ip;
00157     unsigned int       size;
00158     u_int8_t    ttl;
00159     void        *data;
00160     u_int64_t time;
00161     struct rebroadcast_queue_entry *next;
00162     struct rebroadcast_queue_entry *prev;
00163 
00164 };
00165 
00166 struct timer_queue_entry
00167 {
00168     u_int64_t tv;  /* Time the event should happend in ms since 1 jan 1970 */
00169 
00170     int size;
00171     u_int32_t id;  /* An id used to match one or a group of entrys */
00172     u_int8_t ttl;
00173     u_int16_t   retries;
00174     unsigned char flags;  /* Flag which represents what's in the dataportion */
00175     struct timer_queue_entry *next;  /* A pointer to the next entry in the list */
00176     void *data;    /* Data stored in the entry */
00177 };
00178 
00179 
00180 
00181 
00182 //Route reply message type
00183 struct rrep_ack
00184 {
00185     u_int8_t type;
00186     u_int8_t reserved;
00187 };
00188 
00189 struct rrep
00190 {
00191     u_int8_t     type;
00192 
00193 #if defined(__BIG_ENDIAN_BITFIELD)
00194 unsigned int r:1;
00195 unsigned int a:1;
00196 unsigned int reserved1:6;
00197 unsigned int reserved2:3;
00198 unsigned int prefix_sz:5;
00199 #elif defined(__LITTLE_ENDIAN_BITFIELD)
00200 unsigned int reserved1:6;
00201 unsigned int r:1;
00202 unsigned int a:1;
00203 unsigned int prefix_sz:5;
00204 unsigned int reserved2:3;
00205 #else
00206 #error "Please fix <asm/byteorder.h>"
00207 #endif
00208 
00209     u_int8_t     hop_count;
00210     u_int32_t    dst_ip;
00211     u_int32_t    dst_seq;
00212     u_int32_t    src_ip;
00213     u_int32_t    lifetime;
00214 };
00215 
00216 
00217 //Endian handling based on DSR implemetation by Alex Song s369677@student.uq.edu.au
00218 
00219 struct rreq
00220 {
00221     u_int8_t     type;
00222 
00223 #if defined(__BIG_ENDIAN_BITFIELD)
00224 u_int8_t  j:1;
00225 u_int8_t  r:1;
00226 u_int8_t  g:1;
00227 u_int8_t  d:1;
00228 u_int8_t  u:1;
00229 u_int8_t  reserved:3;
00230 #elif defined(__LITTLE_ENDIAN_BITFIELD)
00231 u_int8_t  reserved:3;
00232 u_int8_t  u:1;
00233 u_int8_t  d:1;
00234 u_int8_t  g:1;
00235 u_int8_t  r:1;
00236 u_int8_t  j:1;
00237 #else
00238 #error "Please fix <asm/byteorder.h>"
00239 #endif
00240 
00241 
00242 
00243     u_int8_t second_reserved;
00244     u_int8_t     hop_count;
00245     u_int32_t    rreq_id;
00246     u_int32_t    dst_ip;
00247     u_int32_t    dst_seq;
00248     u_int32_t    src_ip;
00249     u_int32_t    src_seq;
00250 };
00251 
00252 
00253 
00254 // An unreacable destination, contained in an RERR
00255 
00256 struct rerr_unr_dst
00257 {
00258     u_int32_t unr_dst_ip;
00259     u_int32_t unr_dst_seq;
00260     struct rerr_unr_dst *next;
00261 };
00262 
00263 
00264 
00265 struct rerrhdr
00266 {
00267     u_int8_t type;
00268 
00269     unsigned int dst_count;
00270     struct rerr_unr_dst *unr_dst;
00271 };
00272 
00273 struct rerr
00274 {
00275     u_int8_t type;
00276 
00277 #if defined(__BIG_ENDIAN_BITFIELD)
00278 unsigned int n:1;
00279 unsigned int reserved:15;
00280 #elif defined(__LITTLE_ENDIAN_BITFIELD)
00281 unsigned int reserved:15;
00282 unsigned int n:1;
00283 #else
00284 #error "Please fix <asm/byteorder.h>"
00285 #endif
00286 unsigned int dst_count:8;
00287 };
00288 
00289 struct rerrdst
00290 {
00291     u_int32_t unr_dst_ip;
00292     u_int32_t unr_dst_seq;
00293 };
00294 
00295 
00296 
00297 
00298 #endif
00299 
00300 
00301 
00302 
00303 
00304 
00305 
00306 
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 
00315 
00316 
00317 
00318 
00319 
00320 
00321 
00322 
00323 
00324 
00325 
00326 
00327 
00328 
00329 
00330 
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 
00374 
00375 
00376 
00377 
00378 
00379 
00380 
00381 
00382 

kernel_aodvmに対してThu Nov 10 18:53:11 2005に生成されました。  doxygen 1.4.5