185
京東網上商城
網絡子係統79_inet協議族
// inet協議族默認支持的協議類型 // 在inet_init中,通過inet_register_protosw注冊到inetsw鄰接表 1.1 static struct inet_protosw inetsw_array[] = { //流類型 { .type = SOCK_STREAM, .protocol = IPPROTO_TCP, .prot = &tcp_prot, .ops = &inet_stream_ops, .no_check = 0, .flags = INET_PROTOSW_PERMANENT | INET_PROTOSW_ICSK, }, //數據報類型,UDP, ICMP { .type = SOCK_DGRAM, .protocol = IPPROTO_UDP, .prot = &udp_prot, .ops = &inet_dgram_ops, .no_check = UDP_CSUM_DEFAULT, .flags = INET_PROTOSW_PERMANENT, }, { .type = SOCK_DGRAM, .protocol = IPPROTO_ICMP, .prot = &ping_prot, .ops = &inet_dgram_ops, .no_check = UDP_CSUM_DEFAULT, .flags = INET_PROTOSW_REUSE, }, //raw類型 { .type = SOCK_RAW, .protocol = IPPROTO_IP, /* wild card */ .prot = &raw_prot, .ops = &inet_sockraw_ops, .no_check = UDP_CSUM_DEFAULT, .flags = INET_PROTOSW_REUSE, } }; // 注: // struct socket - general BSD socket // struct sock - network layer representation of sockets // struct inet_sock - representation of INET sockets 1.2 struct socket, struct sock, struct inet_sock struct socket { .. //(file->private_data指向socket) struct file *file; struct sock *sk; .. } struct inet_sock { struct sock sk; ... }
最後更新:2017-04-03 12:55:18