sock.h (eb5bc2a213f96bd43b5f00a625acb0c669613645) sock.h (33cf7c90fe2f97afb1cadaa0cfb782cb9d1b9ee2)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the AF_INET socket handler.
7 *
8 * Version: @(#)sock.h 1.0.4 05/13/93

--- 185 unchanged lines hidden (view full) ---

194 struct net *skc_net;
195#endif
196
197#if IS_ENABLED(CONFIG_IPV6)
198 struct in6_addr skc_v6_daddr;
199 struct in6_addr skc_v6_rcv_saddr;
200#endif
201
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the AF_INET socket handler.
7 *
8 * Version: @(#)sock.h 1.0.4 05/13/93

--- 185 unchanged lines hidden (view full) ---

194 struct net *skc_net;
195#endif
196
197#if IS_ENABLED(CONFIG_IPV6)
198 struct in6_addr skc_v6_daddr;
199 struct in6_addr skc_v6_rcv_saddr;
200#endif
201
202 atomic64_t skc_cookie;
203
202 /*
203 * fields between dontcopy_begin/dontcopy_end
204 * are not copied in sock_copy()
205 */
206 /* private: */
207 int skc_dontcopy_begin[0];
208 /* public: */
209 union {

--- 114 unchanged lines hidden (view full) ---

324#define sk_reuseport __sk_common.skc_reuseport
325#define sk_ipv6only __sk_common.skc_ipv6only
326#define sk_bound_dev_if __sk_common.skc_bound_dev_if
327#define sk_bind_node __sk_common.skc_bind_node
328#define sk_prot __sk_common.skc_prot
329#define sk_net __sk_common.skc_net
330#define sk_v6_daddr __sk_common.skc_v6_daddr
331#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
204 /*
205 * fields between dontcopy_begin/dontcopy_end
206 * are not copied in sock_copy()
207 */
208 /* private: */
209 int skc_dontcopy_begin[0];
210 /* public: */
211 union {

--- 114 unchanged lines hidden (view full) ---

326#define sk_reuseport __sk_common.skc_reuseport
327#define sk_ipv6only __sk_common.skc_ipv6only
328#define sk_bound_dev_if __sk_common.skc_bound_dev_if
329#define sk_bind_node __sk_common.skc_bind_node
330#define sk_prot __sk_common.skc_prot
331#define sk_net __sk_common.skc_net
332#define sk_v6_daddr __sk_common.skc_v6_daddr
333#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
334#define sk_cookie __sk_common.skc_cookie
332
333 socket_lock_t sk_lock;
334 struct sk_buff_head sk_receive_queue;
335 /*
336 * The backlog queue is special, it is always used with
337 * the per-socket spinlock held and requires low latency
338 * access. Therefore we special case it's implementation.
339 * Note : rmem_alloc is in this structure to fill a hole

--- 613 unchanged lines hidden (view full) ---

953 unsigned int optlen);
954 int (*compat_getsockopt)(struct sock *sk,
955 int level,
956 int optname, char __user *optval,
957 int __user *option);
958 int (*compat_ioctl)(struct sock *sk,
959 unsigned int cmd, unsigned long arg);
960#endif
335
336 socket_lock_t sk_lock;
337 struct sk_buff_head sk_receive_queue;
338 /*
339 * The backlog queue is special, it is always used with
340 * the per-socket spinlock held and requires low latency
341 * access. Therefore we special case it's implementation.
342 * Note : rmem_alloc is in this structure to fill a hole

--- 613 unchanged lines hidden (view full) ---

956 unsigned int optlen);
957 int (*compat_getsockopt)(struct sock *sk,
958 int level,
959 int optname, char __user *optval,
960 int __user *option);
961 int (*compat_ioctl)(struct sock *sk,
962 unsigned int cmd, unsigned long arg);
963#endif
961 int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
962 struct msghdr *msg, size_t len);
963 int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
964 struct msghdr *msg,
964 int (*sendmsg)(struct sock *sk, struct msghdr *msg,
965 size_t len);
966 int (*recvmsg)(struct sock *sk, struct msghdr *msg,
965 size_t len, int noblock, int flags,
966 int *addr_len);
967 int (*sendpage)(struct sock *sk, struct page *page,
968 int offset, size_t size, int flags);
969 int (*bind)(struct sock *sk,
970 struct sockaddr *uaddr, int addr_len);
971
972 int (*backlog_rcv) (struct sock *sk,

--- 584 unchanged lines hidden (view full) ---

1557int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1558unsigned int sock_no_poll(struct file *, struct socket *,
1559 struct poll_table_struct *);
1560int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1561int sock_no_listen(struct socket *, int);
1562int sock_no_shutdown(struct socket *, int);
1563int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1564int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
967 size_t len, int noblock, int flags,
968 int *addr_len);
969 int (*sendpage)(struct sock *sk, struct page *page,
970 int offset, size_t size, int flags);
971 int (*bind)(struct sock *sk,
972 struct sockaddr *uaddr, int addr_len);
973
974 int (*backlog_rcv) (struct sock *sk,

--- 584 unchanged lines hidden (view full) ---

1559int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1560unsigned int sock_no_poll(struct file *, struct socket *,
1561 struct poll_table_struct *);
1562int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1563int sock_no_listen(struct socket *, int);
1564int sock_no_shutdown(struct socket *, int);
1565int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1566int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1565int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t);
1566int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t,
1567 int);
1567int sock_no_sendmsg(struct socket *, struct msghdr *, size_t);
1568int sock_no_recvmsg(struct socket *, struct msghdr *, size_t, int);
1568int sock_no_mmap(struct file *file, struct socket *sock,
1569 struct vm_area_struct *vma);
1570ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1571 size_t size, int flags);
1572
1573/*
1574 * Functions to fill in entries in struct proto_ops when a protocol
1575 * uses the inet style.
1576 */
1577int sock_common_getsockopt(struct socket *sock, int level, int optname,
1578 char __user *optval, int __user *optlen);
1569int sock_no_mmap(struct file *file, struct socket *sock,
1570 struct vm_area_struct *vma);
1571ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1572 size_t size, int flags);
1573
1574/*
1575 * Functions to fill in entries in struct proto_ops when a protocol
1576 * uses the inet style.
1577 */
1578int sock_common_getsockopt(struct socket *sock, int level, int optname,
1579 char __user *optval, int __user *optlen);
1579int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1580 struct msghdr *msg, size_t size, int flags);
1580int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
1581 int flags);
1581int sock_common_setsockopt(struct socket *sock, int level, int optname,
1582 char __user *optval, unsigned int optlen);
1583int compat_sock_common_getsockopt(struct socket *sock, int level,
1584 int optname, char __user *optval, int __user *optlen);
1585int compat_sock_common_setsockopt(struct socket *sock, int level,
1586 int optname, char __user *optval, unsigned int optlen);
1587
1588void sk_common_release(struct sock *sk);

--- 484 unchanged lines hidden (view full) ---

2073/* Alas, with timeout socket operations are not restartable.
2074 * Compare this to poll().
2075 */
2076static inline int sock_intr_errno(long timeo)
2077{
2078 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2079}
2080
1582int sock_common_setsockopt(struct socket *sock, int level, int optname,
1583 char __user *optval, unsigned int optlen);
1584int compat_sock_common_getsockopt(struct socket *sock, int level,
1585 int optname, char __user *optval, int __user *optlen);
1586int compat_sock_common_setsockopt(struct socket *sock, int level,
1587 int optname, char __user *optval, unsigned int optlen);
1588
1589void sk_common_release(struct sock *sk);

--- 484 unchanged lines hidden (view full) ---

2074/* Alas, with timeout socket operations are not restartable.
2075 * Compare this to poll().
2076 */
2077static inline int sock_intr_errno(long timeo)
2078{
2079 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2080}
2081
2082struct sock_skb_cb {
2083 u32 dropcount;
2084};
2085
2086/* Store sock_skb_cb at the end of skb->cb[] so protocol families
2087 * using skb->cb[] would keep using it directly and utilize its
2088 * alignement guarantee.
2089 */
2090#define SOCK_SKB_CB_OFFSET ((FIELD_SIZEOF(struct sk_buff, cb) - \
2091 sizeof(struct sock_skb_cb)))
2092
2093#define SOCK_SKB_CB(__skb) ((struct sock_skb_cb *)((__skb)->cb + \
2094 SOCK_SKB_CB_OFFSET))
2095
2096#define sock_skb_cb_check_size(size) \
2097 BUILD_BUG_ON((size) > SOCK_SKB_CB_OFFSET)
2098
2099static inline void
2100sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb)
2101{
2102 SOCK_SKB_CB(skb)->dropcount = atomic_read(&sk->sk_drops);
2103}
2104
2081void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2082 struct sk_buff *skb);
2083void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2084 struct sk_buff *skb);
2085
2086static inline void
2087sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2088{

--- 131 unchanged lines hidden ---
2105void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2106 struct sk_buff *skb);
2107void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2108 struct sk_buff *skb);
2109
2110static inline void
2111sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2112{

--- 131 unchanged lines hidden ---