Linux学习之网络报文sk_buff结构
时间:2010-07-29 来源:hunaiquan
一、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
示图

void skb_reserve(struct sk_buff *skb, unsigned int len);
描述 adjust headroom 示图
unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
描述 add data to the start of a buffer 示图
unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
描述 remove data from the start of a buffer 示图
unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
描述 add data to a buffer 示图
void skb_trim(struct sk_buff *skb, unsigned int len);
描述 remove end from a buffer 示图
__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
示图

void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
描述 queue a buffer at the list head 示图
void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
描述 queue a buffer at the list ta示图

struct sk_buff *skb_dequeue(struct sk_buff_head *list);
描述 remove from the head of the queue 示图
struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
描述 remove from the tail of the queue 示图
void skb_insert(struct sk_buff *old, struct sk_buff *newsk);
描述 insert a buffer 示图
void skb_append(struct sk_buff *old, struct sk_buff *newsk);
描述 append a buffer 示图