blob: 3ca969cbd16117fe15b1521333c5d7a28c8709f7 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _INET_COMMON_H
3#define _INET_COMMON_H
4
Changli Gao53d31762010-07-10 20:41:06 +00005extern const struct proto_ops inet_stream_ops;
6extern const struct proto_ops inet_dgram_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8/*
9 * INET4 prototypes used by INET6
10 */
11
Arnaldo Carvalho de Melo77d8bf92005-08-09 20:00:51 -070012struct msghdr;
13struct sock;
14struct sockaddr;
15struct socket;
16
Joe Perches1fd51152013-09-21 10:22:41 -070017int 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,
Willy Tarreau3979ad72017-01-25 14:42:46 +010021 int addr_len, int flags, int is_sendmsg);
Joe Perches1fd51152013-09-21 10:22:41 -070022int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
23 int addr_len, int flags);
David Howellscdfbabf2017-03-09 08:09:05 +000024int inet_accept(struct socket *sock, struct socket *newsock, int flags,
25 bool kern);
Ying Xue1b784142015-03-02 15:37:48 +080026int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
Joe Perches1fd51152013-09-21 10:22:41 -070027ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
28 size_t size, int flags);
Ying Xue1b784142015-03-02 15:37:48 +080029int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
30 int flags);
Joe Perches1fd51152013-09-21 10:22:41 -070031int 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);
Andrey Ignatov3679d582018-03-30 15:08:04 -070035int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
36 bool force_bind_address_no_port, bool with_lock);
Denys Vlasenko9b2c45d2018-02-12 20:00:20 +010037int inet_getname(struct socket *sock, struct sockaddr *uaddr,
Joe Perches1fd51152013-09-21 10:22:41 -070038 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);
Willem de Bruijnf4713a32014-11-26 14:53:02 -050043int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
44 int *addr_len);
Denis V. Lunev56772422008-04-03 14:28:30 -070045
David Millerd4546c22018-06-24 14:13:49 +090046struct sk_buff *inet_gro_receive(struct list_head *head, struct sk_buff *skb);
Tom Herbertb8921ca2016-05-18 09:06:23 -070047int 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
Denis V. Lunev56772422008-04-03 14:28:30 -070051static inline void inet_ctl_sock_destroy(struct sock *sk)
52{
Eric Dumazet8fa677d2015-11-02 07:50:07 -080053 if (sk)
54 sock_release(sk->sk_socket);
Denis V. Lunev56772422008-04-03 14:28:30 -070055}
Denis V. Lunev3d58b5f2008-04-03 14:22:32 -070056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#endif