aboutsummaryrefslogtreecommitdiffstats
path: root/include/rxrpc/packet.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/rxrpc/packet.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/rxrpc/packet.h')
-rw-r--r--include/rxrpc/packet.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
new file mode 100644
index 000000000000..1447f0aaa0eb
--- /dev/null
+++ b/include/rxrpc/packet.h
@@ -0,0 +1,127 @@
1/* packet.h: Rx packet layout and definitions
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@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 License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_PACKET_H
13#define _LINUX_RXRPC_PACKET_H
14
15#include <rxrpc/types.h>
16
17#define RXRPC_IPUDP_SIZE 28
18extern size_t RXRPC_MAX_PACKET_SIZE;
19#define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header))
20#define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE
21#define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE)
22
23/*****************************************************************************/
24/*
25 * on-the-wire Rx packet header
26 * - all multibyte fields should be in network byte order
27 */
28struct rxrpc_header
29{
30 __be32 epoch; /* client boot timestamp */
31
32 __be32 cid; /* connection and channel ID */
33#define RXRPC_MAXCALLS 4 /* max active calls per conn */
34#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
35#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
36#define RXRPC_CIDSHIFT 2 /* shift for connection ID */
37
38 __be32 callNumber; /* call ID (0 for connection-level packets) */
39#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
40
41 __be32 seq; /* sequence number of pkt in call stream */
42 __be32 serial; /* serial number of pkt sent to network */
43
44 uint8_t type; /* packet type */
45#define RXRPC_PACKET_TYPE_DATA 1 /* data */
46#define RXRPC_PACKET_TYPE_ACK 2 /* ACK */
47#define RXRPC_PACKET_TYPE_BUSY 3 /* call reject */
48#define RXRPC_PACKET_TYPE_ABORT 4 /* call/connection abort */
49#define RXRPC_PACKET_TYPE_ACKALL 5 /* ACK all outstanding packets on call */
50#define RXRPC_PACKET_TYPE_CHALLENGE 6 /* connection security challenge (SRVR->CLNT) */
51#define RXRPC_PACKET_TYPE_RESPONSE 7 /* connection secutity response (CLNT->SRVR) */
52#define RXRPC_PACKET_TYPE_DEBUG 8 /* debug info request */
53#define RXRPC_N_PACKET_TYPES 9 /* number of packet types (incl type 0) */
54
55 uint8_t flags; /* packet flags */
56#define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */
57#define RXRPC_REQUEST_ACK 0x02 /* request an unconditional ACK of this packet */
58#define RXRPC_LAST_PACKET 0x04 /* the last packet from this side for this call */
59#define RXRPC_MORE_PACKETS 0x08 /* more packets to come */
60#define RXRPC_JUMBO_PACKET 0x20 /* [DATA] this is a jumbo packet */
61#define RXRPC_SLOW_START_OK 0x20 /* [ACK] slow start supported */
62
63 uint8_t userStatus; /* app-layer defined status */
64 uint8_t securityIndex; /* security protocol ID */
65 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */
66 __be16 serviceId; /* service ID */
67
68} __attribute__((packed));
69
70#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X)
71
72extern const char *rxrpc_pkts[];
73
74/*****************************************************************************/
75/*
76 * jumbo packet secondary header
77 * - can be mapped to read header by:
78 * - new_serial = serial + 1
79 * - new_seq = seq + 1
80 * - new_flags = j_flags
81 * - new__rsvd = j__rsvd
82 * - duplicating all other fields
83 */
84struct rxrpc_jumbo_header
85{
86 uint8_t flags; /* packet flags (as per rxrpc_header) */
87 uint8_t pad;
88 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */
89};
90
91#define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */
92
93/*****************************************************************************/
94/*
95 * on-the-wire Rx ACK packet data payload
96 * - all multibyte fields should be in network byte order
97 */
98struct rxrpc_ackpacket
99{
100 __be16 bufferSpace; /* number of packet buffers available */
101 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no
102 * received */
103 __be32 firstPacket; /* sequence no of first ACK'd packet in attached list */
104 __be32 previousPacket; /* sequence no of previous packet received */
105 __be32 serial; /* serial no of packet that prompted this ACK */
106
107 uint8_t reason; /* reason for ACK */
108#define RXRPC_ACK_REQUESTED 1 /* ACK was requested on packet */
109#define RXRPC_ACK_DUPLICATE 2 /* duplicate packet received */
110#define RXRPC_ACK_OUT_OF_SEQUENCE 3 /* out of sequence packet received */
111#define RXRPC_ACK_EXCEEDS_WINDOW 4 /* packet received beyond end of ACK window */
112#define RXRPC_ACK_NOSPACE 5 /* packet discarded due to lack of buffer space */
113#define RXRPC_ACK_PING 6 /* keep alive ACK */
114#define RXRPC_ACK_PING_RESPONSE 7 /* response to RXRPC_ACK_PING */
115#define RXRPC_ACK_DELAY 8 /* nothing happened since received packet */
116#define RXRPC_ACK_IDLE 9 /* ACK due to fully received ACK window */
117
118 uint8_t nAcks; /* number of ACKs */
119#define RXRPC_MAXACKS 255
120
121 uint8_t acks[0]; /* list of ACK/NAKs */
122#define RXRPC_ACK_TYPE_NACK 0
123#define RXRPC_ACK_TYPE_ACK 1
124
125} __attribute__((packed));
126
127#endif /* _LINUX_RXRPC_PACKET_H */