⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skbuff.h

📁 An implementation of the TCP/IP protocol suite for the LINUX operating system. INET is implemented u
💻 H
字号:
  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   struct iphdr          *ip_hdr;                /* For IPPROTO_RAW */
 64   unsigned long                 mem_len;
 65   unsigned long                 len;
 66   unsigned long                 fraglen;
 67   struct sk_buff                *fraglist;      /* Fragment list */
 68   unsigned long                 truesize;
 69   unsigned long                 saddr;
 70   unsigned long                 daddr;
 71   int                           magic;
 72   volatile char                 acked,
 73                                 used,
 74                                 free,
 75                                 arp;
 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   unsigned long                 padding[0];
 79   unsigned char                 data[0];
 80 };
 81 
 82 #define SK_WMEM_MAX     8192
 83 #define SK_RMEM_MAX     32767
 84 
 85 #define SK_FREED_SKB    0x0DE2C0DE
 86 #define SK_GOOD_SKB     0xDEC0DED1
 87 
 88 extern void                     print_skb(struct sk_buff *);
 89 extern void                     kfree_skb(struct sk_buff *skb, int rw);
 90 extern void                     skb_queue_head(struct sk_buff * volatile *list,struct sk_buff *buf);
 91 extern void                     skb_queue_tail(struct sk_buff * volatile *list,struct sk_buff *buf);
 92 extern struct sk_buff *         skb_dequeue(struct sk_buff * volatile *list);
 93 extern void                     skb_insert(struct sk_buff *old,struct sk_buff *newsk);
 94 extern void                     skb_append(struct sk_buff *old,struct sk_buff *newsk);
 95 extern void                     skb_unlink(struct sk_buff *buf);
 96 extern void                     skb_new_list_head(struct sk_buff *volatile* list);
 97 extern struct sk_buff *         skb_peek(struct sk_buff * volatile *list);
 98 extern struct sk_buff *         skb_peek_copy(struct sk_buff * volatile *list);
 99 extern struct sk_buff *         alloc_skb(unsigned int size, int priority);
100 extern void                     kfree_skbmem(void *mem, unsigned size);
101 extern void                     skb_kept_by_device(struct sk_buff *skb);
102 extern void                     skb_device_release(struct sk_buff *skb, int mode);
103 extern int                      skb_device_locked(struct sk_buff *skb);
104 extern void                     skb_check(struct sk_buff *skb,int, char *);
105 #define IS_SKB(skb)     skb_check((skb),__LINE__,__FILE__)
106 
107 extern struct sk_buff *         skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
108 extern int                      datagram_select(struct sock *sk, int sel_type, select_table *wait);
109 extern void                     skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
110 extern void                     skb_free_datagram(struct sk_buff *skb);
111 #endif  /* _SKBUFF_H */
112 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -