xref: /OK3568_Linux_fs/kernel/include/uapi/linux/rxrpc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
2*4882a593Smuzhiyun /* Types and definitions for AF_RXRPC.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5*4882a593Smuzhiyun  * Written by David Howells (dhowells@redhat.com)
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef _UAPI_LINUX_RXRPC_H
9*4882a593Smuzhiyun #define _UAPI_LINUX_RXRPC_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <linux/types.h>
12*4882a593Smuzhiyun #include <linux/in.h>
13*4882a593Smuzhiyun #include <linux/in6.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /*
16*4882a593Smuzhiyun  * RxRPC socket address
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun struct sockaddr_rxrpc {
19*4882a593Smuzhiyun 	__kernel_sa_family_t	srx_family;	/* address family */
20*4882a593Smuzhiyun 	__u16			srx_service;	/* service desired */
21*4882a593Smuzhiyun 	__u16			transport_type;	/* type of transport socket (SOCK_DGRAM) */
22*4882a593Smuzhiyun 	__u16			transport_len;	/* length of transport address */
23*4882a593Smuzhiyun 	union {
24*4882a593Smuzhiyun 		__kernel_sa_family_t family;	/* transport address family */
25*4882a593Smuzhiyun 		struct sockaddr_in sin;		/* IPv4 transport address */
26*4882a593Smuzhiyun 		struct sockaddr_in6 sin6;	/* IPv6 transport address */
27*4882a593Smuzhiyun 	} transport;
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /*
31*4882a593Smuzhiyun  * RxRPC socket options
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun #define RXRPC_SECURITY_KEY		1	/* [clnt] set client security key */
34*4882a593Smuzhiyun #define RXRPC_SECURITY_KEYRING		2	/* [srvr] set ring of server security keys */
35*4882a593Smuzhiyun #define RXRPC_EXCLUSIVE_CONNECTION	3	/* Deprecated; use RXRPC_EXCLUSIVE_CALL instead */
36*4882a593Smuzhiyun #define RXRPC_MIN_SECURITY_LEVEL	4	/* minimum security level */
37*4882a593Smuzhiyun #define RXRPC_UPGRADEABLE_SERVICE	5	/* Upgrade service[0] -> service[1] */
38*4882a593Smuzhiyun #define RXRPC_SUPPORTED_CMSG		6	/* Get highest supported control message type */
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun /*
41*4882a593Smuzhiyun  * RxRPC control messages
42*4882a593Smuzhiyun  * - If neither abort or accept are specified, the message is a data message.
43*4882a593Smuzhiyun  * - terminal messages mean that a user call ID tag can be recycled
44*4882a593Smuzhiyun  * - s/r/- indicate whether these are applicable to sendmsg() and/or recvmsg()
45*4882a593Smuzhiyun  */
46*4882a593Smuzhiyun enum rxrpc_cmsg_type {
47*4882a593Smuzhiyun 	RXRPC_USER_CALL_ID	= 1,	/* sr: user call ID specifier */
48*4882a593Smuzhiyun 	RXRPC_ABORT		= 2,	/* sr: abort request / notification [terminal] */
49*4882a593Smuzhiyun 	RXRPC_ACK		= 3,	/* -r: [Service] RPC op final ACK received [terminal] */
50*4882a593Smuzhiyun 	RXRPC_NET_ERROR		= 5,	/* -r: network error received [terminal] */
51*4882a593Smuzhiyun 	RXRPC_BUSY		= 6,	/* -r: server busy received [terminal] */
52*4882a593Smuzhiyun 	RXRPC_LOCAL_ERROR	= 7,	/* -r: local error generated [terminal] */
53*4882a593Smuzhiyun 	RXRPC_NEW_CALL		= 8,	/* -r: [Service] new incoming call notification */
54*4882a593Smuzhiyun 	RXRPC_EXCLUSIVE_CALL	= 10,	/* s-: Call should be on exclusive connection */
55*4882a593Smuzhiyun 	RXRPC_UPGRADE_SERVICE	= 11,	/* s-: Request service upgrade for client call */
56*4882a593Smuzhiyun 	RXRPC_TX_LENGTH		= 12,	/* s-: Total length of Tx data */
57*4882a593Smuzhiyun 	RXRPC_SET_CALL_TIMEOUT	= 13,	/* s-: Set one or more call timeouts */
58*4882a593Smuzhiyun 	RXRPC_CHARGE_ACCEPT	= 14,	/* s-: Charge the accept pool with a user call ID */
59*4882a593Smuzhiyun 	RXRPC__SUPPORTED
60*4882a593Smuzhiyun };
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun /*
63*4882a593Smuzhiyun  * RxRPC security levels
64*4882a593Smuzhiyun  */
65*4882a593Smuzhiyun #define RXRPC_SECURITY_PLAIN	0	/* plain secure-checksummed packets only */
66*4882a593Smuzhiyun #define RXRPC_SECURITY_AUTH	1	/* authenticated packets */
67*4882a593Smuzhiyun #define RXRPC_SECURITY_ENCRYPT	2	/* encrypted packets */
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /*
70*4882a593Smuzhiyun  * RxRPC security indices
71*4882a593Smuzhiyun  */
72*4882a593Smuzhiyun #define RXRPC_SECURITY_NONE	0	/* no security protocol */
73*4882a593Smuzhiyun #define RXRPC_SECURITY_RXKAD	2	/* kaserver or kerberos 4 */
74*4882a593Smuzhiyun #define RXRPC_SECURITY_RXGK	4	/* gssapi-based */
75*4882a593Smuzhiyun #define RXRPC_SECURITY_RXK5	5	/* kerberos 5 */
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun /*
78*4882a593Smuzhiyun  * RxRPC-level abort codes
79*4882a593Smuzhiyun  */
80*4882a593Smuzhiyun #define RX_CALL_DEAD		-1	/* call/conn has been inactive and is shut down */
81*4882a593Smuzhiyun #define RX_INVALID_OPERATION	-2	/* invalid operation requested / attempted */
82*4882a593Smuzhiyun #define RX_CALL_TIMEOUT		-3	/* call timeout exceeded */
83*4882a593Smuzhiyun #define RX_EOF			-4	/* unexpected end of data on read op */
84*4882a593Smuzhiyun #define RX_PROTOCOL_ERROR	-5	/* low-level protocol error */
85*4882a593Smuzhiyun #define RX_USER_ABORT		-6	/* generic user abort */
86*4882a593Smuzhiyun #define RX_ADDRINUSE		-7	/* UDP port in use */
87*4882a593Smuzhiyun #define RX_DEBUGI_BADTYPE	-8	/* bad debugging packet type */
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun /*
90*4882a593Smuzhiyun  * (un)marshalling abort codes (rxgen)
91*4882a593Smuzhiyun  */
92*4882a593Smuzhiyun #define RXGEN_CC_MARSHAL	-450
93*4882a593Smuzhiyun #define RXGEN_CC_UNMARSHAL	-451
94*4882a593Smuzhiyun #define RXGEN_SS_MARSHAL	-452
95*4882a593Smuzhiyun #define RXGEN_SS_UNMARSHAL	-453
96*4882a593Smuzhiyun #define RXGEN_DECODE		-454
97*4882a593Smuzhiyun #define RXGEN_OPCODE		-455
98*4882a593Smuzhiyun #define RXGEN_SS_XDRFREE	-456
99*4882a593Smuzhiyun #define RXGEN_CC_XDRFREE	-457
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun /*
102*4882a593Smuzhiyun  * Rx kerberos security abort codes
103*4882a593Smuzhiyun  * - unfortunately we have no generalised security abort codes to say things
104*4882a593Smuzhiyun  *   like "unsupported security", so we have to use these instead and hope the
105*4882a593Smuzhiyun  *   other side understands
106*4882a593Smuzhiyun  */
107*4882a593Smuzhiyun #define RXKADINCONSISTENCY	19270400	/* security module structure inconsistent */
108*4882a593Smuzhiyun #define RXKADPACKETSHORT	19270401	/* packet too short for security challenge */
109*4882a593Smuzhiyun #define RXKADLEVELFAIL		19270402	/* security level negotiation failed */
110*4882a593Smuzhiyun #define RXKADTICKETLEN		19270403	/* ticket length too short or too long */
111*4882a593Smuzhiyun #define RXKADOUTOFSEQUENCE	19270404	/* packet had bad sequence number */
112*4882a593Smuzhiyun #define RXKADNOAUTH		19270405	/* caller not authorised */
113*4882a593Smuzhiyun #define RXKADBADKEY		19270406	/* illegal key: bad parity or weak */
114*4882a593Smuzhiyun #define RXKADBADTICKET		19270407	/* security object was passed a bad ticket */
115*4882a593Smuzhiyun #define RXKADUNKNOWNKEY		19270408	/* ticket contained unknown key version number */
116*4882a593Smuzhiyun #define RXKADEXPIRED		19270409	/* authentication expired */
117*4882a593Smuzhiyun #define RXKADSEALEDINCON	19270410	/* sealed data inconsistent */
118*4882a593Smuzhiyun #define RXKADDATALEN		19270411	/* user data too long */
119*4882a593Smuzhiyun #define RXKADILLEGALLEVEL	19270412	/* caller not authorised to use encrypted conns */
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun #endif /* _UAPI_LINUX_RXRPC_H */
122