xref: /linux/include/linux/net.h (revision aaa248f6c9c81b2683db7dbb0689cd5ed1c86d88)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * NET		An implementation of the SOCKET network access protocol.
31da177e4SLinus Torvalds  *		This is the master header file for the Linux NET layer,
41da177e4SLinus Torvalds  *		or, in plain English: the networking handling part of the
51da177e4SLinus Torvalds  *		kernel.
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * Version:	@(#)net.h	1.0.3	05/25/93
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Authors:	Orest Zborowski, <obz@Kodak.COM>
1002c30a84SJesper Juhl  *		Ross Biro
111da177e4SLinus Torvalds  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
121da177e4SLinus Torvalds  *
131da177e4SLinus Torvalds  *		This program is free software; you can redistribute it and/or
141da177e4SLinus Torvalds  *		modify it under the terms of the GNU General Public License
151da177e4SLinus Torvalds  *		as published by the Free Software Foundation; either version
161da177e4SLinus Torvalds  *		2 of the License, or (at your option) any later version.
171da177e4SLinus Torvalds  */
181da177e4SLinus Torvalds #ifndef _LINUX_NET_H
191da177e4SLinus Torvalds #define _LINUX_NET_H
201da177e4SLinus Torvalds 
211da177e4SLinus Torvalds #include <linux/wait.h>
22*aaa248f6SStephen Hemminger #include <linux/random.h>
231da177e4SLinus Torvalds #include <asm/socket.h>
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds struct poll_table_struct;
261da177e4SLinus Torvalds struct inode;
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #define NPROTO		32		/* should be enough for now..	*/
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds #define SYS_SOCKET	1		/* sys_socket(2)		*/
311da177e4SLinus Torvalds #define SYS_BIND	2		/* sys_bind(2)			*/
321da177e4SLinus Torvalds #define SYS_CONNECT	3		/* sys_connect(2)		*/
331da177e4SLinus Torvalds #define SYS_LISTEN	4		/* sys_listen(2)		*/
341da177e4SLinus Torvalds #define SYS_ACCEPT	5		/* sys_accept(2)		*/
351da177e4SLinus Torvalds #define SYS_GETSOCKNAME	6		/* sys_getsockname(2)		*/
361da177e4SLinus Torvalds #define SYS_GETPEERNAME	7		/* sys_getpeername(2)		*/
371da177e4SLinus Torvalds #define SYS_SOCKETPAIR	8		/* sys_socketpair(2)		*/
381da177e4SLinus Torvalds #define SYS_SEND	9		/* sys_send(2)			*/
391da177e4SLinus Torvalds #define SYS_RECV	10		/* sys_recv(2)			*/
401da177e4SLinus Torvalds #define SYS_SENDTO	11		/* sys_sendto(2)		*/
411da177e4SLinus Torvalds #define SYS_RECVFROM	12		/* sys_recvfrom(2)		*/
421da177e4SLinus Torvalds #define SYS_SHUTDOWN	13		/* sys_shutdown(2)		*/
431da177e4SLinus Torvalds #define SYS_SETSOCKOPT	14		/* sys_setsockopt(2)		*/
441da177e4SLinus Torvalds #define SYS_GETSOCKOPT	15		/* sys_getsockopt(2)		*/
451da177e4SLinus Torvalds #define SYS_SENDMSG	16		/* sys_sendmsg(2)		*/
461da177e4SLinus Torvalds #define SYS_RECVMSG	17		/* sys_recvmsg(2)		*/
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds typedef enum {
491da177e4SLinus Torvalds 	SS_FREE = 0,			/* not allocated		*/
501da177e4SLinus Torvalds 	SS_UNCONNECTED,			/* unconnected to any socket	*/
511da177e4SLinus Torvalds 	SS_CONNECTING,			/* in process of connecting	*/
521da177e4SLinus Torvalds 	SS_CONNECTED,			/* connected to socket		*/
531da177e4SLinus Torvalds 	SS_DISCONNECTING		/* in process of disconnecting	*/
541da177e4SLinus Torvalds } socket_state;
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds #define __SO_ACCEPTCON	(1 << 16)	/* performed a listen		*/
571da177e4SLinus Torvalds 
581da177e4SLinus Torvalds #ifdef __KERNEL__
59eacf17bdSDavid Woodhouse #include <linux/stringify.h>
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds #define SOCK_ASYNC_NOSPACE	0
621da177e4SLinus Torvalds #define SOCK_ASYNC_WAITDATA	1
631da177e4SLinus Torvalds #define SOCK_NOSPACE		2
641da177e4SLinus Torvalds #define SOCK_PASSCRED		3
65877ce7c1SCatherine Zhang #define SOCK_PASSSEC		4
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds #ifndef ARCH_HAS_SOCKET_TYPES
684dc3b16bSPavel Pisa /**
694dc3b16bSPavel Pisa  * enum sock_type - Socket types
704dc3b16bSPavel Pisa  * @SOCK_STREAM: stream (connection) socket
714dc3b16bSPavel Pisa  * @SOCK_DGRAM: datagram (conn.less) socket
724dc3b16bSPavel Pisa  * @SOCK_RAW: raw socket
734dc3b16bSPavel Pisa  * @SOCK_RDM: reliably-delivered message
744dc3b16bSPavel Pisa  * @SOCK_SEQPACKET: sequential packet socket
758f2709b5SRandy Dunlap  * @SOCK_DCCP: Datagram Congestion Control Protocol socket
764dc3b16bSPavel Pisa  * @SOCK_PACKET: linux specific way of getting packets at the dev level.
774dc3b16bSPavel Pisa  *		  For writing rarp and other similar things on the user level.
781da177e4SLinus Torvalds  *
791da177e4SLinus Torvalds  * When adding some new socket type please
801da177e4SLinus Torvalds  * grep ARCH_HAS_SOCKET_TYPE include/asm-* /socket.h, at least MIPS
811da177e4SLinus Torvalds  * overrides this enum for binary compat reasons.
821da177e4SLinus Torvalds  */
831da177e4SLinus Torvalds enum sock_type {
841da177e4SLinus Torvalds 	SOCK_STREAM	= 1,
851da177e4SLinus Torvalds 	SOCK_DGRAM	= 2,
861da177e4SLinus Torvalds 	SOCK_RAW	= 3,
871da177e4SLinus Torvalds 	SOCK_RDM	= 4,
881da177e4SLinus Torvalds 	SOCK_SEQPACKET	= 5,
897c657876SArnaldo Carvalho de Melo 	SOCK_DCCP	= 6,
901da177e4SLinus Torvalds 	SOCK_PACKET	= 10,
911da177e4SLinus Torvalds };
921da177e4SLinus Torvalds 
931da177e4SLinus Torvalds #define SOCK_MAX (SOCK_PACKET + 1)
941da177e4SLinus Torvalds 
951da177e4SLinus Torvalds #endif /* ARCH_HAS_SOCKET_TYPES */
961da177e4SLinus Torvalds 
971da177e4SLinus Torvalds /**
981da177e4SLinus Torvalds  *  struct socket - general BSD socket
994dc3b16bSPavel Pisa  *  @state: socket state (%SS_CONNECTED, etc)
1004dc3b16bSPavel Pisa  *  @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
1014dc3b16bSPavel Pisa  *  @ops: protocol specific socket operations
1024dc3b16bSPavel Pisa  *  @fasync_list: Asynchronous wake up list
1034dc3b16bSPavel Pisa  *  @file: File back pointer for gc
1044dc3b16bSPavel Pisa  *  @sk: internal networking protocol agnostic socket representation
1054dc3b16bSPavel Pisa  *  @wait: wait queue for several uses
1064dc3b16bSPavel Pisa  *  @type: socket type (%SOCK_STREAM, etc)
1071da177e4SLinus Torvalds  */
1081da177e4SLinus Torvalds struct socket {
1091da177e4SLinus Torvalds 	socket_state		state;
1101da177e4SLinus Torvalds 	unsigned long		flags;
11190ddc4f0SEric Dumazet 	const struct proto_ops	*ops;
1121da177e4SLinus Torvalds 	struct fasync_struct	*fasync_list;
1131da177e4SLinus Torvalds 	struct file		*file;
1141da177e4SLinus Torvalds 	struct sock		*sk;
1151da177e4SLinus Torvalds 	wait_queue_head_t	wait;
1161da177e4SLinus Torvalds 	short			type;
1171da177e4SLinus Torvalds };
1181da177e4SLinus Torvalds 
1191da177e4SLinus Torvalds struct vm_area_struct;
1201da177e4SLinus Torvalds struct page;
1211da177e4SLinus Torvalds struct kiocb;
1221da177e4SLinus Torvalds struct sockaddr;
1231da177e4SLinus Torvalds struct msghdr;
1241da177e4SLinus Torvalds struct module;
1251da177e4SLinus Torvalds 
1261da177e4SLinus Torvalds struct proto_ops {
1271da177e4SLinus Torvalds 	int		family;
1281da177e4SLinus Torvalds 	struct module	*owner;
1291da177e4SLinus Torvalds 	int		(*release)   (struct socket *sock);
1301da177e4SLinus Torvalds 	int		(*bind)	     (struct socket *sock,
1311da177e4SLinus Torvalds 				      struct sockaddr *myaddr,
1321da177e4SLinus Torvalds 				      int sockaddr_len);
1331da177e4SLinus Torvalds 	int		(*connect)   (struct socket *sock,
1341da177e4SLinus Torvalds 				      struct sockaddr *vaddr,
1351da177e4SLinus Torvalds 				      int sockaddr_len, int flags);
1361da177e4SLinus Torvalds 	int		(*socketpair)(struct socket *sock1,
1371da177e4SLinus Torvalds 				      struct socket *sock2);
1381da177e4SLinus Torvalds 	int		(*accept)    (struct socket *sock,
1391da177e4SLinus Torvalds 				      struct socket *newsock, int flags);
1401da177e4SLinus Torvalds 	int		(*getname)   (struct socket *sock,
1411da177e4SLinus Torvalds 				      struct sockaddr *addr,
1421da177e4SLinus Torvalds 				      int *sockaddr_len, int peer);
1431da177e4SLinus Torvalds 	unsigned int	(*poll)	     (struct file *file, struct socket *sock,
1441da177e4SLinus Torvalds 				      struct poll_table_struct *wait);
1451da177e4SLinus Torvalds 	int		(*ioctl)     (struct socket *sock, unsigned int cmd,
1461da177e4SLinus Torvalds 				      unsigned long arg);
14789bbfc95SShaun Pereira 	int	 	(*compat_ioctl) (struct socket *sock, unsigned int cmd,
14889bbfc95SShaun Pereira 				      unsigned long arg);
1491da177e4SLinus Torvalds 	int		(*listen)    (struct socket *sock, int len);
1501da177e4SLinus Torvalds 	int		(*shutdown)  (struct socket *sock, int flags);
1511da177e4SLinus Torvalds 	int		(*setsockopt)(struct socket *sock, int level,
1521da177e4SLinus Torvalds 				      int optname, char __user *optval, int optlen);
1531da177e4SLinus Torvalds 	int		(*getsockopt)(struct socket *sock, int level,
1541da177e4SLinus Torvalds 				      int optname, char __user *optval, int __user *optlen);
1553fdadf7dSDmitry Mishin 	int		(*compat_setsockopt)(struct socket *sock, int level,
1563fdadf7dSDmitry Mishin 				      int optname, char __user *optval, int optlen);
1573fdadf7dSDmitry Mishin 	int		(*compat_getsockopt)(struct socket *sock, int level,
1583fdadf7dSDmitry Mishin 				      int optname, char __user *optval, int __user *optlen);
1591da177e4SLinus Torvalds 	int		(*sendmsg)   (struct kiocb *iocb, struct socket *sock,
1601da177e4SLinus Torvalds 				      struct msghdr *m, size_t total_len);
1611da177e4SLinus Torvalds 	int		(*recvmsg)   (struct kiocb *iocb, struct socket *sock,
1621da177e4SLinus Torvalds 				      struct msghdr *m, size_t total_len,
1631da177e4SLinus Torvalds 				      int flags);
1641da177e4SLinus Torvalds 	int		(*mmap)	     (struct file *file, struct socket *sock,
1651da177e4SLinus Torvalds 				      struct vm_area_struct * vma);
1661da177e4SLinus Torvalds 	ssize_t		(*sendpage)  (struct socket *sock, struct page *page,
1671da177e4SLinus Torvalds 				      int offset, size_t size, int flags);
1681da177e4SLinus Torvalds };
1691da177e4SLinus Torvalds 
1701da177e4SLinus Torvalds struct net_proto_family {
1711da177e4SLinus Torvalds 	int		family;
1721da177e4SLinus Torvalds 	int		(*create)(struct socket *sock, int protocol);
1731da177e4SLinus Torvalds 	struct module	*owner;
1741da177e4SLinus Torvalds };
1751da177e4SLinus Torvalds 
1761da177e4SLinus Torvalds struct iovec;
1771da177e4SLinus Torvalds struct kvec;
1781da177e4SLinus Torvalds 
1791da177e4SLinus Torvalds extern int	     sock_wake_async(struct socket *sk, int how, int band);
180f0fd27d4SStephen Hemminger extern int	     sock_register(const struct net_proto_family *fam);
181f0fd27d4SStephen Hemminger extern void	     sock_unregister(int family);
1821da177e4SLinus Torvalds extern int	     sock_create(int family, int type, int proto,
1831da177e4SLinus Torvalds 				 struct socket **res);
1841da177e4SLinus Torvalds extern int	     sock_create_kern(int family, int type, int proto,
1851da177e4SLinus Torvalds 				      struct socket **res);
1861da177e4SLinus Torvalds extern int	     sock_create_lite(int family, int type, int proto,
1871da177e4SLinus Torvalds 				      struct socket **res);
1881da177e4SLinus Torvalds extern void	     sock_release(struct socket *sock);
1891da177e4SLinus Torvalds extern int   	     sock_sendmsg(struct socket *sock, struct msghdr *msg,
1901da177e4SLinus Torvalds 				  size_t len);
1911da177e4SLinus Torvalds extern int	     sock_recvmsg(struct socket *sock, struct msghdr *msg,
1921da177e4SLinus Torvalds 				  size_t size, int flags);
1931da177e4SLinus Torvalds extern int 	     sock_map_fd(struct socket *sock);
1941da177e4SLinus Torvalds extern struct socket *sockfd_lookup(int fd, int *err);
1951da177e4SLinus Torvalds #define		     sockfd_put(sock) fput(sock->file)
1961da177e4SLinus Torvalds extern int	     net_ratelimit(void);
197*aaa248f6SStephen Hemminger 
198*aaa248f6SStephen Hemminger #define net_random()		random32()
199*aaa248f6SStephen Hemminger #define net_srandom(seed)	srandom32(seed)
2001da177e4SLinus Torvalds 
2011da177e4SLinus Torvalds extern int   	     kernel_sendmsg(struct socket *sock, struct msghdr *msg,
2021da177e4SLinus Torvalds 				    struct kvec *vec, size_t num, size_t len);
2031da177e4SLinus Torvalds extern int   	     kernel_recvmsg(struct socket *sock, struct msghdr *msg,
2041da177e4SLinus Torvalds 				    struct kvec *vec, size_t num,
2051da177e4SLinus Torvalds 				    size_t len, int flags);
2061da177e4SLinus Torvalds 
207ac5a488eSSridhar Samudrala extern int kernel_bind(struct socket *sock, struct sockaddr *addr,
208ac5a488eSSridhar Samudrala 		       int addrlen);
209ac5a488eSSridhar Samudrala extern int kernel_listen(struct socket *sock, int backlog);
210ac5a488eSSridhar Samudrala extern int kernel_accept(struct socket *sock, struct socket **newsock,
211ac5a488eSSridhar Samudrala 			 int flags);
212ac5a488eSSridhar Samudrala extern int kernel_connect(struct socket *sock, struct sockaddr *addr,
213ac5a488eSSridhar Samudrala 			  int addrlen, int flags);
214ac5a488eSSridhar Samudrala extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr,
215ac5a488eSSridhar Samudrala 			      int *addrlen);
216ac5a488eSSridhar Samudrala extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
217ac5a488eSSridhar Samudrala 			      int *addrlen);
218ac5a488eSSridhar Samudrala extern int kernel_getsockopt(struct socket *sock, int level, int optname,
219ac5a488eSSridhar Samudrala 			     char *optval, int *optlen);
220ac5a488eSSridhar Samudrala extern int kernel_setsockopt(struct socket *sock, int level, int optname,
221ac5a488eSSridhar Samudrala 			     char *optval, int optlen);
222ac5a488eSSridhar Samudrala extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
223ac5a488eSSridhar Samudrala 			   size_t size, int flags);
224ac5a488eSSridhar Samudrala extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
225ac5a488eSSridhar Samudrala 
2261da177e4SLinus Torvalds #ifndef CONFIG_SMP
2271da177e4SLinus Torvalds #define SOCKOPS_WRAPPED(name) name
2281da177e4SLinus Torvalds #define SOCKOPS_WRAP(name, fam)
2291da177e4SLinus Torvalds #else
2301da177e4SLinus Torvalds 
2311da177e4SLinus Torvalds #define SOCKOPS_WRAPPED(name) __unlocked_##name
2321da177e4SLinus Torvalds 
2331da177e4SLinus Torvalds #define SOCKCALL_WRAP(name, call, parms, args)		\
2341da177e4SLinus Torvalds static int __lock_##name##_##call  parms		\
2351da177e4SLinus Torvalds {							\
2361da177e4SLinus Torvalds 	int ret;					\
2371da177e4SLinus Torvalds 	lock_kernel();					\
2381da177e4SLinus Torvalds 	ret = __unlocked_##name##_ops.call  args ;\
2391da177e4SLinus Torvalds 	unlock_kernel();				\
2401da177e4SLinus Torvalds 	return ret;					\
2411da177e4SLinus Torvalds }
2421da177e4SLinus Torvalds 
2431da177e4SLinus Torvalds #define SOCKCALL_UWRAP(name, call, parms, args)		\
2441da177e4SLinus Torvalds static unsigned int __lock_##name##_##call  parms	\
2451da177e4SLinus Torvalds {							\
2461da177e4SLinus Torvalds 	int ret;					\
2471da177e4SLinus Torvalds 	lock_kernel();					\
2481da177e4SLinus Torvalds 	ret = __unlocked_##name##_ops.call  args ;\
2491da177e4SLinus Torvalds 	unlock_kernel();				\
2501da177e4SLinus Torvalds 	return ret;					\
2511da177e4SLinus Torvalds }
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds 
2541da177e4SLinus Torvalds #define SOCKOPS_WRAP(name, fam)					\
2551da177e4SLinus Torvalds SOCKCALL_WRAP(name, release, (struct socket *sock), (sock))	\
2561da177e4SLinus Torvalds SOCKCALL_WRAP(name, bind, (struct socket *sock, struct sockaddr *uaddr, int addr_len), \
2571da177e4SLinus Torvalds 	      (sock, uaddr, addr_len))				\
2581da177e4SLinus Torvalds SOCKCALL_WRAP(name, connect, (struct socket *sock, struct sockaddr * uaddr, \
2591da177e4SLinus Torvalds 			      int addr_len, int flags), 	\
2601da177e4SLinus Torvalds 	      (sock, uaddr, addr_len, flags))			\
2611da177e4SLinus Torvalds SOCKCALL_WRAP(name, socketpair, (struct socket *sock1, struct socket *sock2), \
2621da177e4SLinus Torvalds 	      (sock1, sock2))					\
2631da177e4SLinus Torvalds SOCKCALL_WRAP(name, accept, (struct socket *sock, struct socket *newsock, \
2641da177e4SLinus Torvalds 			 int flags), (sock, newsock, flags)) \
2651da177e4SLinus Torvalds SOCKCALL_WRAP(name, getname, (struct socket *sock, struct sockaddr *uaddr, \
2661da177e4SLinus Torvalds 			 int *addr_len, int peer), (sock, uaddr, addr_len, peer)) \
2671da177e4SLinus Torvalds SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_table_struct *wait), \
2681da177e4SLinus Torvalds 	      (file, sock, wait)) \
2691da177e4SLinus Torvalds SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
2701da177e4SLinus Torvalds 			 unsigned long arg), (sock, cmd, arg)) \
27189bbfc95SShaun Pereira SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
27289bbfc95SShaun Pereira 			 unsigned long arg), (sock, cmd, arg)) \
2731da177e4SLinus Torvalds SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
2741da177e4SLinus Torvalds SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
2751da177e4SLinus Torvalds SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
2761da177e4SLinus Torvalds 			 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \
2771da177e4SLinus Torvalds SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
2781da177e4SLinus Torvalds 			 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
2791da177e4SLinus Torvalds SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
2801da177e4SLinus Torvalds 	      (iocb, sock, m, len)) \
2811da177e4SLinus Torvalds SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags), \
2821da177e4SLinus Torvalds 	      (iocb, sock, m, len, flags)) \
2831da177e4SLinus Torvalds SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
2841da177e4SLinus Torvalds 	      (file, sock, vma)) \
2851da177e4SLinus Torvalds 	      \
28690ddc4f0SEric Dumazet static const struct proto_ops name##_ops = {			\
2871da177e4SLinus Torvalds 	.family		= fam,				\
2881da177e4SLinus Torvalds 	.owner		= THIS_MODULE,			\
2891da177e4SLinus Torvalds 	.release	= __lock_##name##_release,	\
2901da177e4SLinus Torvalds 	.bind		= __lock_##name##_bind,		\
2911da177e4SLinus Torvalds 	.connect	= __lock_##name##_connect,	\
2921da177e4SLinus Torvalds 	.socketpair	= __lock_##name##_socketpair,	\
2931da177e4SLinus Torvalds 	.accept		= __lock_##name##_accept,	\
2941da177e4SLinus Torvalds 	.getname	= __lock_##name##_getname,	\
2951da177e4SLinus Torvalds 	.poll		= __lock_##name##_poll,		\
2961da177e4SLinus Torvalds 	.ioctl		= __lock_##name##_ioctl,	\
29789bbfc95SShaun Pereira 	.compat_ioctl	= __lock_##name##_compat_ioctl,	\
2981da177e4SLinus Torvalds 	.listen		= __lock_##name##_listen,	\
2991da177e4SLinus Torvalds 	.shutdown	= __lock_##name##_shutdown,	\
3001da177e4SLinus Torvalds 	.setsockopt	= __lock_##name##_setsockopt,	\
3011da177e4SLinus Torvalds 	.getsockopt	= __lock_##name##_getsockopt,	\
3021da177e4SLinus Torvalds 	.sendmsg	= __lock_##name##_sendmsg,	\
3031da177e4SLinus Torvalds 	.recvmsg	= __lock_##name##_recvmsg,	\
3041da177e4SLinus Torvalds 	.mmap		= __lock_##name##_mmap,		\
3051da177e4SLinus Torvalds };
30689bbfc95SShaun Pereira 
3071da177e4SLinus Torvalds #endif
3081da177e4SLinus Torvalds 
3091da177e4SLinus Torvalds #define MODULE_ALIAS_NETPROTO(proto) \
3101da177e4SLinus Torvalds 	MODULE_ALIAS("net-pf-" __stringify(proto))
3111da177e4SLinus Torvalds 
3124fdb3bb7SHarald Welte #define MODULE_ALIAS_NET_PF_PROTO(pf, proto) \
3134fdb3bb7SHarald Welte 	MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto))
3144fdb3bb7SHarald Welte 
31520380731SArnaldo Carvalho de Melo #ifdef CONFIG_SYSCTL
31620380731SArnaldo Carvalho de Melo #include <linux/sysctl.h>
31720380731SArnaldo Carvalho de Melo extern ctl_table net_table[];
31820380731SArnaldo Carvalho de Melo extern int net_msg_cost;
31920380731SArnaldo Carvalho de Melo extern int net_msg_burst;
32020380731SArnaldo Carvalho de Melo #endif
32120380731SArnaldo Carvalho de Melo 
3221da177e4SLinus Torvalds #endif /* __KERNEL__ */
3231da177e4SLinus Torvalds #endif	/* _LINUX_NET_H */
324