This source file includes following definitions.
- net16
- net32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #ifndef _TCP_IP_H
35 #define _TCP_IP_H
36
37 #include "dev.h"
38 #include <linux/sock_ioctl.h>
39
40 #include <netinet/in.h>
41
42 struct rtable
43 {
44 unsigned long net;
45 unsigned long router;
46 struct device *dev;
47 struct rtable *next;
48 };
49
50 struct route
51 {
52 char route_size;
53 char pointer;
54 unsigned long route[MAX_ROUTE];
55 };
56
57 struct timestamp
58 {
59 unsigned char len;
60 unsigned char ptr;
61 union
62 {
63 unsigned char flags:4, overflow:4;
64 unsigned char full_char;
65 } x;
66 unsigned long data[9];
67 };
68
69 struct options
70 {
71 struct route record_route;
72 struct route loose_route;
73 struct route strict_route;
74 struct timestamp tstamp;
75 unsigned short security;
76 unsigned short compartment;
77 unsigned short handling;
78 unsigned short stream;
79 unsigned tcc;
80 };
81
82
83
84 struct ip_header
85 {
86 unsigned char ihl:4, version:4;
87 unsigned char tos;
88 unsigned short tot_len;
89 unsigned short id;
90 unsigned short frag_off;
91 unsigned char ttl;
92 unsigned char protocol;
93 unsigned short check;
94 unsigned long saddr;
95 unsigned long daddr;
96
97 };
98
99
100 #define IPOPT_END 0
101 #define IPOPT_NOOP 1
102 #define IPOPT_SEC 130
103 #define IPOPT_LSRR 131
104 #define IPOPT_SSRR 137
105 #define IPOPT_RR 7
106 #define IPOPT_SID 136
107 #define IPOPT_TIMESTAMP 68
108 #define IP_LOOPBACK_ADDR 0x0100007f
109
110 static inline unsigned short
111 net16(unsigned short x)
112 {
113 __asm__("xchgb %%cl,%%ch": "=c" (x) : "0" (x) : "cx");
114 return (x);
115 }
116
117 static inline unsigned long
118 net32(unsigned long x)
119 {
120 __asm__("xchgb %%cl,%%ch\n"
121 "\t roll $16,%%ecx\n"
122 "\t xchgb %%cl,%%ch":"=c" (x):"0"(x):"cx");
123 return (x);
124 }
125
126
127 #define MAX_IP_PROTOS 32
128
129
130 struct ip_protocol
131 {
132 int (*handler) (struct sk_buff *skb, struct device *dev,
133 struct options *opt, unsigned long daddr,
134 unsigned short len, unsigned long saddr,
135 int redo, struct ip_protocol *protocol);
136 void (*err_handler) (int err, unsigned char *buff, unsigned long daddr,
137 unsigned long saddr, struct ip_protocol *ipprot);
138 struct ip_protocol *next;
139 unsigned char protocol;
140 unsigned char copy:1;
141 void *data;
142 };
143
144 extern struct ip_protocol *ip_protocol_base;
145 extern struct ip_protocol *ip_protos[MAX_IP_PROTOS];
146
147 #define MAX_IP_ADDRES 5
148 extern unsigned long ip_addr[MAX_IP_ADDRES];
149 #define MY_IP_ADDR ip_addr[0];
150 int my_ip_addr(unsigned long);
151
152 #include "eth.h"
153
154 void
155 print_iph (struct ip_header *);
156
157 void
158 print_eth (struct enet_header *);
159
160 int ip_set_dev (struct ip_config *);
161
162 int ip_build_header(struct sk_buff *skb, unsigned long saddr,
163 unsigned long daddr, struct device **dev, int type,
164 struct options *opt, int len);
165 void ip_queue_xmit (volatile struct sock *sk, struct device *dev,
166 struct sk_buff *skb, int free);
167 void ip_retransmit(volatile struct sock *sk, int all);
168 int ip_rcv(struct sk_buff *buff, struct device *dev, struct packet_type *);
169 void add_ip_protocol (struct ip_protocol *);
170 int delete_ip_protocol (struct ip_protocol *);
171 int ip_handoff (volatile struct sock *sk);
172 unsigned short ip_compute_csum (unsigned char *buff, int len);
173 int ip_addr_match (unsigned long, unsigned long);
174 void add_route (struct rtable *rt);
175 void ip_route_check (unsigned long daddr);
176
177 #endif
178
179
180
181
182
183