skbuff详解.docx
《skbuff详解.docx》由会员分享,可在线阅读,更多相关《skbuff详解.docx(13页珍藏版)》请在冰豆网上搜索。
skbuff详解
sk_buff数据结构图
一。
skbuff的结构图如下
二.Basicfunctionsforsk_buff
skb_headroom(),skb_tailroom()
Prototype/Description
intskb_headroom(conststructsk_buff*skb);
bytesatbufferhead
intskb_tailroom(conststructsk_buff*skb);
bytesatbuffer
Image
skb_reserve()
Prototype
voidskb_reserve(structsk_buff*skb,unsignedintlen);
Description
adjustheadroom
Image
skb_push()
Prototype
unsignedchar*skb_push(structsk_buff*skb,unsignedintlen);
Description
adddatatothestartofabuffer
Image
skb_pull()
Prototype
unsignedchar*skb_pull(structsk_buff*skb,unsignedintlen);
Description
removedatafromthestartofabuffer
Image
skb_put()
Prototype
unsignedchar*skb_put(structsk_buff*skb,unsignedintlen);
Description
adddatatoabuffer
Image
skb_trim()
Prototype
voidskb_trim(structsk_buff*skb,unsignedintlen);
Description
removeendfromabuffer
Image
三.Listofsk_buff
Prototype/Description
__u32skb_queue_len(conststructsk_buff_head*list_);
getqueuelength
structsk_buff*skb_peek(structsk_buff_head*list);
getpointertotheheadelement
structsk_buff*skb_peek_tail(structsk_buff_head*list);
getpointertothetailelement
Image
skb_queue_head()
Prototype
voidskb_queue_head(structsk_buff_head*list,structsk_buff*newsk);
Description
queueabufferatthelisthead
Image
skb_queue_tail()
Prototype
voidskb_queue_tail(structsk_buff_head*list,structsk_buff*newsk);
Description
queueabufferatthelistta
Image
skb_dequeue()
Prototype
structsk_buff*skb_dequeue(structsk_buff_head*list);
Description
removefromtheheadofthequeue
Image
skb_dequeue_tail()
Prototype
structsk_buff*skb_dequeue_tail(structsk_buff_head*list);
Description
removefromthetailofthequeue
Image
skb_insert()
Prototype
voidskb_insert(structsk_buff*old,structsk_buff*newsk);
Description
insertabuffer
Image
skb_append()
Prototype
voidskb_append(structsk_buff*old,structsk_buff*newsk);
Description
appendabuffer
Image
skb_unlink()
Prototype
voidskb_unlink(structsk_buff*skb); Description
removeabufferfromalist
Image