Home | History | Annotate | Download | only in netinet
      1 /* Copyright (C) 1997, 2005 Free Software Foundation, Inc.
      2    This file is part of the GNU C Library.
      3 
      4    The GNU C Library is free software; you can redistribute it and/or
      5    modify it under the terms of the GNU Lesser General Public
      6    License as published by the Free Software Foundation; either
      7    version 2.1 of the License, or (at your option) any later version.
      8 
      9    The GNU C Library is distributed in the hope that it will be useful,
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12    Lesser General Public License for more details.
     13 
     14    You should have received a copy of the GNU Lesser General Public
     15    License along with the GNU C Library; if not, write to the Free
     16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     17    02111-1307 USA.  */
     18 
     19 #ifndef _NETINET_IF_TR_H
     20 #define	_NETINET_IF_TR_H 1
     21 
     22 #include <sys/cdefs.h>
     23 #include <sys/types.h>
     24 
     25 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
     26    and FCS/CRC (frame check sequence). */
     27 #define TR_ALEN		6		/* Octets in one token-ring addr */
     28 #define TR_HLEN 	(sizeof (struct trh_hdr) + sizeof (struct trllc))
     29 #define AC		0x10
     30 #define LLC_FRAME 	0x40
     31 
     32 /* LLC and SNAP constants */
     33 #define EXTENDED_SAP 	0xAA
     34 #define UI_CMD       	0x03
     35 
     36 /* This is an Token-Ring frame header. */
     37 struct trh_hdr
     38 {
     39   u_int8_t  ac;			/* access control field */
     40   u_int8_t  fc;			/* frame control field */
     41   u_int8_t  daddr[TR_ALEN];	/* destination address */
     42   u_int8_t  saddr[TR_ALEN];	/* source address */
     43   u_int16_t rcf;		/* route control field */
     44   u_int16_t rseg[8];		/* routing registers */
     45 };
     46 
     47 /* This is an Token-Ring LLC structure */
     48 struct trllc
     49 {
     50   u_int8_t  dsap;		/* destination SAP */
     51   u_int8_t  ssap;		/* source SAP */
     52   u_int8_t  llc;		/* LLC control field */
     53   u_int8_t  protid[3];		/* protocol id */
     54   u_int16_t ethertype;		/* ether type field */
     55 };
     56 
     57 /* Token-Ring statistics collection data. */
     58 struct tr_statistics
     59 {
     60   unsigned long rx_packets;     /* total packets received	*/
     61   unsigned long tx_packets;	/* total packets transmitted	*/
     62   unsigned long rx_bytes;	/* total bytes received   	*/
     63   unsigned long tx_bytes;	/* total bytes transmitted	*/
     64   unsigned long rx_errors;	/* bad packets received		*/
     65   unsigned long tx_errors;	/* packet transmit problems	*/
     66   unsigned long rx_dropped;	/* no space in linux buffers	*/
     67   unsigned long tx_dropped;	/* no space available in linux	*/
     68   unsigned long multicast;	/* multicast packets received	*/
     69   unsigned long transmit_collision;
     70 
     71   /* detailed Token-Ring errors. See IBM Token-Ring Network
     72      Architecture for more info */
     73 
     74   unsigned long line_errors;
     75   unsigned long internal_errors;
     76   unsigned long burst_errors;
     77   unsigned long A_C_errors;
     78   unsigned long abort_delimiters;
     79   unsigned long lost_frames;
     80   unsigned long recv_congest_count;
     81   unsigned long frame_copied_errors;
     82   unsigned long frequency_errors;
     83   unsigned long token_errors;
     84   unsigned long dummy1;
     85 };
     86 
     87 /* source routing stuff */
     88 #define TR_RII 			0x80
     89 #define TR_RCF_DIR_BIT 		0x80
     90 #define TR_RCF_LEN_MASK 	0x1f00
     91 #define TR_RCF_BROADCAST 	0x8000	/* all-routes broadcast */
     92 #define TR_RCF_LIMITED_BROADCAST 0xC000	/* single-route broadcast */
     93 #define TR_RCF_FRAME2K 		0x20
     94 #define TR_RCF_BROADCAST_MASK 	0xC000
     95 #define TR_MAXRIFLEN 		18
     96 
     97 #ifdef __USE_BSD
     98 
     99 struct trn_hdr
    100 {
    101   u_int8_t trn_ac;                /* access control field */
    102   u_int8_t trn_fc;                /* field control field */
    103   u_int8_t trn_dhost[TR_ALEN];    /* destination host */
    104   u_int8_t trn_shost[TR_ALEN];    /* source host */
    105   u_int16_t trn_rcf;              /* route control field */
    106   u_int16_t trn_rseg[8];          /* routing registers */
    107 };
    108 
    109 #endif
    110 
    111 #endif	/* netinet/if_tr.h */
    112