http://blog.chinaunix.net/u3/115276/showart_2284947.html

一、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结构 - 锕扬 - 锕扬的博客

 

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 horace papa 的頭像
    horace papa

    Horace papa's life

    horace papa 發表在 痞客邦 留言(1) 人氣()