1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _INET_COMMON_H
3#define _INET_COMMON_H
4
5extern const struct proto_ops inet_stream_ops;
6extern const struct proto_ops inet_dgram_ops;
7
8/*
9 * INET4 prototypes used by INET6
10 */
11
12struct msghdr;
13struct sock;
14struct sockaddr;
15struct socket;
16
17int inet_release(struct socket *sock);
18int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
19 int addr_len, int flags);
20int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
21 int addr_len, int flags, int is_sendmsg);
22int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
23 int addr_len, int flags);
24int inet_accept(struct socket *sock, struct socket *newsock, int flags,
25 bool kern);
26int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
27ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
28 size_t size, int flags);
29int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
30 int flags);
31int inet_shutdown(struct socket *sock, int how);
32int inet_listen(struct socket *sock, int backlog);
33void inet_sock_destruct(struct sock *sk);
34int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
35int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
36 bool force_bind_address_no_port, bool with_lock);
37int inet_getname(struct socket *sock, struct sockaddr *uaddr,
38 int peer);
39int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
40int inet_ctl_sock_create(struct sock **sk, unsigned short family,
41 unsigned short type, unsigned char protocol,
42 struct net *net);
43int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
44 int *addr_len);
45
46struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb);
47int inet_gro_complete(struct sk_buff *skb, int nhoff);
48struct sk_buff *inet_gso_segment(struct sk_buff *skb,
49 netdev_features_t features);
50
51static inline void inet_ctl_sock_destroy(struct sock *sk)
52{
53 if (sk)
54 sock_release(sk->sk_socket);
55}
56
57#endif
58