linuxkernelTCP/IP协议栈
2017-07-03 23:02:25 16 举报
kernel tcp/ip study
作者其他创作
大纲/内容
list_head ptype_base[16];list_head ptype_all;
struct inet_protoswinetsw_array[]
sock_sendmsgsock-ops-sendmsginet_stream_ops.sendmsginet_sendmsgtcp_prot.sendmsgtcp_sendmsg
dev_add_pack
struct inet_protosw {\tstruct list_head list;\tunsigned short\t type;\tunsigned short\t protocol; \tstruct proto\t *prot;\tconst struct proto_ops *ops;\tchar no_check; \tunsigned char\t flags; };
struct net_proto_family net_families[]
struct packet_typearp_packet_type(ETH_P_ARP 0806)
inet_register_protosw
af_inet.c
ip_rcv_finish
struct inet_protosw inetsw_array
inetsw[SOCK_STREAM] inetsw_array[0]------------------------------------------struct socket *sock{ .ops=inet_stream_ops .sk=sk_alloc(); { .sk_prot=tcp_proto .sk_socket=sock; }}
inet_stream_ops
proto_list
sock_register
list_head inetsw[];[protosw-type]
dev.c
实际上让 proto_ops调用prot
inet_add_protocol
struct net_protocol inet_protos[]
struct net_prot_family inet_family_ops
IPPROTO_**要接收的协议包
struct prototcp_prot [tcp_ipv4.c]udp_prot [udp.c]raw_prot [raw.c]
include/net/sock.hstruct sock {\tstruct sock_common\t__sk_common { \t\tunsigned short\t\tskc_family;\t\tstruct proto\t\t*skc_prot;\t\tstruct net\t \t*skc_net;\t}struct sk_buff_head\tsk_receive_queue;\tsk_buff_head\tsk_write_queue;}
tcp.c/tcp_v4.ctcp_pushtcp_output.ctcp_transmit_skb
所有的协议:如arp等
ip_finish_output
prot_register
struct packet_typeip_packet_typeETH_P_IP 0x0800
收藏
0 条评论
下一页
为你推荐
查看更多