This source file includes following definitions.
- skb_peek
- skb_queue_head_init
- skb_queue_head
- skb_queue_tail
- skb_dequeue
- skb_insert
- skb_append
- skb_unlink
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef _LINUX_SKBUFF_H
15 #define _LINUX_SKBUFF_H
16 #include <linux/malloc.h>
17 #include <linux/wait.h>
18 #include <linux/time.h>
19 #include <linux/config.h>
20
21 #undef CONFIG_SKB_CHECK
22
23 #define HAVE_ALLOC_SKB
24
25
26 #define FREE_READ 1
27 #define FREE_WRITE 0
28
29
30 struct sk_buff_head {
31 struct sk_buff * volatile next;
32 struct sk_buff * volatile prev;
33 #if CONFIG_SKB_CHECK
34 int magic_debug_cookie;
35 #endif
36 };
37
38
39 struct sk_buff {
40 struct sk_buff * volatile next;
41 struct sk_buff * volatile prev;
42 #if CONFIG_SKB_CHECK
43 int magic_debug_cookie;
44 #endif
45 struct sk_buff * volatile link3;
46 struct sock *sk;
47 volatile unsigned long when;
48 struct timeval stamp;
49 struct device *dev;
50 struct sk_buff *mem_addr;
51 union {
52 struct tcphdr *th;
53 struct ethhdr *eth;
54 struct iphdr *iph;
55 struct udphdr *uh;
56 unsigned char *raw;
57 unsigned long seq;
58 } h;
59 struct iphdr *ip_hdr;
60 unsigned long mem_len;
61 unsigned long len;
62 unsigned long fraglen;
63 struct sk_buff *fraglist;
64 unsigned long truesize;
65 unsigned long saddr;
66 unsigned long daddr;
67 unsigned long raddr;
68 volatile char acked,
69 used,
70 free,
71 arp;
72 unsigned char tries,lock,localroute,pkt_type;
73 #define PACKET_HOST 0
74 #define PACKET_BROADCAST 1
75 #define PACKET_MULTICAST 2
76 #define PACKET_OTHERHOST 3
77 unsigned short users;
78 #ifdef CONFIG_SLAVE_BALANCING
79 unsigned short in_dev_queue;
80 #endif
81 unsigned long padding[0];
82 unsigned char data[0];
83 };
84
85 #define SK_WMEM_MAX 32767
86 #define SK_RMEM_MAX 32767
87
88 #ifdef CONFIG_SKB_CHECK
89 #define SK_FREED_SKB 0x0DE2C0DE
90 #define SK_GOOD_SKB 0xDEC0DED1
91 #define SK_HEAD_SKB 0x12231298
92 #endif
93
94 #ifdef __KERNEL__
95
96
97
98
99 #include <asm/system.h>
100
101 #if 0
102 extern void print_skb(struct sk_buff *);
103 #endif
104 extern void kfree_skb(struct sk_buff *skb, int rw);
105 extern void skb_queue_head_init(struct sk_buff_head *list);
106 extern void skb_queue_head(struct sk_buff_head *list,struct sk_buff *buf);
107 extern void skb_queue_tail(struct sk_buff_head *list,struct sk_buff *buf);
108 extern struct sk_buff * skb_dequeue(struct sk_buff_head *list);
109 extern void skb_insert(struct sk_buff *old,struct sk_buff *newsk);
110 extern void skb_append(struct sk_buff *old,struct sk_buff *newsk);
111 extern void skb_unlink(struct sk_buff *buf);
112 extern struct sk_buff * skb_peek_copy(struct sk_buff_head *list);
113 extern struct sk_buff * alloc_skb(unsigned int size, int priority);
114 extern void kfree_skbmem(struct sk_buff *skb, unsigned size);
115 extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority);
116 extern void skb_device_lock(struct sk_buff *skb);
117 extern void skb_device_unlock(struct sk_buff *skb);
118 extern void dev_kfree_skb(struct sk_buff *skb, int mode);
119 extern int skb_device_locked(struct sk_buff *skb);
120
121
122
123
124
125
126 static __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_)
127 {
128 struct sk_buff *list = (struct sk_buff *)list_;
129 return (list->next != list)? list->next : NULL;
130 }
131
132 #if CONFIG_SKB_CHECK
133 extern int skb_check(struct sk_buff *skb,int,int, char *);
134 #define IS_SKB(skb) skb_check((skb), 0, __LINE__,__FILE__)
135 #define IS_SKB_HEAD(skb) skb_check((skb), 1, __LINE__,__FILE__)
136 #else
137 #define IS_SKB(skb)
138 #define IS_SKB_HEAD(skb)
139
140 extern __inline__ void skb_queue_head_init(struct sk_buff_head *list)
141 {
142 list->prev = (struct sk_buff *)list;
143 list->next = (struct sk_buff *)list;
144 }
145
146
147
148
149
150 extern __inline__ void skb_queue_head(struct sk_buff_head *list_,struct sk_buff *newsk)
151 {
152 unsigned long flags;
153 struct sk_buff *list = (struct sk_buff *)list_;
154
155 save_flags(flags);
156 cli();
157 newsk->next = list->next;
158 newsk->prev = list;
159 newsk->next->prev = newsk;
160 newsk->prev->next = newsk;
161 restore_flags(flags);
162 }
163
164
165
166
167
168 extern __inline__ void skb_queue_tail(struct sk_buff_head *list_, struct sk_buff *newsk)
169 {
170 unsigned long flags;
171 struct sk_buff *list = (struct sk_buff *)list_;
172
173 save_flags(flags);
174 cli();
175
176 newsk->next = list;
177 newsk->prev = list->prev;
178
179 newsk->next->prev = newsk;
180 newsk->prev->next = newsk;
181
182 restore_flags(flags);
183 }
184
185
186
187
188
189
190 extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list_)
191 {
192 long flags;
193 struct sk_buff *result;
194 struct sk_buff *list = (struct sk_buff *)list_;
195
196 save_flags(flags);
197 cli();
198
199 result = list->next;
200 if (result == list) {
201 restore_flags(flags);
202 return NULL;
203 }
204
205 result->next->prev = list;
206 list->next = result->next;
207
208 result->next = NULL;
209 result->prev = NULL;
210
211 restore_flags(flags);
212
213 return result;
214 }
215
216
217
218
219
220 extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk)
221 {
222 unsigned long flags;
223
224 save_flags(flags);
225 cli();
226 newsk->next = old;
227 newsk->prev = old->prev;
228 old->prev = newsk;
229 newsk->prev->next = newsk;
230
231 restore_flags(flags);
232 }
233
234
235
236
237
238 extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk)
239 {
240 unsigned long flags;
241
242 save_flags(flags);
243 cli();
244
245 newsk->prev = old;
246 newsk->next = old->next;
247 newsk->next->prev = newsk;
248 old->next = newsk;
249
250 restore_flags(flags);
251 }
252
253
254
255
256
257
258
259
260 extern __inline__ void skb_unlink(struct sk_buff *skb)
261 {
262 unsigned long flags;
263
264 save_flags(flags);
265 cli();
266
267 if(skb->prev && skb->next)
268 {
269 skb->next->prev = skb->prev;
270 skb->prev->next = skb->next;
271 skb->next = NULL;
272 skb->prev = NULL;
273 }
274 restore_flags(flags);
275 }
276
277 #endif
278
279 extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
280 extern int datagram_select(struct sock *sk, int sel_type, select_table *wait);
281 extern void skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
282 extern void skb_free_datagram(struct sk_buff *skb);
283
284 #endif
285 #endif