struct sock — network layer representation of sockets
struct sock { struct sock_common __sk_common; #define sk_family __sk_common.skc_family #define sk_state __sk_common.skc_state #define sk_reuse __sk_common.skc_reuse #define sk_bound_dev_if __sk_common.skc_bound_dev_if #define sk_node __sk_common.skc_node #define sk_bind_node __sk_common.skc_bind_node #define sk_refcnt __sk_common.skc_refcnt #define sk_hash __sk_common.skc_hash #define sk_prot __sk_common.skc_prot unsigned char sk_shutdown:2; unsigned char sk_no_check:2; unsigned char sk_userlocks:4; unsigned char sk_protocol; unsigned short sk_type; int sk_rcvbuf; socket_lock_t sk_lock; wait_queue_head_t * sk_sleep; struct dst_entry * sk_dst_cache; struct xfrm_policy * sk_policy[2]; rwlock_t sk_dst_lock; atomic_t sk_rmem_alloc; atomic_t sk_wmem_alloc; atomic_t sk_omem_alloc; struct sk_buff_head sk_receive_queue; struct sk_buff_head sk_write_queue; int sk_wmem_queued; int sk_forward_alloc; gfp_t sk_allocation; int sk_sndbuf; int sk_route_caps; unsigned long sk_flags; unsigned long sk_lingertime; struct sk_backlog; struct sk_buff_head sk_error_queue; struct proto * sk_prot_creator; rwlock_t sk_callback_lock; int sk_err; int sk_err_soft; unsigned short sk_ack_backlog; unsigned short sk_max_ack_backlog; __u32 sk_priority; struct ucred sk_peercred; int sk_rcvlowat; long sk_rcvtimeo; long sk_sndtimeo; struct sk_filter * sk_filter; void * sk_protinfo; struct timer_list sk_timer; struct timeval sk_stamp; struct socket * sk_socket; void * sk_user_data; struct page * sk_sndmsg_page; struct sk_buff * sk_send_head; __u32 sk_sndmsg_off; int sk_write_pending; void * sk_security; void (* sk_state_change) (struct sock *sk); void (* sk_data_ready) (struct sock *sk, int bytes); void (* sk_write_space) (struct sock *sk); void (* sk_error_report) (struct sock *sk); int (* sk_backlog_rcv) (struct sock *sk,struct sk_buff *skb); void (* sk_destruct) (struct sock *sk); };
shared layout with inet_timewait_sock
mask of SEND_SHUTDOWN
and/or RCV_SHUTDOWN
SO_NO_CHECK
setting, wether or not checkup packets
SO_SNDBUF
and SO_RCVBUF
settings
which protocol this socket belongs in this network family
socket type (SOCK_STREAM
, etc)
size of receive buffer in bytes
synchronizer
sock wait queue
destination cache
flow policy
destination cache lock
receive queue bytes committed
transmit queue bytes committed
“o” is “option” or “other”
incoming packets
Packet sending queue
persistent queue size
space allocated forward
allocation mode
size of send buffer in bytes
route capabilities (e.g. NETIF_F_TSO
)
SO_LINGER
(l_onoff), SO_BROADCAST
, SO_KEEPALIVE
, SO_OOBINLINE
settings
SO_LINGER
l_linger setting
always used with the per-socket spinlock held
rarely used
sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance)
used with the callbacks in the end of this struct
last error
errors that don't cause failure but are the cause of a persistent failure not just 'timed out'
current listen backlog
listen backlog set in listen
SO_PRIORITY
setting
SO_PEERCRED
setting
SO_RCVLOWAT
setting
SO_RCVTIMEO
setting
SO_SNDTIMEO
setting
socket filtering instructions
private area, net family specific, when not using slab
sock cleanup timer
time stamp of last packet received
Identd and reporting IO signals
RPC layer private data
cached page for sendmsg
front of stuff to transmit
cached offset for sendmsg
a write to stream socket waits to start
used by security modules
callback to indicate change in the state of the sock
callback to indicate there is data to be processed
callback to indicate there is bf sending space available
callback to indicate errors (e.g. MSG_ERRQUEUE
)
callback to process the backlog
called at sock freeing time, i.e. when all refcnt == 0