if_llc.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*-
  2. * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer,
  10. * without modification.
  11. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  12. * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
  13. * redistribution must be conditioned upon including a substantially
  14. * similar Disclaimer requirement for further binary redistribution.
  15. * 3. Neither the names of the above-listed copyright holders nor the names
  16. * of any contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * Alternatively, this software may be distributed under the terms of the
  20. * GNU General Public License ("GPL") version 2 as published by the Free
  21. * Software Foundation.
  22. *
  23. * NO WARRANTY
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
  27. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  28. * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
  29. * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  31. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  32. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  33. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  34. * THE POSSIBILITY OF SUCH DAMAGES.
  35. *
  36. * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/net80211/if_llc.h#1 $
  37. * $NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $
  38. * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/madwifi/net80211/if_llc.h#1 $
  39. */
  40. /*
  41. * Copyright (c) 1988, 1993
  42. * The Regents of the University of California. All rights reserved.
  43. *
  44. * Redistribution and use in source and binary forms, with or without
  45. * modification, are permitted provided that the following conditions
  46. * are met:
  47. * 1. Redistributions of source code must retain the above copyright
  48. * notice, this list of conditions and the following disclaimer.
  49. * 2. Redistributions in binary form must reproduce the above copyright
  50. * notice, this list of conditions and the following disclaimer in the
  51. * documentation and/or other materials provided with the distribution.
  52. * 3. All advertising materials mentioning features or use of this software
  53. * must display the following acknowledgement:
  54. * This product includes software developed by the University of
  55. * California, Berkeley and its contributors.
  56. * 4. Neither the name of the University nor the names of its contributors
  57. * may be used to endorse or promote products derived from this software
  58. * without specific prior written permission.
  59. *
  60. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  61. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  62. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  63. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  64. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  65. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  66. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  67. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  68. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  69. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  70. * SUCH DAMAGE.
  71. *
  72. * @(#)if_llc.h 8.1 (Berkeley) 6/10/93
  73. * $FreeBSD: src/sys/net/if_llc.h,v 1.9 2002/09/23 06:25:08 alfred Exp $
  74. */
  75. #ifndef _NET_IF_LLC_H_
  76. #define _NET_IF_LLC_H_
  77. /*
  78. * IEEE 802.2 Link Level Control headers, for use in conjunction with
  79. * 802.{3,4,5} media access control methods.
  80. *
  81. * Headers here do not use bit fields due to shortcommings in many
  82. * compilers.
  83. */
  84. struct llc {
  85. a_uint8_t llc_dsap;
  86. a_uint8_t llc_ssap;
  87. union {
  88. struct {
  89. a_uint8_t control;
  90. a_uint8_t format_id;
  91. a_uint8_t class;
  92. a_uint8_t window_x2;
  93. } adf_os_packed type_u;
  94. struct {
  95. a_uint8_t num_snd_x2;
  96. a_uint8_t num_rcv_x2;
  97. } adf_os_packed type_i;
  98. struct {
  99. a_uint8_t control;
  100. a_uint8_t num_rcv_x2;
  101. } adf_os_packed type_s;
  102. struct {
  103. a_uint8_t control;
  104. /*
  105. * We cannot put the following fields in a structure because
  106. * the structure rounding might cause padding.
  107. */
  108. a_uint8_t frmr_rej_pdu0;
  109. a_uint8_t frmr_rej_pdu1;
  110. a_uint8_t frmr_control;
  111. a_uint8_t frmr_control_ext;
  112. a_uint8_t frmr_cause;
  113. } adf_os_packed type_frmr;
  114. struct {
  115. a_uint8_t control;
  116. a_uint8_t org_code[3];
  117. a_uint16_t ether_type;
  118. } adf_os_packed type_snap;
  119. struct {
  120. a_uint8_t control;
  121. a_uint8_t control_ext;
  122. } adf_os_packed type_raw;
  123. } llc_un /* XXX adf_os_packed ??? */;
  124. } adf_os_packed;
  125. struct frmrinfo {
  126. a_uint8_t frmr_rej_pdu0;
  127. a_uint8_t frmr_rej_pdu1;
  128. a_uint8_t frmr_control;
  129. a_uint8_t frmr_control_ext;
  130. a_uint8_t frmr_cause;
  131. } adf_os_packed;
  132. #define llc_control llc_un.type_u.control
  133. #define llc_control_ext llc_un.type_raw.control_ext
  134. #define llc_fid llc_un.type_u.format_id
  135. #define llc_class llc_un.type_u.class
  136. #define llc_window llc_un.type_u.window_x2
  137. #define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0
  138. #define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0
  139. #define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1
  140. #define llc_frmr_control llc_un.type_frmr.frmr_control
  141. #define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext
  142. #define llc_frmr_cause llc_un.type_frmr.frmr_cause
  143. #define llc_snap llc_un.type_snap
  144. /*
  145. * Don't use sizeof(struct llc_un) for LLC header sizes
  146. */
  147. #define LLC_ISFRAMELEN 4
  148. #define LLC_UFRAMELEN 3
  149. #define LLC_FRMRLEN 7
  150. #define LLC_SNAPFRAMELEN 8
  151. /*
  152. * Unnumbered LLC format commands
  153. */
  154. #define LLC_UI 0x3
  155. #define LLC_UI_P 0x13
  156. #define LLC_DISC 0x43
  157. #define LLC_DISC_P 0x53
  158. #define LLC_UA 0x63
  159. #define LLC_UA_P 0x73
  160. #define LLC_TEST 0xe3
  161. #define LLC_TEST_P 0xf3
  162. #define LLC_FRMR 0x87
  163. #define LLC_FRMR_P 0x97
  164. #define LLC_DM 0x0f
  165. #define LLC_DM_P 0x1f
  166. #define LLC_XID 0xaf
  167. #define LLC_XID_P 0xbf
  168. #define LLC_SABME 0x6f
  169. #define LLC_SABME_P 0x7f
  170. /*
  171. * Supervisory LLC commands
  172. */
  173. #define LLC_RR 0x01
  174. #define LLC_RNR 0x05
  175. #define LLC_REJ 0x09
  176. /*
  177. * Info format - dummy only
  178. */
  179. #define LLC_INFO 0x00
  180. /*
  181. * ISO PDTR 10178 contains among others
  182. */
  183. #define LLC_X25_LSAP 0x7e
  184. #define LLC_SNAP_LSAP 0xaa
  185. #define LLC_ISO_LSAP 0xfe
  186. #endif /* _NET_IF_LLC_H_ */