• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  linux/include/linux/sunrpc/xprtsock.h
3  *
4  *  Declarations for the RPC transport socket provider.
5  */
6 
7 #ifndef _LINUX_SUNRPC_XPRTSOCK_H
8 #define _LINUX_SUNRPC_XPRTSOCK_H
9 
10 #ifdef __KERNEL__
11 
12 int		init_socket_xprt(void);
13 void		cleanup_socket_xprt(void);
14 
15 #define RPC_MIN_RESVPORT	(1U)
16 #define RPC_MAX_RESVPORT	(65535U)
17 #define RPC_DEF_MIN_RESVPORT	(665U)
18 #define RPC_DEF_MAX_RESVPORT	(1023U)
19 
20 struct sock_xprt {
21 	struct rpc_xprt		xprt;
22 
23 	/*
24 	 * Network layer
25 	 */
26 	struct socket *		sock;
27 	struct sock *		inet;
28 
29 	/*
30 	 * State of TCP reply receive
31 	 */
32 	__be32			tcp_fraghdr,
33 				tcp_xid,
34 				tcp_calldir;
35 
36 	u32			tcp_offset,
37 				tcp_reclen;
38 
39 	unsigned long		tcp_copied,
40 				tcp_flags;
41 
42 	/*
43 	 * Connection of transports
44 	 */
45 	unsigned long		sock_state;
46 	struct delayed_work	connect_worker;
47 	struct work_struct	recv_worker;
48 	struct mutex		recv_mutex;
49 	struct sockaddr_storage	srcaddr;
50 	unsigned short		srcport;
51 
52 	/*
53 	 * UDP socket buffer size parameters
54 	 */
55 	size_t			rcvsize,
56 				sndsize;
57 
58 	/*
59 	 * Saved socket callback addresses
60 	 */
61 	void			(*old_data_ready)(struct sock *);
62 	void			(*old_state_change)(struct sock *);
63 	void			(*old_write_space)(struct sock *);
64 	void			(*old_error_report)(struct sock *);
65 };
66 
67 /*
68  * TCP receive state flags
69  */
70 #define TCP_RCV_LAST_FRAG	(1UL << 0)
71 #define TCP_RCV_COPY_FRAGHDR	(1UL << 1)
72 #define TCP_RCV_COPY_XID	(1UL << 2)
73 #define TCP_RCV_COPY_DATA	(1UL << 3)
74 #define TCP_RCV_READ_CALLDIR	(1UL << 4)
75 #define TCP_RCV_COPY_CALLDIR	(1UL << 5)
76 
77 /*
78  * TCP RPC flags
79  */
80 #define TCP_RPC_REPLY		(1UL << 6)
81 
82 #define XPRT_SOCK_CONNECTING	1U
83 #define XPRT_SOCK_DATA_READY	(2)
84 
85 #endif /* __KERNEL__ */
86 
87 #endif /* _LINUX_SUNRPC_XPRTSOCK_H */
88