Important structures in Linux TCP/IP stack

socket{}

This structure is the basis for the implementation of the BSD socket layer. Each socket{} represents one connection and is associated with one socket file descriptor in the application layer. Thus, to end users, sending and receiving packets through a connection is identical to writing and reading from a "socket file".

msghdr{}

This is the structure where data is saved in BSD socket layer.

proto_ops{}

This structure is the funtion set used in socket{}. According to different address families, socket{} in BSD socket layer uses different proto_ops{} funtion set located in INET socket layer.

sock{}

This structure is the basis for implementation of the INET socket layer. It's reponsible for the sending and receiving of network packets.

sk_buff{}

This is the structure where data is saved in INET socket layer.

tcp_opt{}

This is the structure where lots of TCP options and TCP connection parameters are saved.

proto{}

This structure is the funtion set used in sock{}. According to different protocols, different proto{} funtion sets are used.

tcphdr{}

This structure is where the head buff (with no options) of a TCP package is specified.

tcp_skb_cb{}

This structure contains varieties of TCP parameters in TCP control block (TCB) which decides what should be put into tcphdr.