Chinaunix首页 | 论坛 | 博客
  • 博客访问: 713741
  • 博文数量: 104
  • 博客积分: 4320
  • 博客等级: 上校
  • 技术积分: 1948
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-30 14:42
文章分类

全部博文(104)

文章存档

2012年(4)

2011年(65)

2010年(35)

分类: LINUX

2010-07-29 16:20:34

一、sk_buff的结构图如下

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客 

二.sk_buff结构基本操作

     1、skb_headroom(), skb_tailroom() 

    原型/描述

int skb_headroom(const struct sk_buff *skb);

   bytes at buffer head

int skb_tailroom(const struct sk_buff *skb);

  bytes at buffer

     示图

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
2、skb_reserve()
原型 

void skb_reserve(struct sk_buff *skb, unsigned int len);

描述 
       adjust headroom
示图 
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
3、skb_push()
原型

unsigned char *skb_push(struct sk_buff *skb, unsigned int len);

描述 
add data to the start of a buffer
示图
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
4、skb_pull()
原型 

unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);

描述 
remove data from the start of a buffer
示图 
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
5、skb_put()
原型

unsigned char *skb_put(struct sk_buff *skb, unsigned int len);

描述 
add data to a buffer
示图 
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
6、skb_trim()
原型 

void skb_trim(struct sk_buff *skb, unsigned int len);

描述 
remove end from a buffer
示图
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
三.sk_buff 链表 
    1、skb_queue_len, skb_peek, skb_peek_tail
          原型 / 描述

__u32 skb_queue_len(const struct sk_buff_head *list_);

                      get queue length

struct sk_buff *skb_peek(struct sk_buff_head *list);

                      get pointer to the head element

struct sk_buff *skb_peek_tail(struct sk_buff_head *list);

                      get pointer to the tail element

   示图 

 Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
2、skb_queue_head()
   原型    

   void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);   

  描述
          queue a buffer at the list head
  示图
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
3、skb_queue_tail()
      原型     

     void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);

      描述
queue a buffer at the list ta

         示图

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
4、skb_dequeue()
原型

struct sk_buff *skb_dequeue(struct sk_buff_head *list);

描述
remove from the head of the queue
示图

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客

 
5、skb_dequeue_tail()
原型

struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);

描述
remove from the tail of the queue
示图
Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客
 
6、skb_insert()
原型 

void skb_insert(struct sk_buff *old, struct sk_buff *newsk);

描述
insert a buffer
示图 

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客

7、skb_append()
原型 

void skb_append(struct sk_buff *old, struct sk_buff *newsk);

描述
append a buffer
示图

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客

 
8、skb_unlink()
原型
void skb_unlink(struct sk_buff *skb);
描述 
remove a buffer from a list
示图

Linux学习之网络报文sk_buff结构 - 锕扬 - 锕扬的博客

阅读(2636) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~