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