if_tr.h 3.7 KB

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