Linux网络技术内幕(一)--关键数据结构介绍

本文介绍了Linux网络编程中关键的数据结构SK_BUFF,详细解析了其包括布局字段、通用信息字段、特性相关字段在内的各个部分,以及与之相关的管理功能函数。结构中涉及的关键字段如sk_buff链表、sock指针、len和data_len等,对于理解Linux网络数据处理至关重要。
摘要由CSDN通过智能技术生成

从今天起,开始把我所熟悉的只是点点滴滴整理起来。。。。。。。。。。。。。


1 SK_BUFF 数据结构

struct sk_buff {
/* These two members must be first. */
struct sk_buff *next;
struct sk_buff *prev;


struct sock *sk;
struct skb_timeval tstamp;
struct net_device *dev;
struct net_device *input_dev;


union {
struct tcphdr *th;
struct udphdr *uh;
struct icmphdr *icmph;
struct igmphdr *igmph;
struct iphdr *ipiph;
struct ipv6hdr *ipv6h;
unsigned char *raw;
} h;


union {
struct iphdr *iph;
struct ipv6hdr *ipv6h;
struct arphdr *arph;
unsigned char *raw;
} nh;


union {
  unsigned char *raw;
} mac;


struct  dst_entry *dst;
struct sec_path *sp;


/*
* This is the control buffer. It is free to use for every
* layer. Please put your private variables there. If you
* want to keep them across layers you have to do a skb_clone()
* first. This is owned by whoever has the skb queued ATM.
*/
char cb[48];


unsigned int len,
data_len,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值