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