Back to index

glibc  2.9
if_tr.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 2005 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _NETINET_IF_TR_H
00020 #define       _NETINET_IF_TR_H 1
00021 
00022 #include <sys/cdefs.h>
00023 #include <sys/types.h>
00024 
00025 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
00026    and FCS/CRC (frame check sequence). */
00027 #define TR_ALEN             6             /* Octets in one token-ring addr */
00028 #define TR_HLEN      (sizeof (struct trh_hdr) + sizeof (struct trllc))
00029 #define AC           0x10
00030 #define LLC_FRAME    0x40
00031 
00032 /* LLC and SNAP constants */
00033 #define EXTENDED_SAP        0xAA
00034 #define UI_CMD              0x03
00035 
00036 /* This is an Token-Ring frame header. */
00037 struct trh_hdr
00038 {
00039   u_int8_t  ac;                    /* access control field */
00040   u_int8_t  fc;                    /* frame control field */
00041   u_int8_t  daddr[TR_ALEN]; /* destination address */
00042   u_int8_t  saddr[TR_ALEN]; /* source address */
00043   u_int16_t rcf;            /* route control field */
00044   u_int16_t rseg[8];        /* routing registers */
00045 };
00046 
00047 /* This is an Token-Ring LLC structure */
00048 struct trllc
00049 {
00050   u_int8_t  dsap;           /* destination SAP */
00051   u_int8_t  ssap;           /* source SAP */
00052   u_int8_t  llc;            /* LLC control field */
00053   u_int8_t  protid[3];             /* protocol id */
00054   u_int16_t ethertype;             /* ether type field */
00055 };
00056 
00057 /* Token-Ring statistics collection data. */
00058 struct tr_statistics
00059 {
00060   unsigned long rx_packets;     /* total packets received      */
00061   unsigned long tx_packets; /* total packets transmitted       */
00062   unsigned long rx_bytes;   /* total bytes received     */
00063   unsigned long tx_bytes;   /* total bytes transmitted  */
00064   unsigned long rx_errors;  /* bad packets received            */
00065   unsigned long tx_errors;  /* packet transmit problems */
00066   unsigned long rx_dropped; /* no space in linux buffers       */
00067   unsigned long tx_dropped; /* no space available in linux     */
00068   unsigned long multicast;  /* multicast packets received      */
00069   unsigned long transmit_collision;
00070 
00071   /* detailed Token-Ring errors. See IBM Token-Ring Network
00072      Architecture for more info */
00073 
00074   unsigned long line_errors;
00075   unsigned long internal_errors;
00076   unsigned long burst_errors;
00077   unsigned long A_C_errors;
00078   unsigned long abort_delimiters;
00079   unsigned long lost_frames;
00080   unsigned long recv_congest_count;
00081   unsigned long frame_copied_errors;
00082   unsigned long frequency_errors;
00083   unsigned long token_errors;
00084   unsigned long dummy1;
00085 };
00086 
00087 /* source routing stuff */
00088 #define TR_RII                     0x80
00089 #define TR_RCF_DIR_BIT             0x80
00090 #define TR_RCF_LEN_MASK     0x1f00
00091 #define TR_RCF_BROADCAST    0x8000 /* all-routes broadcast */
00092 #define TR_RCF_LIMITED_BROADCAST 0xC000   /* single-route broadcast */
00093 #define TR_RCF_FRAME2K             0x20
00094 #define TR_RCF_BROADCAST_MASK      0xC000
00095 #define TR_MAXRIFLEN               18
00096 
00097 #ifdef __USE_BSD
00098 
00099 struct trn_hdr
00100 {
00101   u_int8_t trn_ac;                /* access control field */
00102   u_int8_t trn_fc;                /* field control field */
00103   u_int8_t trn_dhost[TR_ALEN];    /* destination host */
00104   u_int8_t trn_shost[TR_ALEN];    /* source host */
00105   u_int16_t trn_rcf;              /* route control field */
00106   u_int16_t trn_rseg[8];          /* routing registers */
00107 };
00108 
00109 #endif
00110 
00111 #endif /* netinet/if_tr.h */