home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / wlan / p80211conv.h next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  5.7 KB  |  187 lines

  1. /* src/include/wlan/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.  
  53. #ifndef _LINUX_P80211CONV_H
  54. #define _LINUX_P80211CONV_H
  55.  
  56. /*================================================================*/
  57. /* Constants */
  58.  
  59. #define WLAN_ETHADDR_LEN    6
  60. #define WLAN_IEEE_OUI_LEN    3
  61.  
  62. #define WLAN_ETHCONV_ENCAP    1
  63. #define WLAN_ETHCONV_RFC1042    2
  64. #define WLAN_ETHCONV_8021h    3
  65.  
  66. #define WLAN_MIN_ETHFRM_LEN    60
  67. #define WLAN_MAX_ETHFRM_LEN    1514
  68. #define WLAN_ETHHDR_LEN        14
  69.  
  70. #define P80211CAPTURE_VERSION    0x80211001
  71.  
  72. /*================================================================*/
  73. /* Macros */
  74.  
  75. #define    P80211_FRMMETA_MAGIC        0x802110
  76.  
  77. #define P80211SKB_FRMMETA(s) \
  78.     (((((p80211_frmmeta_t*)((s)->cb))->magic)==P80211_FRMMETA_MAGIC) ? \
  79.         ((p80211_frmmeta_t*)((s)->cb)) : \
  80.         (NULL))
  81.  
  82. #define P80211SKB_RXMETA(s) \
  83.     (P80211SKB_FRMMETA((s)) ?  P80211SKB_FRMMETA((s))->rx : ((p80211_rxmeta_t*)(NULL)))
  84.  
  85. typedef struct p80211_rxmeta
  86. {
  87.     struct wlandevice    *wlandev;
  88.  
  89.     UINT64    mactime;    /* Hi-rez MAC-supplied time value */
  90.     UINT64    hosttime;    /* Best-rez host supplied time value */
  91.  
  92.     UINT    rxrate;        /* Receive data rate in 100kbps */
  93.     UINT    priority;    /* 0-15, 0=contention, 6=CF */
  94.     INT    signal;        /* An SSI, see p80211netdev.h */
  95.     INT    noise;        /* An SSI, see p80211netdev.h */
  96.     UINT    channel;    /* Receive channel (mostly for snifs) */
  97.     UINT    preamble;    /* P80211ENUM_preambletype_* */
  98.     UINT    encoding;    /* P80211ENUM_encoding_* */
  99.  
  100. } p80211_rxmeta_t;
  101.  
  102. typedef struct p80211_frmmeta
  103. {
  104.     UINT            magic;
  105.     p80211_rxmeta_t        *rx;
  106. } p80211_frmmeta_t;
  107.  
  108. void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb);
  109. int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb);
  110. void p80211skb_rxmeta_detach(struct sk_buff *skb);
  111.  
  112. /*================================================================*/
  113. /* Types */
  114.  
  115. /*
  116.  * Frame capture header.  (See doc/capturefrm.txt)
  117.  */
  118. typedef struct p80211_caphdr
  119. {
  120.     UINT32        version        __WLAN_ATTRIB_PACK__;
  121.     UINT32        length        __WLAN_ATTRIB_PACK__;
  122.     UINT64        mactime        __WLAN_ATTRIB_PACK__;
  123.     UINT64        hosttime    __WLAN_ATTRIB_PACK__;
  124.     UINT32        phytype        __WLAN_ATTRIB_PACK__;
  125.     UINT32        channel        __WLAN_ATTRIB_PACK__;
  126.     UINT32        datarate    __WLAN_ATTRIB_PACK__;
  127.     UINT32        antenna        __WLAN_ATTRIB_PACK__;
  128.     UINT32        priority    __WLAN_ATTRIB_PACK__;
  129.     UINT32        ssi_type    __WLAN_ATTRIB_PACK__;
  130.     INT32        ssi_signal    __WLAN_ATTRIB_PACK__;
  131.     INT32        ssi_noise    __WLAN_ATTRIB_PACK__;
  132.     UINT32        preamble    __WLAN_ATTRIB_PACK__;
  133.     UINT32        encoding    __WLAN_ATTRIB_PACK__;
  134. } p80211_caphdr_t;
  135.  
  136. /* buffer free method pointer type */
  137. typedef void (* freebuf_method_t)(void *buf, int size);
  138.  
  139. typedef struct p80211_metawep {
  140.     void  *data;
  141.     UINT8 iv[4];
  142.     UINT8 icv[4];
  143. } p80211_metawep_t;
  144.  
  145. /* local ether header type */
  146. typedef struct wlan_ethhdr
  147. {
  148.     UINT8    daddr[WLAN_ETHADDR_LEN]        __WLAN_ATTRIB_PACK__;
  149.     UINT8    saddr[WLAN_ETHADDR_LEN]        __WLAN_ATTRIB_PACK__;
  150.     UINT16    type                __WLAN_ATTRIB_PACK__;
  151. } __WLAN_ATTRIB_PACK__ wlan_ethhdr_t;
  152.  
  153. /* local llc header type */
  154. typedef struct wlan_llc
  155. {
  156.     UINT8    dsap                __WLAN_ATTRIB_PACK__;
  157.     UINT8    ssap                __WLAN_ATTRIB_PACK__;
  158.     UINT8    ctl                __WLAN_ATTRIB_PACK__;
  159. } __WLAN_ATTRIB_PACK__ wlan_llc_t;
  160.  
  161. /* local snap header type */
  162. typedef struct wlan_snap
  163. {
  164.     UINT8    oui[WLAN_IEEE_OUI_LEN]        __WLAN_ATTRIB_PACK__;
  165.     UINT16    type                __WLAN_ATTRIB_PACK__;
  166. } __WLAN_ATTRIB_PACK__ wlan_snap_t;
  167.  
  168. /* Circular include trick */
  169. struct wlandevice;
  170.  
  171. /*================================================================*/
  172. /* Externs */
  173.  
  174. /*================================================================*/
  175. /*Function Declarations */
  176.  
  177. int skb_p80211_to_ether( struct wlandevice *wlandev, UINT32 ethconv, 
  178.              struct sk_buff *skb);
  179. int skb_ether_to_p80211( struct wlandevice *wlandev, UINT32 ethconv,
  180.              struct sk_buff *skb, p80211_hdr_t *p80211_hdr,
  181.              p80211_metawep_t *p80211_wep );
  182.  
  183. int p80211_stt_findproto(UINT16 proto);
  184. int p80211_stt_addproto(UINT16 proto);
  185.  
  186. #endif
  187.