root/net/inet/skbuff.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * INET         An implementation of the TCP/IP protocol suite for the LINUX
   3  *              operating system.  INET is implemented using the  BSD Socket
   4  *              interface as the means of communication with the user level.
   5  *
   6  *              Definitions for the 'struct sk_buff' memory handlers.
   7  *
   8  * Version:     @(#)skbuff.h    1.0.4   05/20/93
   9  *
  10  * Authors:     Ross Biro, <bir7@leland.Stanford.Edu>
  11  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  12  *              Corey Minyard <wf-rch!minyard@relay.EU.net>
  13  *
  14  * Fixes:
  15  *              Alan Cox                :       Volatiles (this makes me unhappy - we want proper asm linked list stuff)
  16  *              Alan Cox                :       Declaration for new primitives
  17  *              Alan Cox                :       Fraglist support (idea by Donald Becker)
  18  *              Alan Cox                :       'users' counter. Combines with datagram changes to avoid skb_peek_copy
  19  *                                              being used.
  20  *
  21  *              This program is free software; you can redistribute it and/or
  22  *              modify it under the terms of the GNU General Public License
  23  *              as published by the Free Software Foundation; either version
  24  *              2 of the License, or (at your option) any later version.
  25  */
  26 #ifndef _SKBUFF_H
  27 #define _SKBUFF_H
  28 #include <linux/malloc.h>
  29 
  30 #ifdef CONFIG_IPX
  31 #include "ipx.h"
  32 #endif
  33 
  34 #define HAVE_ALLOC_SKB          /* For the drivers to know */
  35 
  36 
  37 #define FREE_READ       1
  38 #define FREE_WRITE      0
  39 
  40 
  41 struct sk_buff {
  42   unsigned long                 magic_debug_cookie;
  43   struct sk_buff                *volatile next;
  44   struct sk_buff                *volatile prev;
  45   struct sk_buff                *volatile link3;
  46   struct sk_buff                *volatile* list;
  47   struct sock                   *sk;
  48   volatile unsigned long        when;   /* used to compute rtt's        */
  49   struct device                 *dev;
  50   void                          *mem_addr;
  51   union {
  52         struct tcphdr   *th;
  53         struct ethhdr   *eth;
  54         struct iphdr    *iph;
  55         struct udphdr   *uh;
  56         struct arphdr   *arp;
  57         unsigned char   *raw;
  58         unsigned long   seq;
  59 #ifdef CONFIG_IPX       
  60         ipx_packet      *ipx;
  61 #endif  
  62   } h;
  63   unsigned long                 mem_len;
  64   unsigned long                 len;
  65   unsigned long                 fraglen;
  66   struct sk_buff                *fraglist;      /* Fragment list */
  67   unsigned long                 truesize;
  68   unsigned long                 saddr;
  69   unsigned long                 daddr;
  70   int                           magic;
  71   volatile char                 acked,
  72                                 used,
  73                                 free,
  74                                 arp,
  75                                 urg_used;
  76   unsigned char                 tries,lock;     /* Lock is now unused */
  77   unsigned short                users;          /* User count - see datagram.c (and soon seqpacket.c/stream.c) */
  78 };
  79 
  80 #define SK_WMEM_MAX     8192
  81 #define SK_RMEM_MAX     32767
  82 
  83 #define SK_FREED_SKB    0x0DE2C0DE
  84 #define SK_GOOD_SKB     0xDEC0DED1
  85 
  86 extern void                     print_skb(struct sk_buff *);
  87 extern void                     kfree_skb(struct sk_buff *skb, int rw);
  88 extern void                     skb_queue_head(struct sk_buff * volatile *list,struct sk_buff *buf);
  89 extern void                     skb_queue_tail(struct sk_buff * volatile *list,struct sk_buff *buf);
  90 extern struct sk_buff *         skb_dequeue(struct sk_buff * volatile *list);
  91 extern void                     skb_insert(struct sk_buff *old,struct sk_buff *newsk);
  92 extern void                     skb_append(struct sk_buff *old,struct sk_buff *newsk);
  93 extern void                     skb_unlink(struct sk_buff *buf);
  94 extern void                     skb_new_list_head(struct sk_buff *volatile* list);
  95 extern struct sk_buff *         skb_peek(struct sk_buff * volatile *list);
  96 extern struct sk_buff *         skb_peek_copy(struct sk_buff * volatile *list);
  97 extern struct sk_buff *         alloc_skb(unsigned int size, int priority);
  98 extern void                     kfree_skbmem(void *mem, unsigned size);
  99 
 100 extern void                     skb_check(struct sk_buff *skb,int, char *);
 101 #define IS_SKB(skb)     skb_check((skb),__LINE__,__FILE__)
 102 
 103 extern struct sk_buff *         skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
 104 extern int                      datagram_select(struct sock *sk, int sel_type, select_table *wait);
 105 extern void                     skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
 106 extern void                     skb_free_datagram(struct sk_buff *skb);
 107 #endif  /* _SKBUFF_H */

/* [previous][next][first][last][top][bottom][index][help] */