OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / sendip / rip.h
1 /* rip.h
2  */
3 #ifndef _SENDIP_RIP_H
4 #define _SENDIP_RIP_H
5
6 /* RIP PACKET STRUCTURES
7  */
8 typedef struct {
9         u_int8_t command;
10         u_int8_t version;
11         u_int16_t res;
12         u_int16_t addressFamily;
13         u_int16_t routeTagOrAuthenticationType;
14 } rip_header;
15
16 typedef struct {
17         u_int32_t address;
18         u_int32_t subnetMask;
19         u_int32_t nextHop;
20         u_int32_t metric;
21 } rip_options;
22
23 /* Defines for which parts have been modified
24  */
25 #define RIP_MOD_COMMAND   1
26 #define RIP_MOD_VERSION   1<<1
27 #define RIP_MOD_ADDRFAM   1<<2
28 #define RIP_MOD_ROUTETAG  1<<3
29 #define RIP_IS_AUTH       1<<4
30
31 /* Options
32  */
33 sendip_option rip_opts[] = {
34         {"v",1,"RIP version","2"},
35         {"c",1,
36          "RIP command (1=request, 2=response, 3=traceon (obsolete), 4=traceoff (obsolete), 5=poll (undocumented), 6=poll entry (undocumented)","1"},
37         {"e",1,"Add a RIP entry.  Format is: Address family:route tag:address:subnet mask:next hop:metric","2:0:0.0.0.0:255.255.255.0:0.0.0.0:16, any option my be left out to use the default"},
38         {"a",1,"RIP authenticat packet, argument is the password; do not use any other RIP options on this RIP header",NULL},
39         {"d",0,"RIP default request - get router's entire routing table; do not use any other RIP options on this RIP header",NULL}
40 };
41
42 /* Helpful macros */
43 #define RIP_NUM_ENTRIES(d) (((d)->alloc_len-sizeof(rip_header))/sizeof(rip_options))
44 #define RIP_ADD_ENTRY(d) { (d)->data = realloc((d)->data,(d)->alloc_len+sizeof(rip_options)); (d)->alloc_len+=sizeof(rip_options); }
45 #define RIP_OPTION(d) ((rip_options *)((u_int32_t *)((d)->data)+((d)->alloc_len>>2)-(sizeof(rip_options)>>2)))
46 #endif  /* _SENDIP_RIP_H */