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