struct sock注释
针对 struct sock 的一些注释:
struct sock {
/* Socket demultiplex comparisons on incoming packets. */
__u32 daddr; /* 外部IP地址 */
__u32 rcv_saddr; /* 绑定的本地IP地址 */
__u16 dport; /* 目标端口 */
unsigned short num; /* 本地端口 */
int bound_dev_if; /* 绑定网卡接口的索引 不为0 */
/* 用于各种协议查找表的哈希链表 */
struct sock *next;
struct sock **pprev;
struct sock *bind_next;
struct sock **bind_pprev;
volatile unsigned char state, /* 连接状态 */
zapped; /* In ax25 & ipx means not linked */
__u16 sport; /* 源端口 */
unsigned short family; /* 地址簇 */
unsigned char reuse; /* SO_REUSEADDR设置,表示地址重用 */
unsigned char shutdown; /* 半关闭标志 SEND_SHUTDOWN和RCV_SHUTDOWN掩码 */
atomic_t refcnt; /* 引用计数 */
socket_lock_t lock; /* 同步锁. */
int rcvbuf; /* 接受缓冲区长度(单位:字节) */
wait_queue_head_t *sleep; /* 等待队列,通常指向socket的wait域 */
struct dst_entry *dst_cache; /* 目的地缓存,用于路由查找结果 */
rwlock_t dst_lock; /* 目的地缓存锁*/
atomic_t rmem_alloc; /* 已接收队列字节数 */
struct sk_buff_head receive_queue; /* 接收包队列 */
atomic_t wmem_alloc; /* 已发送字节数 */
struct sk_buff_head write_queue; /* 包发送队列 */
atomic_t omem_alloc; /* "o"是"option"(选项)或"other"(其它)的意思 */
int wmem_queued; /* 稳定的队列长度 */
int forward_alloc; /* 提前分配的空间 */
__u32 saddr; /* 发送源地址 */
unsigned int allocation; /* 分配模式 */
int sndbuf; /* 发送缓冲区长度(单位:字节) */
struct sock *prev;
/* Not all are volatile, but some are, so we might as well say they all are.
* XXX Make this a flag word -DaveM
*/
volatile char dead,
done,
urginline,
keepopen,
linger,
destroy,
no_check, /*SO_NO_CHECK标志,表示是否检查包*/
broadcast,
bsdism;
unsigned char debug;
unsigned char rcvtstamp;
unsigned char userlocks;/*SO_SNDBUF和SO_RCVBUF标志 */
int proc;
unsigned long lingertime;
int hashent;
struct sock *pair;
/* The backlog queue is special, it is always used with
* the per-socket spinlock held and requires low latency
* access. Therefore we special case it's implementation.
*/
struct {
struct sk_buff *head;
struct sk_buff *tail;
} backlog;
rwlock_t callback_lock;/*用于结构末尾的回调函数互斥*/
/* 错误队列,很少使用 */
struct sk_buff_head error_queue;
struct proto *prot;/*网络地址簇内部协议处理*/
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
union {
struct ipv6_pinfo af_inet6;
} net_pinfo;
#endif
union {
struct tcp_opt af_tcp;
#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE)
struct raw_opt tp_raw4;
#endif
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
struct raw6_opt tp_raw;
#endif /* CONFIG_IPV6 */
#if defined(CONFIG_SPX) || defined (CONFIG_SPX_MODULE)
struct spx_opt af_spx;
#endif /* CONFIG_SPX */
} tp_pinfo;
int err, err_soft; /* Soft holds errors that don't
cause failure but are the cause
of a persistent failure not just
'timed out' */
unsigned short ack_backlog;
unsigned short max_ack_backlog;
__u32 priority;
unsigned short type; /*socket类型,如:SOCK_STREAM*/
unsigned char localroute; /* 仅用于本地路由 */
unsigned char protocol; /*socket 所属网络地址簇的协议*/
struct ucred peercred; /*对端sock信息 SO_PEERCRED标志设置*/
int rcvlowat; /*SO_RCVLOWAT标志位*/
long rcvtimeo; /*SO_RCVTIMEO标志位*/
long sndtimeo; /*SO_SNDTIMEO标志位*/
#ifdef CONFIG_FILTER
/* Socket过滤指令 */
struct sk_filter *filter;
#endif /* CONFIG_FILTER */
/* This is where all the private (optional) areas that don't
* overlap will eventually live.
*/
union {
void *destruct_hook;
struct unix_opt af_unix;
#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE)
struct inet_opt af_inet;
#endif
#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE)
struct atalk_sock af_at;
#endif
#if defined(CONFIG_IPX) || defined(CONFIG_IPX_MODULE)
struct ipx_opt af_ipx;
#endif
#if defined (CONFIG_DECNET) || defined(CONFIG_DECNET_MODULE)
struct dn_scp dn;
#endif
#if defined (CONFIG_PACKET) || defined(CONFIG_PACKET_MODULE)
struct packet_opt *af_packet;
#endif
#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE)
x25_cb *x25;
#endif
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
ax25_cb *ax25;
#endif
#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
nr_cb *nr;
#endif
#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE)
rose_cb *rose;
#endif
#if defined(CONFIG_PPPOE) || defined(CONFIG_PPPOE_MODULE)
struct pppox_opt *pppox;
#endif
#ifdef CONFIG_NETLINK
struct netlink_opt *af_netlink;
#endif
#if defined(CONFIG_ECONET) || defined(CONFIG_ECONET_MODULE)
struct econet_opt *af_econet;
#endif
#if defined(CONFIG_ATM) || defined(CONFIG_ATM_MODULE)
struct atm_vcc *af_atm;
#endif
#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
struct irda_sock *irda;
#endif
} protinfo; /*私有数据区,网络地址簇规范*/
/* This part is used for the timeout functions. */
struct timer_list timer; /* sock清除定时器. */
struct timeval stamp; /*最后到达的包的时间戳*/
/* Identd and reporting IO signals */
struct socket *socket; /*BSD socket层套接字*/
/* RPC层私有数据 */
void *user_data;
/* 回调函数 */
void (*state_change)(struct sock *sk);
void (*data_ready)(struct sock *sk,int bytes);
void (*write_space)(struct sock *sk);
void (*error_report)(struct sock *sk);
int (*backlog_rcv) (struct sock *sk,
struct sk_buff *skb);
void (*destruct)(struct sock *sk);
};
struct sock注释的更多相关文章
- struct socket 结构详解
Socket数据结构网络协议CC++ 用户使用socket系统调用编写应用程序时,通过一个数字来表示一个socket,所有的操作都在该数字上进行,这个数字称为套接字描述符.在系统调用 的实现函 ...
- Linux内核源代码解析之——sock's buffer参数
本文原创为freas_1990,转载请标明出处:http://blog.csdn.net/freas_1990/article/details/11539695 关于socket与sock的关系再简单 ...
- Linux skbuff注释笔记
SKB结构定义 /usr/src/linux/include/linux/skbuff.h sk_buff_head: struct sk_buff_head { //SKB的头结点 /* The ...
- 使用Crash工具查看一个TCP listen sock内存布局实例
利用crash工具,我们可以很方便的查看正在运行内核的一些全局变量的数据结构,如TCP的ehash.bhash哈希桶,全局变量的查看比较简单.Crash工具还允许我们查看调用堆栈内部的局部变量,下面示 ...
- 【Linux 内核网络协议栈源码剖析】网络栈主要结构介绍(socket、sock、sk_buff,etc)
原文:http://blog.csdn.net/wenqian1991/article/details/46700177 通过前面的分析,可以发现,网络协议栈中的数据处理,都是基于各类结构体,所有有关 ...
- struct socket结构体详解
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://weiguozhihui.blog.51cto.com/3060615/15852 ...
- Struct Socket详细分析(转)
原文地址:http://anders0913.iteye.com/blog/411986 用户使用socket系统调用编写应用程序时,通过一个数字来表示一个socket,所有的操作都在该数字上进行,这 ...
- ERROR 2002 (HY000): Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "
找不到mysql.sock这个文件 如果在你操作安装提示创建该文件,重启服务器还是提示这个错误可以试一下 mysql -uroot -h 127.0.0.1 -p 应该是可以直接进入 具体处理方法 重 ...
- sock skbuf 结构:
/** * struct sock - network layer representation of sockets * @__sk_common: shared layout with inet_ ...
随机推荐
- POJ3468/splay树/成段更新
板子题,正在努力看懂板子.. http://blog.csdn.net/acm_cxlove/article/details/7815019 http://www.cnblogs.com/kuangb ...
- springMVC整理02--常用注解的使用
1.使用@RequestMapping 映射请求 1.1在类和方法上添加@RequestMappingSpringMVC 使用@RequestMapping 为控制器指定可以处理哪些 URL 请求. ...
- Codeforces Global Round 2 D. Frets On Fire (动态开点线段树,沙雕写法)
题目链接:D. Frets On Fire 思路:明明可以离散化+二分写,思路硬是歪到了线段树上,自闭了,真实弟弟,怪不得其他人过得那么快 只和查询的区间长度有关系,排完序如果相邻的两个点的差值小于等 ...
- Nagios 监控 Httpd 并发数插件
工作需要监控Httpd并发数,找不到合适的插件,花时间研究了一下Nagios监控内存的脚本,做了一些修改,完成了脚本.监控内存脚本:http://www.cnblogs.com/Mrhuangrui/ ...
- Hdoj 2188.悼念512汶川大地震遇难同胞——选拔志愿者 题解
Problem Description 对于四川同胞遭受的灾难,全国人民纷纷伸出援助之手,几乎每个省市都派出了大量的救援人员,这其中包括抢险救灾的武警部队,治疗和防疫的医护人员,以及进行心理疏导的心理 ...
- 【BZOJ4316】小C的独立集(动态规划)
[BZOJ4316]小C的独立集(动态规划) 题面 BZOJ 题解 考虑树的独立集求法 设\(f[i][0/1]\)表示\(i\)这个点一定不选,以及\(i\)这个点无所谓的最大值 转移\(f[u][ ...
- <数据结构基础学习>(一)数组
一.数组基础 1.数组,即把数据码成一排存放. 数组优点:快速查询. 数组最好应用于“索引有语意”的情况,但并非所有有语意的索引都适用于数组,数组也可以处理“索引没有语意”的情况. 2.增.删.改.查 ...
- uvaLive7303 Aquarium (kruskal)
题意:给R*C的房间,每个房间被左上-右下或右上-左下的墙分割为两个小房间,将分割移除有一定花费,问使所有小房间联通需要的最小花费 把每个房间分成左右(上下?)两个点,判一判,本来就联通的加零边,一个 ...
- hdu 2609 How many(最小表示法)
Problem Description Give you n ( n < 10000) necklaces ,the length of necklace will not large than ...
- Python反转过程学习
Pyhon的反转过程的学习: #coding:utf-8 #反转过程.py """ def add(x,y): return x+y params=(1,2) add(* ...