📄 rx.h
字号:
* SIZEs become set-once variables. */
/* REMOTE_PACKET_SIZE is currently the same as local. This is because REMOTE
* is defined much too generally for my tastes, and includes the case of
* multiple class C nets connected with a router within one campus or MAN.
* I don't want to make local performance suffer just because of some
* out-dated protocol that used to be in use on the NSFANET that's
* practically unused anymore. Any modern IP implementation will be
* using MTU discovery, and even old routers shouldn't frag packets
* when sending from one connected network directly to another. Maybe
* the next release of RX will do MTU discovery.
*/
#if 0
#define RX_MAX_DL_MTU 4352 /* what FDDI(RFC1188) uses... Larger? */
#define RX_MAX_DL_MTU 17914 /* what IBM 16MB TR uses */
#define RX_MAX_DL_MTU 8166 /* IEEE 802.4 */
#define RX_MAX_DL_MTU 4464 /* IEEE 802.5 MAX */
#define RX_MAX_DL_MTU 2002 /* IEEE 802.5 Recommended */
#endif
#define RX_MAX_DL_MTU 1500 /* what Ethernet uses */
#define RX_MAX_PACKET_SIZE (RX_MAX_DL_MTU -RX_IPUDP_SIZE)
#define RX_HEADER_SIZE sizeof(struct rx_header) /* Size of rx header */
#define RX_MAX_PACKET_DATA_SIZE (RX_MAX_PACKET_SIZE-RX_HEADER_SIZE)
#ifdef AFS_HPUX_ENV
#define RX_LOCAL_PACKET_SIZE (1497 - RX_IPUDP_SIZE)
#define RX_REMOTE_PACKET_SIZE (1497 - RX_IPUDP_SIZE)
#else
#define RX_LOCAL_PACKET_SIZE RX_MAX_PACKET_SIZE /* For hosts on same net */
#define RX_REMOTE_PACKET_SIZE RX_MAX_PACKET_SIZE /* see note above */
#endif
#if 0
#define RX_REMOTE_PACKET_SIZE (576-RX_IPUDP_SIZE) /* For Internet hosts */
#endif
#define RX_PP_PACKET_SIZE 576 /* tolerable SLIP */
#define RX_MINIMUM_PACKET_SIZE (200-RX_IPUDP_SIZE)
/* Packet types, for rx_packet.type
*/
#define RX_PACKET_TYPE_DATA 1 /* A vanilla data packet */
#define RX_PACKET_TYPE_ACK 2 /* Acknowledge packet */
#define RX_PACKET_TYPE_BUSY 3 /* Busy: can't accept call immediately; try later */
#define RX_PACKET_TYPE_ABORT 4 /* Abort packet. No response needed. */
#define RX_PACKET_TYPE_ACKALL 5 /* Acknowledges receipt of all packets */
#define RX_PACKET_TYPE_CHALLENGE 6 /* Challenge client's identity: request credentials */
#define RX_PACKET_TYPE_RESPONSE 7 /* Respond to challenge packet */
#define RX_PACKET_TYPE_DEBUG 8 /* Get debug information */
#define RX_PACKET_TYPE_PARAMS 9 /* exchange size params (showUmine) */
#define RX_PACKET_TYPES { "data", "ack ", "busy", "abort", "ackall", \
"challenge", "response", "debug", "params" }
#define RX_N_PACKET_TYPES 10 /* Must agree with above list; counts 0 */
/* Packet classes, for rx_AllocPacket
*/
#define RX_PACKET_CLASS_RECEIVE 0
#define RX_PACKET_CLASS_SEND 1
#define RX_PACKET_CLASS_SPECIAL 2
#define RX_N_PACKET_CLASSES 3 /* Must agree with above list */
/* Maximum number of acknowledgements in an acknowledge packet
*/
#define RX_MAXACKS 255
/* The structure of the data portion of an acknowledge packet: An acknowledge
* packet is in network byte order at all times. An acknowledgement is always
* prompted for a specific reason by a specific incoming packet. This reason
* is reported in "reason" and the packet's sequence number in the packet
* header.seq. In addition to this information, all of the current
* acknowledgement information about this call is placed in the packet.
* "FirstPacket" is the sequence number of the first packet represented in an
* array of bytes, "acks", containing acknowledgement information for a number
* of consecutive packets. All packets prior to FirstPacket are implicitly
* acknowledged: the sender need no longer be concerned about them. Packets
* from firstPacket+nAcks and on are not acknowledged. Packets in the range
* [firstPacket,firstPacket+nAcks) are each acknowledged explicitly. The
* acknowledgement may be RX_NACK if the packet is not (currently) at the
* receiver (it may have never been received, or received and then later
* dropped), or it may be RX_ACK if the packet is queued up waiting to be read
* by the upper level software. RX_ACK does not imply that the packet may not
* be dropped before it is read; it does imply that the sender should stop
* retransmitting the packet until notified otherwise. The field
* previousPacket identifies the previous packet received by the peer. This
* was used in a previous version of this software, and could be used in the
* future. The serial number in the data part of the ack packet corresponds to
* the serial number oof the packet which prompted the acknowledge. Any
* packets which are explicitly not acknowledged, and which were last
* transmitted with a serial number less than the provided serial number,
* should be retransmitted immediately. Actually, this is slightly inaccurate:
* packets are not necessarily received in order. When packets are habitually
* transmitted out of order, this is allowed for in the retransmission
* algorithm by introducing the notion of maximum packet skew: the degree of
* out-of-orderness of the packets received on the wire. This number is
* communicated from the receiver to the sender in ack packets. */
struct rx_ackPacket {
u_short bufferSpace; /* Number of packet buffers available. That is:
* the number of buffers that the sender of the ack
* packet is willing to provide for data, on this
* or subsequent calls. Lying is permissable.
*/
u_short maxSkew; /* Maximum difference between serial# of packet ack
* nowledged and highest packet yet received
*/
u_int32_t firstPacket; /* The first packet in the list of acknowledged
* packets
*/
u_int32_t previousPacket; /* The previous packet number received (obsolete?) */
u_int32_t serial; /* Serial number of the packet which prompted the
* acknowledge
*/
u_char reason; /* Reason for the acknowledge of ackPacket,
* defined below
*/
u_char nAcks; /* Number of acknowledgements */
u_char acks[RX_MAXACKS]; /* Up to RX_MAXACKS packet acknowledgements,
* defined below
*/
/* Packets <firstPacket are implicitly acknowledged and may be discarded
* by the sender. Packets >= firstPacket+nAcks are implicitly NOT
* acknowledged.
* No packets with sequence numbers >= firstPacket should be discarded by
* the sender (they may thrown out at any time by the receiver)
*/
};
/* Reason for acknowledge message
*/
#define RX_ACK_REQUESTED 1 /* Peer requested an ack on this packet */
#define RX_ACK_DUPLICATE 2 /* Duplicate packet */
#define RX_ACK_OUT_OF_SEQUENCE 3 /* Packet out of sequence */
#define RX_ACK_EXCEEDS_WINDOW 4 /* Packet sequence number higher than window; discarded */
#define RX_ACK_NOSPACE 5 /* No buffer space at all */
#define RX_ACK_PING 6 /* This is a keep-alive ack */
#define RX_ACK_PING_RESPONSE 7 /* Ack'ing because we were pinged */
#define RX_ACK_DELAY 8 /* Ack generated since nothing has happened since receiving packet */
/* Packet acknowledgement type
*/
#define RX_ACK_TYPE_NACK 0 /* I Don't have this packet */
#define RX_ACK_TYPE_ACK 1 /* I have this packet, although I may discard it later */
#define RX_ACK_REASONS " R2OWSKAD"
/* The packet size transmitted for an acknowledge is adjusted to reflect the
* actual size of the acks array. This macro defines the size
*/
#define rx_AckDataSize(nAcks) (sizeof(struct rx_ackPacket) - RX_MAXACKS + (nAcks))
#define RX_CHALLENGE_TIMEOUT 2 /* Number of seconds before another
* authentication request packet is generated
*/
/* RX error codes. RX uses error codes from -1 to -64. Rxgen may use other
* eeror codes < -64; user programs are expected to return positive error codes
*/
/* Something bad happened to the connection; temporary loss of communication
*/
#define RX_CALL_DEAD (-1)
/* An invalid operation, such as a client attempting to send data after having
* received the beginning of a reply from the server
*/
#define RX_INVALID_OPERATION (-2)
/* An optional timeout per call may be specified
*/
#define RX_CALL_TIMEOUT (-3)
/* End of data on a read
*/
#define RX_EOF (-4)
/* Some sort of low-level protocol error
*/
#define RX_PROTOCOL_ERROR (-5)
/* Generic user abort code; used when no more specific error code needs to
* be communicated. For example, multi rx clients use this code to abort a
* multi rx call
*/
#define RX_USER_ABORT (-6)
/* Port already in use (from rx_Init)
*/
#define RX_ADDRINUSE (-7)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -