1STRUCT SOCK(9)                 Linux Networking                 STRUCT SOCK(9)
2
3
4

NAME

6       struct_sock - network layer representation of sockets
7

SYNOPSIS

9       struct sock {
10         struct sock_common __sk_common;
11       #define sk_node               __sk_common.skc_node
12       #define sk_nulls_node         __sk_common.skc_nulls_node
13       #define sk_refcnt        __sk_common.skc_refcnt
14       #define sk_copy_start         __sk_common.skc_hash
15       #define sk_hash               __sk_common.skc_hash
16       #define sk_family        __sk_common.skc_family
17       #define sk_state         __sk_common.skc_state
18       #define sk_reuse         __sk_common.skc_reuse
19       #define sk_reuseport          __sk_common.skc_reuseport
20       #define sk_bound_dev_if       __sk_common.skc_bound_dev_if
21       #define sk_bind_node          __sk_common.skc_bind_node
22       #define sk_prot               __sk_common.skc_prot
23       #define sk_net           __sk_common.skc_net
24         unsigned int sk_shutdown:2;
25         unsigned int sk_no_check:2;
26         unsigned int sk_userlocks:4;
27         unsigned int sk_protocol:8;
28         unsigned int sk_type:16;
29       #define SK_PROTOCOL_MAX U8_MAX
30         int sk_rcvbuf;
31         socket_lock_t sk_lock;
32         struct sk_backlog;
33         wait_queue_head_t * sk_sleep;
34         struct dst_entry * sk_dst_cache;
35       #ifdef CONFIG_XFRM
36         struct xfrm_policy * sk_policy[2];
37       #endif
38         rwlock_t sk_dst_lock;
39         atomic_t sk_rmem_alloc;
40         atomic_t sk_wmem_alloc;
41         atomic_t sk_omem_alloc;
42         int sk_sndbuf;
43         struct sk_buff_head sk_receive_queue;
44         struct sk_buff_head sk_write_queue;
45       #ifdef CONFIG_NET_DMA
46         struct sk_buff_head sk_async_wait_queue;
47       #endif
48         int sk_wmem_queued;
49         int sk_forward_alloc;
50         gfp_t sk_allocation;
51         int sk_route_caps;
52         int sk_gso_type;
53         unsigned int sk_gso_max_size;
54         int sk_rcvlowat;
55         unsigned long sk_flags;
56         unsigned long sk_lingertime;
57         struct sk_buff_head sk_error_queue;
58         struct proto * sk_prot_creator;
59         rwlock_t sk_callback_lock;
60         int sk_err;
61         int sk_err_soft;
62         atomic_t sk_drops;
63         unsigned short sk_ack_backlog;
64         unsigned short sk_max_ack_backlog;
65         __u32 sk_priority;
66         struct ucred sk_peercred;
67         long sk_rcvtimeo;
68         long sk_sndtimeo;
69         struct sk_filter * sk_filter;
70         void * sk_protinfo;
71         struct timer_list sk_timer;
72         ktime_t sk_stamp;
73         struct socket * sk_socket;
74         void * sk_user_data;
75         struct page * sk_sndmsg_page;
76         struct sk_buff * sk_send_head;
77         __u32 sk_sndmsg_off;
78         int sk_write_pending;
79       #ifdef CONFIG_SECURITY
80         void * sk_security;
81       #endif
82         __u32 sk_mark;
83         void (* sk_state_change) (struct sock *sk);
84         void (* sk_data_ready) (struct sock *sk, int bytes);
85         void (* sk_write_space) (struct sock *sk);
86         void (* sk_error_report) (struct sock *sk);
87         int (* sk_backlog_rcv) (struct sock *sk,struct sk_buff *skb);
88         void (* sk_destruct) (struct sock *sk);
89       };
90

MEMBERS

92       __sk_common
93           shared layout with inet_timewait_sock
94
95       sk_shutdown
96           mask of SEND_SHUTDOWN and/or RCV_SHUTDOWN
97
98       sk_no_check
99
100           SO_NO_CHECK setting, wether or not checkup packets
101
102       sk_userlocks
103
104           SO_SNDBUF and SO_RCVBUF settings
105
106       sk_protocol
107           which protocol this socket belongs in this network family
108
109       sk_type
110           socket type (SOCK_STREAM, etc)
111
112       sk_rcvbuf
113           size of receive buffer in bytes
114
115       sk_lock
116           synchronizer
117
118       sk_backlog
119           always used with the per-socket spinlock held
120
121       sk_sleep
122           sock wait queue
123
124       sk_dst_cache
125           destination cache
126
127       sk_policy[2]
128           flow policy
129
130       sk_dst_lock
131           destination cache lock
132
133       sk_rmem_alloc
134           receive queue bytes committed
135
136       sk_wmem_alloc
137           transmit queue bytes committed
138
139       sk_omem_alloc
140           "o“ is ”option“ or ”other"
141
142       sk_sndbuf
143           size of send buffer in bytes
144
145       sk_receive_queue
146           incoming packets
147
148       sk_write_queue
149           Packet sending queue
150
151       sk_async_wait_queue
152           DMA copied packets
153
154       sk_wmem_queued
155           persistent queue size
156
157       sk_forward_alloc
158           space allocated forward
159
160       sk_allocation
161           allocation mode
162
163       sk_route_caps
164           route capabilities (e.g.  NETIF_F_TSO)
165
166       sk_gso_type
167           GSO type (e.g.  SKB_GSO_TCPV4)
168
169       sk_gso_max_size
170           Maximum GSO segment size to build
171
172       sk_rcvlowat
173
174           SO_RCVLOWAT setting
175
176       sk_flags
177
178           SO_LINGER (l_onoff), SO_BROADCAST, SO_KEEPALIVE, SO_OOBINLINE
179           settings, SO_TIMESTAMPING settings
180
181       sk_lingertime
182
183           SO_LINGER l_linger setting
184
185       sk_error_queue
186           rarely used
187
188       sk_prot_creator
189           sk_prot of original sock creator (see ipv6_setsockopt,
190           IPV6_ADDRFORM for instance)
191
192       sk_callback_lock
193           used with the callbacks in the end of this struct
194
195       sk_err
196           last error
197
198       sk_err_soft
199           errors that don´t cause failure but are the cause of a persistent
200           failure not just ´timed out´
201
202       sk_drops
203           raw/udp drops counter
204
205       sk_ack_backlog
206           current listen backlog
207
208       sk_max_ack_backlog
209           listen backlog set in listen
210
211       sk_priority
212
213           SO_PRIORITY setting
214
215       sk_peercred
216
217           SO_PEERCRED setting
218
219       sk_rcvtimeo
220
221           SO_RCVTIMEO setting
222
223       sk_sndtimeo
224
225           SO_SNDTIMEO setting
226
227       sk_filter
228           socket filtering instructions
229
230       sk_protinfo
231           private area, net family specific, when not using slab
232
233       sk_timer
234           sock cleanup timer
235
236       sk_stamp
237           time stamp of last packet received
238
239       sk_socket
240           Identd and reporting IO signals
241
242       sk_user_data
243           RPC layer private data
244
245       sk_sndmsg_page
246           cached page for sendmsg
247
248       sk_send_head
249           front of stuff to transmit
250
251       sk_sndmsg_off
252           cached offset for sendmsg
253
254       sk_write_pending
255           a write to stream socket waits to start
256
257       sk_security
258           used by security modules
259
260       sk_mark
261           generic packet mark
262
263       sk_state_change
264           callback to indicate change in the state of the sock
265
266       sk_data_ready
267           callback to indicate there is data to be processed
268
269       sk_write_space
270           callback to indicate there is bf sending space available
271
272       sk_error_report
273           callback to indicate errors (e.g.  MSG_ERRQUEUE)
274
275       sk_backlog_rcv
276           callback to process the backlog
277
278       sk_destruct
279           called at sock freeing time, i.e. when all refcnt == 0
280
282Kernel Hackers Manual 2.6.         June 2019                    STRUCT SOCK(9)
Impressum