Rev 1618 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
629 | giacomo | 1 | #ifndef __SKBUFF__ |
2 | #define __SKBUFF__ |
||
3 | |||
4 | #include <linux/compatib.h> |
||
1621 | fabio | 5 | #include <arch/sys/cdefs.h> |
629 | giacomo | 6 | |
7 | __BEGIN_DECLS |
||
8 | |||
9 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
||
10 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ |
||
11 | |||
12 | |||
13 | #define FREE_READ 1 |
||
14 | #define FREE_WRITE 0 |
||
15 | |||
16 | #define CHECKSUM_NONE 0 |
||
17 | #define CHECKSUM_HW 1 |
||
18 | #define CHECKSUM_UNNECESSARY 2 |
||
19 | |||
20 | |||
21 | struct sk_buff_head |
||
22 | { |
||
23 | struct sk_buff * next; |
||
24 | struct sk_buff * prev; |
||
25 | __u32 qlen; /* Must be same length as a pointer |
||
26 | for using debugging */ |
||
27 | #if CONFIG_SKB_CHECK |
||
28 | int magic_debug_cookie; |
||
29 | #endif |
||
30 | }; |
||
31 | |||
32 | |||
33 | struct sk_buff |
||
34 | { |
||
35 | struct sk_buff * next; /* Next buffer in list */ |
||
36 | struct sk_buff * prev; /* Previous buffer in list */ |
||
37 | struct sk_buff_head * list; /* List we are on */ |
||
38 | #if CONFIG_SKB_CHECK |
||
39 | int magic_debug_cookie; |
||
40 | #endif |
||
41 | #if 0 |
||
42 | struct sk_buff *link3; /* Link for IP protocol level buffer chains */ |
||
43 | #endif |
||
44 | |||
45 | #if 0 |
||
46 | struct sock *sk; /* Socket we are owned by */ |
||
47 | #endif |
||
48 | struct device *dev; /* Device we arrived on/are leaving by */ |
||
49 | #ifdef NOTWORK |
||
50 | unsigned long when; /* used to compute rtt's */ |
||
51 | struct timeval stamp; /* Time we arrived */ |
||
52 | union |
||
53 | { |
||
54 | struct tcphdr *th; |
||
55 | struct ethhdr *eth; |
||
56 | struct iphdr *iph; |
||
57 | struct udphdr *uh; |
||
58 | unsigned char *raw; |
||
59 | /* for passing file handles in a unix domain socket */ |
||
60 | void *filp; |
||
61 | } h; |
||
62 | |||
63 | union |
||
64 | { |
||
65 | /* As yet incomplete physical layer views */ |
||
66 | unsigned char *raw; |
||
67 | struct ethhdr *ethernet; |
||
68 | } mac; |
||
69 | |||
70 | struct iphdr *ip_hdr; /* For IPPROTO_RAW */ |
||
71 | |||
72 | #endif /*NOTWORK*/ |
||
73 | |||
74 | char cb[48]; /* added by PJ */ |
||
75 | |||
76 | unsigned long len; /* Length of actual data */ |
||
77 | unsigned long csum; /* Checksum */ |
||
78 | #if 0 |
||
79 | __u32 saddr; /* IP source address */ |
||
80 | __u32 daddr; /* IP target address */ |
||
81 | __u32 raddr; /* IP next hop address */ |
||
82 | __u32 seq; /* TCP sequence number */ |
||
83 | __u32 end_seq; /* seq [+ fin] [+ syn] + datalen */ |
||
84 | __u32 ack_seq; /* TCP ack sequence number */ |
||
85 | unsigned char proto_priv[16]; /* Protocol private data */ |
||
86 | #endif |
||
87 | volatile char acked, /* Are we acked ? */ |
||
88 | used, /* Are we in use ? */ |
||
89 | free, /* How to free this buffer */ |
||
90 | arp; /* Has IP/ARP resolution finished */ |
||
91 | #if 0 |
||
92 | unsigned char tries, /* Times tried */ |
||
93 | lock, /* Are we locked ? */ |
||
94 | localroute, /* Local routing asserted for this frame */ |
||
95 | pkt_type, /* Packet class */ |
||
96 | pkt_bridged, /* Tracker for bridging */ |
||
97 | #endif |
||
98 | unsigned char ip_summed; /* Driver fed us an IP checksum */ |
||
99 | #if 0 |
||
100 | #define PACKET_HOST 0 /* To us */ |
||
101 | #define PACKET_BROADCAST 1 /* To all */ |
||
102 | #define PACKET_MULTICAST 2 /* To group */ |
||
103 | #define PACKET_OTHERHOST 3 /* To someone else */ |
||
104 | unsigned short users; /* User count - see datagram.c,tcp.c */ |
||
105 | #endif |
||
106 | unsigned short protocol; /* Packet protocol from driver. */ |
||
107 | unsigned int truesize; /* Buffer size */ |
||
108 | #if 0 |
||
109 | |||
110 | |||
111 | |||
112 | atomic_t count; /* reference count */ |
||
113 | |||
114 | |||
115 | struct sk_buff *data_skb; /* Link to the actual data skb */ |
||
116 | #endif |
||
117 | unsigned char *head; /* Head of buffer */ |
||
118 | unsigned char *data; /* Data head pointer */ |
||
119 | unsigned char *tail; /* Tail pointer */ |
||
120 | #if 0 |
||
121 | unsigned char *end; /* End pointer */ |
||
122 | void (*destructor)(struct sk_buff *); /* Destruct function */ |
||
123 | __u16 redirport; /* Redirect port */ |
||
124 | #endif |
||
125 | }; |
||
126 | |||
127 | #define dev_kfree_skb(a) |
||
128 | #define alloc_skb(a,b) dev_alloc_skb(a) |
||
129 | /* #define skb_device_unlock(skb); */ |
||
130 | extern struct sk_buff * dev_alloc_skb(unsigned int size); |
||
131 | extern unsigned char * skb_put(struct sk_buff *skb, int len); |
||
132 | extern void skb_queue_head_init(struct sk_buff_head *list); |
||
133 | extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority); |
||
134 | extern void skb_reserve(struct sk_buff *skb, int len); |
||
135 | |||
136 | extern __inline__ int skb_headroom(struct sk_buff *skb) |
||
137 | { |
||
138 | return skb->data-skb->head; |
||
139 | } |
||
140 | |||
141 | extern struct sk_buff * skb_realloc_headroom(struct sk_buff *skb, int newheadroom); |
||
142 | |||
143 | extern __inline__ unsigned char *skb_push(struct sk_buff *skb, |
||
144 | unsigned int len) |
||
145 | { |
||
146 | skb->data-=len; |
||
147 | skb->len+=len; |
||
148 | if(skb->data<skb->head) |
||
149 | { |
||
150 | printk(KERN_ERR "skb_push: PANIC!!!"); |
||
151 | // __label__ here; |
||
152 | // skb_under_panic(skb, len, &&here); |
||
153 | //here: ; |
||
154 | } |
||
155 | return skb->data; |
||
156 | } |
||
157 | |||
158 | extern __inline__ char *skb_pull(struct sk_buff *skb, unsigned int len) |
||
159 | { |
||
160 | skb->len-=len; |
||
161 | return skb->data+=len; |
||
162 | } |
||
163 | |||
164 | __END_DECLS |
||
165 | #endif |