OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / sendip / ipv4.h
1 /* ip.h
2  */
3 #ifndef _SENDIP_IP_H
4 #define _SENDIP_IP_H
5
6 /* IP HEADER
7  * Taken from glibc 2.2, and modified
8  */
9 typedef struct {
10 #if __BYTE_ORDER == __LITTLE_ENDIAN
11         unsigned int header_len:4;
12         unsigned int version:4;
13 #elif __BYTE_ORDER == __BIG_ENDIAN
14         unsigned int version:4;
15         unsigned int header_len:4;
16 #else
17 #  error "Please fix <bits/endian.h>"
18 #endif
19         u_int8_t tos;
20         u_int16_t tot_len;
21         u_int16_t id;
22 #if __BYTE_ORDER == __LITTLE_ENDIAN
23         u_int16_t frag_off1:5;
24         u_int16_t mf:1;
25         u_int16_t df:1;
26         u_int16_t res:1;
27         u_int16_t frag_off2:8;
28 #define IP_SET_FRAGOFF(ip,v) {(ip)->frag_off1=((v)&0x1F00)>>8;(ip)->frag_off2=(v)&0x00FF;}
29 #elif __BYTE_ORDER == __BIG_ENDIAN
30         u_int16_t res:1;
31         u_int16_t df:1;
32         u_int16_t mf:1;
33         u_int16_t frag_off:13;
34 #define IP_SET_FRAGOFF(ip,v) (ip)->frag_off=(v)
35 #else
36 #  error "Please fix <bits/endian.h>"
37 #endif
38         u_int8_t ttl;
39         u_int8_t protocol;
40         u_int16_t check;
41         u_int32_t saddr;
42         u_int32_t daddr;
43 } ip_header;
44
45 /* Defines for which parts have been modified
46  */
47 #define IP_MOD_HEADERLEN  (1)
48 #define IP_MOD_VERSION    (1<<1)
49 #define IP_MOD_TOS        (1<<2)
50 #define IP_MOD_TOTLEN     (1<<3)
51 #define IP_MOD_ID         (1<<4)
52 #define IP_MOD_RES        (1<<5)
53 #define IP_MOD_DF         (1<<6)
54 #define IP_MOD_MF         (1<<7)
55 #define IP_MOD_FRAGOFF    (1<<8)
56 #define IP_MOD_TTL        (1<<9)
57 #define IP_MOD_PROTOCOL   (1<<10)
58 #define IP_MOD_CHECK      (1<<11)
59 #define IP_MOD_SADDR      (1<<12)
60 #define IP_MOD_DADDR      (1<<13)
61
62 /* Options
63  */
64 sendip_option ip_opts[] = {
65         {"s",1,"Source IP address (see README)","127.0.0.1"},
66         {"d",1,"Desitnation IP address","Correct"},
67         {"h",1,"IP header length (see README)","Correct"},
68         {"v",1,"IP version (you almost definately don't want to change this)","4"},
69         {"y",1,"IP type of service","0"},
70         {"l",1,"Total IP packet length (see README)","Correct"},
71         {"i",1,"IP packet ID (see README)","Random"},
72         {"fr",1,"IP reservced flag (see README)","0 (options are 0,1,r)"},
73         {"fd",1,"IP don't fragment flag (see README)","0 (options are 0,1,r)"},
74         {"fm",1,"IP more fragments flag (see README)","0 (options are 0,1,r)"},
75         {"f",1,"IP fragment offset","0"},
76         {"t",1,"IP time to live","255"},
77         {"p",1,"IP protcol","0, or set by underlying protocol"},
78         {"c",1,"IP checksum (see README)","Correct"},
79
80         {"onum",1,"IP option as string of hex bytes (length is always correct)","(no options)"},
81         {"oeol",0,"IP option: end of list",NULL},
82         {"onop",0,"IP option: no-op",NULL},
83         {"orr",1,"IP option: record route. Format: pointer:addr1:addr2:...",NULL},
84         {"ots",1,"IP option: timestamp. Format: pointer:overflow:flag:(ip1:)ts1:(ip2:)ts2:...",NULL},
85         {"olsr",1,"IP option: loose source route. Format: pointer:addr1:addr2:...",NULL},
86         {"osid",1,"IP option: stream identifier",NULL},
87         {"ossr",1,"IP option: strict source route. Format: pointer:addr1:addr2:...",NULL}
88 };
89
90 #endif  /* _SENDIP_IP_H */