if_tr.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _NETINET_IF_TR_H
  15. #define _NETINET_IF_TR_H 1
  16. #include <sys/cdefs.h>
  17. #include <sys/types.h>
  18. /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
  19. and FCS/CRC (frame check sequence). */
  20. #define TR_ALEN 6 /* Octets in one token-ring addr */
  21. #define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc))
  22. #define AC 0x10
  23. #define LLC_FRAME 0x40
  24. /* LLC and SNAP constants */
  25. #define EXTENDED_SAP 0xAA
  26. #define UI_CMD 0x03
  27. /* This is an Token-Ring frame header. */
  28. struct trh_hdr
  29. {
  30. u_int8_t ac; /* access control field */
  31. u_int8_t fc; /* frame control field */
  32. u_int8_t daddr[TR_ALEN]; /* destination address */
  33. u_int8_t saddr[TR_ALEN]; /* source address */
  34. u_int16_t rcf; /* route control field */
  35. u_int16_t rseg[8]; /* routing registers */
  36. };
  37. /* This is an Token-Ring LLC structure */
  38. struct trllc
  39. {
  40. u_int8_t dsap; /* destination SAP */
  41. u_int8_t ssap; /* source SAP */
  42. u_int8_t llc; /* LLC control field */
  43. u_int8_t protid[3]; /* protocol id */
  44. u_int16_t ethertype; /* ether type field */
  45. };
  46. /* Token-Ring statistics collection data. */
  47. struct tr_statistics
  48. {
  49. unsigned long rx_packets; /* total packets received */
  50. unsigned long tx_packets; /* total packets transmitted */
  51. unsigned long rx_bytes; /* total bytes received */
  52. unsigned long tx_bytes; /* total bytes transmitted */
  53. unsigned long rx_errors; /* bad packets received */
  54. unsigned long tx_errors; /* packet transmit problems */
  55. unsigned long rx_dropped; /* no space in linux buffers */
  56. unsigned long tx_dropped; /* no space available in linux */
  57. unsigned long multicast; /* multicast packets received */
  58. unsigned long transmit_collision;
  59. /* detailed Token-Ring errors. See IBM Token-Ring Network
  60. Architecture for more info */
  61. unsigned long line_errors;
  62. unsigned long internal_errors;
  63. unsigned long burst_errors;
  64. unsigned long A_C_errors;
  65. unsigned long abort_delimiters;
  66. unsigned long lost_frames;
  67. unsigned long recv_congest_count;
  68. unsigned long frame_copied_errors;
  69. unsigned long frequency_errors;
  70. unsigned long token_errors;
  71. unsigned long dummy1;
  72. };
  73. /* source routing stuff */
  74. #define TR_RII 0x80
  75. #define TR_RCF_DIR_BIT 0x80
  76. #define TR_RCF_LEN_MASK 0x1f00
  77. #define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
  78. #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
  79. #define TR_RCF_FRAME2K 0x20
  80. #define TR_RCF_BROADCAST_MASK 0xC000
  81. #define TR_MAXRIFLEN 18
  82. #ifdef __USE_BSD
  83. struct trn_hdr
  84. {
  85. u_int8_t trn_ac; /* access control field */
  86. u_int8_t trn_fc; /* field control field */
  87. u_int8_t trn_dhost[TR_ALEN]; /* destination host */
  88. u_int8_t trn_shost[TR_ALEN]; /* source host */
  89. u_int16_t trn_rcf; /* route control field */
  90. u_int16_t trn_rseg[8]; /* routing registers */
  91. };
  92. #endif
  93. #endif /* netinet/if_tr.h */