1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 2 /* packet.h: Rx packet layout and definitions 3 * 4 * Copyright (C) 2002, 2007 Red Hat, Inc. All 5 * Written by David Howells (dhowells@redhat.c 6 */ 7 8 #ifndef _LINUX_RXRPC_PACKET_H 9 #define _LINUX_RXRPC_PACKET_H 10 11 typedef u32 rxrpc_seq_t; /* Rx message 12 typedef u32 rxrpc_serial_t; /* Rx message 13 typedef __be32 rxrpc_seq_net_t; /* on-the-wir 14 typedef __be32 rxrpc_serial_net_t; /* on-the- 15 16 /********************************************* 17 /* 18 * on-the-wire Rx packet header 19 * - all multibyte fields should be in network 20 */ 21 struct rxrpc_wire_header { 22 __be32 epoch; /* cli 23 #define RXRPC_RANDOM_EPOCH 0x80000000 24 25 __be32 cid; /* con 26 #define RXRPC_MAXCALLS 4 27 #define RXRPC_CHANNELMASK (RXRPC_MAXCALL 28 #define RXRPC_CIDMASK (~RXRPC_CHANNE 29 #define RXRPC_CIDSHIFT ilog2(RXRPC_MA 30 #define RXRPC_CID_INC (1 << RXRPC_CI 31 32 __be32 callNumber; /* cal 33 __be32 seq; /* seq 34 __be32 serial; /* ser 35 36 uint8_t type; /* pac 37 #define RXRPC_PACKET_TYPE_DATA 1 38 #define RXRPC_PACKET_TYPE_ACK 2 39 #define RXRPC_PACKET_TYPE_BUSY 3 40 #define RXRPC_PACKET_TYPE_ABORT 4 41 #define RXRPC_PACKET_TYPE_ACKALL 5 42 #define RXRPC_PACKET_TYPE_CHALLENGE 6 43 #define RXRPC_PACKET_TYPE_RESPONSE 7 44 #define RXRPC_PACKET_TYPE_DEBUG 8 45 #define RXRPC_PACKET_TYPE_PARAMS 9 46 #define RXRPC_PACKET_TYPE_10 10 47 #define RXRPC_PACKET_TYPE_11 11 48 #define RXRPC_PACKET_TYPE_VERSION 13 49 50 uint8_t flags; /* pac 51 #define RXRPC_CLIENT_INITIATED 0x01 52 #define RXRPC_REQUEST_ACK 0x02 53 #define RXRPC_LAST_PACKET 0x04 54 #define RXRPC_MORE_PACKETS 0x08 55 #define RXRPC_JUMBO_PACKET 0x20 56 #define RXRPC_SLOW_START_OK 0x20 57 58 uint8_t userStatus; /* app 59 #define RXRPC_USERSTATUS_SERVICE_UPGRADE 0x01 60 61 uint8_t securityIndex; /* sec 62 union { 63 __be16 _rsvd; /* res 64 __be16 cksum; /* ker 65 }; 66 __be16 serviceId; /* ser 67 68 } __packed; 69 70 /********************************************* 71 /* 72 * jumbo packet secondary header 73 * - can be mapped to read header by: 74 * - new_serial = serial + 1 75 * - new_seq = seq + 1 76 * - new_flags = j_flags 77 * - new__rsvd = j__rsvd 78 * - duplicating all other fields 79 */ 80 struct rxrpc_jumbo_header { 81 uint8_t flags; /* pac 82 uint8_t pad; 83 union { 84 __be16 _rsvd; /* res 85 __be16 cksum; /* ker 86 }; 87 } __packed; 88 89 #define RXRPC_JUMBO_DATALEN 1412 /* non 90 #define RXRPC_JUMBO_SUBPKTLEN (RXRPC_JUMBO_D 91 92 /* 93 * The maximum number of subpackets that can p 94 * 95 * ((max_IP - IP_hdr - UDP_hdr) / RXRPC_J 96 * = ((65535 - 28 - 28) / 1416) + 1 97 * = 46 non-terminal packets and 1 termin 98 */ 99 #define RXRPC_MAX_NR_JUMBO 47 100 101 /********************************************* 102 /* 103 * on-the-wire Rx ACK packet data payload 104 * - all multibyte fields should be in network 105 */ 106 struct rxrpc_ackpacket { 107 __be16 bufferSpace; /* num 108 __be16 maxSkew; /* dif 109 * rec 110 __be32 firstPacket; /* seq 111 __be32 previousPacket; /* seq 112 __be32 serial; /* ser 113 114 uint8_t reason; /* rea 115 #define RXRPC_ACK_REQUESTED 1 116 #define RXRPC_ACK_DUPLICATE 2 117 #define RXRPC_ACK_OUT_OF_SEQUENCE 3 118 #define RXRPC_ACK_EXCEEDS_WINDOW 4 119 #define RXRPC_ACK_NOSPACE 5 120 #define RXRPC_ACK_PING 6 121 #define RXRPC_ACK_PING_RESPONSE 7 122 #define RXRPC_ACK_DELAY 8 123 #define RXRPC_ACK_IDLE 9 124 #define RXRPC_ACK__INVALID 10 125 126 uint8_t nAcks; /* num 127 #define RXRPC_MAXACKS 255 128 129 uint8_t acks[]; /* lis 130 #define RXRPC_ACK_TYPE_NACK 0 131 #define RXRPC_ACK_TYPE_ACK 1 132 133 } __packed; 134 135 /* 136 * ACK packets can have a further piece of inf 137 */ 138 struct rxrpc_acktrailer { 139 __be32 maxMTU; /* max 140 __be32 ifMTU; /* max 141 __be32 rwind; /* Rx 142 __be32 jumbo_max; /* max 143 }; 144 145 /********************************************* 146 /* 147 * Kerberos security type-2 challenge packet 148 */ 149 struct rxkad_challenge { 150 __be32 version; /* ver 151 __be32 nonce; /* enc 152 __be32 min_level; /* min 153 __be32 __padding; /* pad 154 } __packed; 155 156 /********************************************* 157 /* 158 * Kerberos security type-2 response packet 159 */ 160 struct rxkad_response { 161 __be32 version; /* ver 162 __be32 __pad; 163 164 /* encrypted bit of the response */ 165 struct { 166 __be32 epoch; 167 __be32 cid; 168 __be32 checksum; 169 __be32 securityIndex; 170 __be32 call_id[4]; 171 __be32 inc_nonce; 172 __be32 level; 173 } encrypted; 174 175 __be32 kvno; /* Ker 176 __be32 ticket_len; /* Ker 177 } __packed; 178 179 #endif /* _LINUX_RXRPC_PACKET_H */ 180
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.