p80211conv.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* p80211conv.h
  2. *
  3. * Ether/802.11 conversions and packet buffer routines
  4. *
  5. * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
  6. * --------------------------------------------------------------------
  7. *
  8. * linux-wlan
  9. *
  10. * The contents of this file are subject to the Mozilla Public
  11. * License Version 1.1 (the "License"); you may not use this file
  12. * except in compliance with the License. You may obtain a copy of
  13. * the License at http://www.mozilla.org/MPL/
  14. *
  15. * Software distributed under the License is distributed on an "AS
  16. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  17. * implied. See the License for the specific language governing
  18. * rights and limitations under the License.
  19. *
  20. * Alternatively, the contents of this file may be used under the
  21. * terms of the GNU Public License version 2 (the "GPL"), in which
  22. * case the provisions of the GPL are applicable instead of the
  23. * above. If you wish to allow the use of your version of this file
  24. * only under the terms of the GPL and not to allow others to use
  25. * your version of this file under the MPL, indicate your decision
  26. * by deleting the provisions above and replace them with the notice
  27. * and other provisions required by the GPL. If you do not delete
  28. * the provisions above, a recipient may use your version of this
  29. * file under either the MPL or the GPL.
  30. *
  31. * --------------------------------------------------------------------
  32. *
  33. * Inquiries regarding the linux-wlan Open Source project can be
  34. * made directly to:
  35. *
  36. * AbsoluteValue Systems Inc.
  37. * info@linux-wlan.com
  38. * http://www.linux-wlan.com
  39. *
  40. * --------------------------------------------------------------------
  41. *
  42. * Portions of the development of this software were funded by
  43. * Intersil Corporation as part of PRISM(R) chipset product development.
  44. *
  45. * --------------------------------------------------------------------
  46. *
  47. * This file declares the functions, types and macros that perform
  48. * Ethernet to/from 802.11 frame conversions.
  49. *
  50. * --------------------------------------------------------------------
  51. */
  52. #ifndef _LINUX_P80211CONV_H
  53. #define _LINUX_P80211CONV_H
  54. #define WLAN_IEEE_OUI_LEN 3
  55. #define WLAN_ETHCONV_ENCAP 1
  56. #define WLAN_ETHCONV_8021h 3
  57. #define P80211CAPTURE_VERSION 0x80211001
  58. #define P80211_FRMMETA_MAGIC 0x802110
  59. #define P80211SKB_FRMMETA(s) \
  60. (((((struct p80211_frmmeta *)((s)->cb))->magic) == \
  61. P80211_FRMMETA_MAGIC) ? \
  62. ((struct p80211_frmmeta *)((s)->cb)) : \
  63. (NULL))
  64. #define P80211SKB_RXMETA(s) \
  65. (P80211SKB_FRMMETA((s)) ? P80211SKB_FRMMETA((s))->rx : \
  66. ((struct p80211_rxmeta *)(NULL)))
  67. struct p80211_rxmeta {
  68. struct wlandevice *wlandev;
  69. u64 mactime; /* Hi-rez MAC-supplied time value */
  70. u64 hosttime; /* Best-rez host supplied time value */
  71. unsigned int rxrate; /* Receive data rate in 100kbps */
  72. unsigned int priority; /* 0-15, 0=contention, 6=CF */
  73. int signal; /* An SSI, see p80211netdev.h */
  74. int noise; /* An SSI, see p80211netdev.h */
  75. unsigned int channel; /* Receive channel (mostly for snifs) */
  76. unsigned int preamble; /* P80211ENUM_preambletype_* */
  77. unsigned int encoding; /* P80211ENUM_encoding_* */
  78. };
  79. struct p80211_frmmeta {
  80. unsigned int magic;
  81. struct p80211_rxmeta *rx;
  82. };
  83. void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb);
  84. int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb);
  85. void p80211skb_rxmeta_detach(struct sk_buff *skb);
  86. /*
  87. * Frame capture header. (See doc/capturefrm.txt)
  88. */
  89. struct p80211_caphdr {
  90. u32 version;
  91. u32 length;
  92. u64 mactime;
  93. u64 hosttime;
  94. u32 phytype;
  95. u32 channel;
  96. u32 datarate;
  97. u32 antenna;
  98. u32 priority;
  99. u32 ssi_type;
  100. s32 ssi_signal;
  101. s32 ssi_noise;
  102. u32 preamble;
  103. u32 encoding;
  104. };
  105. /* buffer free method pointer type */
  106. typedef void (*freebuf_method_t) (void *buf, int size);
  107. struct p80211_metawep {
  108. void *data;
  109. u8 iv[4];
  110. u8 icv[4];
  111. };
  112. /* local ether header type */
  113. struct wlan_ethhdr {
  114. u8 daddr[ETH_ALEN];
  115. u8 saddr[ETH_ALEN];
  116. u16 type;
  117. } __packed;
  118. /* local llc header type */
  119. struct wlan_llc {
  120. u8 dsap;
  121. u8 ssap;
  122. u8 ctl;
  123. } __packed;
  124. /* local snap header type */
  125. struct wlan_snap {
  126. u8 oui[WLAN_IEEE_OUI_LEN];
  127. u16 type;
  128. } __packed;
  129. /* Circular include trick */
  130. struct wlandevice;
  131. int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv,
  132. struct sk_buff *skb);
  133. int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv,
  134. struct sk_buff *skb, union p80211_hdr *p80211_hdr,
  135. struct p80211_metawep *p80211_wep);
  136. int p80211_stt_findproto(u16 proto);
  137. #endif