1/*
2 * Copyright: (c) 2000 United States Government as represented by the
3 *	Secretary of the Navy. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 *   1. Redistributions of source code must retain the above copyright
10 *      notice, this list of conditions and the following disclaimer.
11 *   2. Redistributions in binary form must reproduce the above copyright
12 *      notice, this list of conditions and the following disclaimer in
13 *      the documentation and/or other materials provided with the
14 *      distribution.
15 *   3. The names of the authors may not be used to endorse or promote
16 *      products derived from this software without specific prior
17 *      written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 */
23/*
24 * Rx protocol format
25 *
26 * $Id: rx.h,v 1.8 2002-12-11 07:14:11 guy Exp $
27 */
28
29#define FS_RX_PORT	7000
30#define CB_RX_PORT	7001
31#define PROT_RX_PORT	7002
32#define VLDB_RX_PORT	7003
33#define KAUTH_RX_PORT	7004
34#define VOL_RX_PORT	7005
35#define ERROR_RX_PORT	7006		/* Doesn't seem to be used */
36#define BOS_RX_PORT	7007
37
38#ifndef AFSNAMEMAX
39#define AFSNAMEMAX 256
40#endif
41
42#ifndef AFSOPAQUEMAX
43#define AFSOPAQUEMAX 1024
44#endif
45
46#define PRNAMEMAX 64
47#define VLNAMEMAX 65
48#define KANAMEMAX 64
49#define BOSNAMEMAX 256
50
51#define	PRSFS_READ		1 /* Read files */
52#define	PRSFS_WRITE		2 /* Write files */
53#define	PRSFS_INSERT		4 /* Insert files into a directory */
54#define	PRSFS_LOOKUP		8 /* Lookup files into a directory */
55#define	PRSFS_DELETE		16 /* Delete files */
56#define	PRSFS_LOCK		32 /* Lock files */
57#define	PRSFS_ADMINISTER	64 /* Change ACL's */
58
59struct rx_header {
60	u_int32_t epoch;
61	u_int32_t cid;
62	u_int32_t callNumber;
63	u_int32_t seq;
64	u_int32_t serial;
65	u_int8_t type;
66#define RX_PACKET_TYPE_DATA		1
67#define RX_PACKET_TYPE_ACK		2
68#define RX_PACKET_TYPE_BUSY		3
69#define RX_PACKET_TYPE_ABORT		4
70#define RX_PACKET_TYPE_ACKALL		5
71#define RX_PACKET_TYPE_CHALLENGE	6
72#define RX_PACKET_TYPE_RESPONSE		7
73#define RX_PACKET_TYPE_DEBUG		8
74#define RX_PACKET_TYPE_PARAMS		9
75#define RX_PACKET_TYPE_VERSION		13
76	u_int8_t flags;
77#define RX_CLIENT_INITIATED	1
78#define RX_REQUEST_ACK		2
79#define RX_LAST_PACKET		4
80#define RX_MORE_PACKETS		8
81#define RX_FREE_PACKET		16
82#define RX_SLOW_START_OK	32
83#define RX_JUMBO_PACKET		32
84	u_int8_t userStatus;
85	u_int8_t securityIndex;
86	u_int16_t spare;		/* How clever: even though the AFS */
87	u_int16_t serviceId;		/* header files indicate that the */
88};					/* serviceId is first, it's really */
89					/* encoded _after_ the spare field */
90					/* I wasted a day figuring that out! */
91
92#define NUM_RX_FLAGS 7
93
94#define RX_MAXACKS 255
95
96struct rx_ackPacket {
97	u_int16_t bufferSpace;		/* Number of packet buffers available */
98	u_int16_t maxSkew;		/* Max diff between ack'd packet and */
99					/* highest packet received */
100	u_int32_t firstPacket;		/* The first packet in ack list */
101	u_int32_t previousPacket;	/* Previous packet recv'd (obsolete) */
102	u_int32_t serial;		/* # of packet that prompted the ack */
103	u_int8_t reason;		/* Reason for acknowledgement */
104	u_int8_t nAcks;			/* Number of acknowledgements */
105	u_int8_t acks[RX_MAXACKS];	/* Up to RX_MAXACKS acknowledgements */
106};
107
108/*
109 * Values for the acks array
110 */
111
112#define RX_ACK_TYPE_NACK	0	/* Don't have this packet */
113#define RX_ACK_TYPE_ACK		1	/* I have this packet */
114