ftp.nice.ch/pub/next/developer/languages/c/gcc.2.7.2.2.I.b.tar.gz#/lib/gcc-lib/i386-next-nextstep3/2.7.2.2.f.2/include/bsd/net/tokendefs.h

This is tokendefs.h in view mode; [Download] [Up]

/* 	Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
 *
 * tokendefs.h - Token-Ring MAC header definitions.  
 *
 * HISTORY
 * 8-Oct-92  Joel Greenblatt at NeXT
 * 	created 
 */

#import <sys/errno.h>

/*
 * Token ring address - 6 octets
 */
#define NUM_TR_ADDR_BYTES	6

struct token_addr {
	u_char	token_addr_octet[NUM_TR_ADDR_BYTES];
};

#define ta_byte token_addr_octet

typedef struct token_addr token_addr_t;

/*
 * MAC header size
 */
#define MAC_HDR_MIN	(1+1+6+6)		/* MAC hdr size w/o ri field */
#define MAC_HDR_MAX	(MAC_HDR_MIN + RISIZE) 	/* MAC hdr size w/max ri */

/*
 * The maximum size of the MAC information field as spec'd by ISO 8802/5.
 */
#define MAC_INFO_4MB	4472	/* max size of mac info field -- 4 Mbs */
#define MAC_INFO_16MB	17800	/* max size of mac info field -- 16 Mbs */

/*
 * Maximum DMA packet sizes for 4 & 16 Mbit assuming no CRC.
 */ 
#define MAC_DMA_MAX_4MB	  (MAC_HDR_MAX + MAC_INFO_4MB)
#define MAC_DMA_MAX_16MB  (MAC_HDR_MAX + MAC_INFO_16MB)

/* 
 * Routing control field.
 */
typedef struct	{

#if	__BIG_ENDIAN__
	   unsigned char bcast  : 3,		/* broadcast */
	   		 len    : 5;		/* length */
	   unsigned char dir    : 1,		/* direction */
	   		 longf  : 3,		/* longest frame */
	   		 rsrvd  : 4;		/* reserved */

#elif	__LITTLE_ENDIAN__
	  unsigned char  len    : 5,		/* length */
	   	         bcast  : 3;		/* broadcast */
	  unsigned char  rsrvd  : 4,		/* reserved */
	   		 longf  : 3,		/* longest frame */
	   		 dir    : 1;		/* direction */
#else
   error
#endif
} routing_ctl_t;		

/* bcast field ... */
#define  BI_SPECIFIC	0	/* b'0xx': non-broadcast (specific route) */
#define  BI_AR_BCAST	4	/* b'10x': all-routes broadcast */
#define  BI_SR_BCAST 	6	/* b'11x': single-route broadcast */

/* 
 * longf field 
 */
#define  LF_S516	0
#define  LF_S1500	1
#define  LF_S2052	2
#define  LF_S4472	3
#define  LF_S8144	4
#define  LF_S11407	5
#define  LF_S17800	6
#define  LF_BCAST	7	/* All-routes broadcast */

#define LFB_4MB		LF_S4472	/* encoded max info -- 4 Mb */
#define LFB_16MB	LF_S17800	/* encoded max info -- 16 Mb */

/*
 * Source Routing field (2-18 bytes, must be even)
 */

#define RISIZE         18	/* max size (bytes) of 802.5 routing field */

typedef	struct	{
	routing_ctl_t	rc;			 
	u_char 		sn[RISIZE-sizeof(routing_ctl_t)];   
} sroute_t;

/*
 * Token Ring MAC header  (IEEE 802.5, ISO 8802/5)
 */

#define TR_DA_SIZE	6

typedef	struct	{
	u_char	 	ac;		/* PPPTMRRR;  PPP = token priority */
	u_char	 	fc;		/* FFrrZZZZ;  FF = frame type */
#define	TR_FC_MASK 	0xc0		/* mask for frame-type */
#define	TR_FC_MAC 	0x00		/* frame-type = mac frame */
#define	TR_FC_DATA 	0x40		/* frame-type = non-mac (data frame) */
	u_char	 	da[TR_DA_SIZE];	/* destination address */
	u_char	 	sa[TR_DA_SIZE];	/* source address */
#define TR_RII		0x80		/* routing info indicator bit */
	sroute_t 	ri;		/* routing information field */
} tokenHeader_t;

/*
 * token-ring netif definitions
 */
#define IFTYPE_TOKENRING	"4/16Mb Token-Ring"	/* netif type-string */

/*
 * Error codes
 */
#define	TRINGDOWN	ENETDOWN 	/* interface down*/
#define TNOBUFS		ENOBUFS 	/* transmit queue full error*/
#define TBADDA		EINVAL 		/* bad dest addr*/
#define TBADFSIZE	EMSGSIZE 	/* bad frame size*/

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.