分类: LINUX
2010-07-29 16:20:34
一、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
示图
- 2、skb_reserve()
- 原型
void skb_reserve(struct sk_buff *skb, unsigned int len);
- 描述
- adjust headroom
- 示图
- 3、skb_push()
- 原型
unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
- 描述
- add data to the start of a buffer
- 示图
- 4、skb_pull()
- 原型
unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
- 描述
- remove data from the start of a buffer
- 示图
- 5、skb_put()
- 原型
unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
- 描述
- add data to a buffer
- 示图
- 6、skb_trim()
- 原型
void skb_trim(struct sk_buff *skb, unsigned int len);
- 描述
- remove end from a buffer
- 示图
- 三.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
示图
- 2、skb_queue_head()
- 原型
void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
- 描述
- queue a buffer at the list head
- 示图
- 3、skb_queue_tail()
- 原型
void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
- 描述
- queue a buffer at the list ta
示图
- 4、skb_dequeue()
struct sk_buff *skb_dequeue(struct sk_buff_head *list);
struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
void skb_insert(struct sk_buff *old, struct sk_buff *newsk);
void skb_append(struct sk_buff *old, struct sk_buff *newsk);