Annotation of XNU/bsd/net/tokendefs.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
                     23:  *
                     24:  * tokendefs.h - Token-Ring MAC header definitions.  
                     25:  *
                     26:  * HISTORY
                     27:  * 8-Oct-92  Joel Greenblatt at NeXT
                     28:  *     created 
                     29:  */
                     30: #ifndef _NET_TOKENDEFS_H_
                     31: #define _NET_TOKENDEFS_H_
                     32: 
                     33: 
                     34: #include <sys/errno.h>
                     35: 
                     36: /*
                     37:  * Token ring address - 6 octets
                     38:  */
                     39: #define NUM_TR_ADDR_BYTES      6
                     40: 
                     41: struct token_addr {
                     42:        u_char  token_addr_octet[NUM_TR_ADDR_BYTES];
                     43: };
                     44: 
                     45: #define ta_byte token_addr_octet
                     46: 
                     47: typedef struct token_addr token_addr_t;
                     48: 
                     49: /*
                     50:  * MAC header size
                     51:  */
                     52: #define MAC_HDR_MIN    (1+1+6+6)               /* MAC hdr size w/o ri field */
                     53: #define MAC_HDR_MAX    (MAC_HDR_MIN + RISIZE)  /* MAC hdr size w/max ri */
                     54: 
                     55: /*
                     56:  * The maximum size of the MAC information field as spec'd by ISO 8802/5.
                     57:  */
                     58: #define MAC_INFO_4MB   4472    /* max size of mac info field -- 4 Mbs */
                     59: #define MAC_INFO_16MB  17800   /* max size of mac info field -- 16 Mbs */
                     60: 
                     61: /*
                     62:  * Maximum DMA packet sizes for 4 & 16 Mbit assuming no CRC.
                     63:  */ 
                     64: #define MAC_DMA_MAX_4MB          (MAC_HDR_MAX + MAC_INFO_4MB)
                     65: #define MAC_DMA_MAX_16MB  (MAC_HDR_MAX + MAC_INFO_16MB)
                     66: 
                     67: /* 
                     68:  * Routing control field.
                     69:  */
                     70: typedef struct {
                     71: 
                     72: #if    __BIG_ENDIAN__
                     73:           unsigned char bcast  : 3,            /* broadcast */
                     74:                         len    : 5;            /* length */
                     75:           unsigned char dir    : 1,            /* direction */
                     76:                         longf  : 3,            /* longest frame */
                     77:                         rsrvd  : 4;            /* reserved */
                     78: 
                     79: #elif  __LITTLE_ENDIAN__
                     80:          unsigned char  len    : 5,            /* length */
                     81:                         bcast  : 3;            /* broadcast */
                     82:          unsigned char  rsrvd  : 4,            /* reserved */
                     83:                         longf  : 3,            /* longest frame */
                     84:                         dir    : 1;            /* direction */
                     85: #else
                     86:    error
                     87: #endif
                     88: } routing_ctl_t;               
                     89: 
                     90: /* bcast field ... */
                     91: #define  BI_SPECIFIC   0       /* b'0xx': non-broadcast (specific route) */
                     92: #define  BI_AR_BCAST   4       /* b'10x': all-routes broadcast */
                     93: #define  BI_SR_BCAST   6       /* b'11x': single-route broadcast */
                     94: 
                     95: /* 
                     96:  * longf field 
                     97:  */
                     98: #define  LF_S516       0
                     99: #define  LF_S1500      1
                    100: #define  LF_S2052      2
                    101: #define  LF_S4472      3
                    102: #define  LF_S8144      4
                    103: #define  LF_S11407     5
                    104: #define  LF_S17800     6
                    105: #define  LF_BCAST      7       /* All-routes broadcast */
                    106: 
                    107: #define LFB_4MB                LF_S4472        /* encoded max info -- 4 Mb */
                    108: #define LFB_16MB       LF_S17800       /* encoded max info -- 16 Mb */
                    109: 
                    110: /*
                    111:  * Source Routing field (2-18 bytes, must be even)
                    112:  */
                    113: 
                    114: #define RISIZE         18      /* max size (bytes) of 802.5 routing field */
                    115: 
                    116: typedef        struct  {
                    117:        routing_ctl_t   rc;                      
                    118:        u_char          sn[RISIZE-sizeof(routing_ctl_t)];   
                    119: } sroute_t;
                    120: 
                    121: /*
                    122:  * Token Ring MAC header  (IEEE 802.5, ISO 8802/5)
                    123:  */
                    124: 
                    125: #define TR_DA_SIZE     6
                    126: 
                    127: typedef        struct  {
                    128:        u_char          ac;             /* PPPTMRRR;  PPP = token priority */
                    129:        u_char          fc;             /* FFrrZZZZ;  FF = frame type */
                    130: #define        TR_FC_MASK      0xc0            /* mask for frame-type */
                    131: #define        TR_FC_MAC       0x00            /* frame-type = mac frame */
                    132: #define        TR_FC_DATA      0x40            /* frame-type = non-mac (data frame) */
                    133:        u_char          da[TR_DA_SIZE]; /* destination address */
                    134:        u_char          sa[TR_DA_SIZE]; /* source address */
                    135: #define TR_RII         0x80            /* routing info indicator bit */
                    136:        sroute_t        ri;             /* routing information field */
                    137: } tokenHeader_t;
                    138: 
                    139: /*
                    140:  * token-ring netif definitions
                    141:  */
                    142: #define IFTYPE_TOKENRING       "4/16Mb Token-Ring"     /* netif type-string */
                    143: 
                    144: /*
                    145:  * Error codes
                    146:  */
                    147: #define        TRINGDOWN       ENETDOWN        /* interface down */
                    148: #define TNOBUFS                ENOBUFS         /* transmit queue full error */
                    149: #define TBADDA         EINVAL          /* bad dest addr */
                    150: #define TBADFSIZE      EMSGSIZE        /* bad frame size */
                    151: 
                    152: #endif /* ! _NET_TOKENDEFS_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.