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