Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

p80211conv.h

Go to the documentation of this file.
00001 /* src/include/wlan/p80211conv.h
00002 *
00003 * Ether/802.11 conversions and packet buffer routines
00004 *
00005 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
00006 * --------------------------------------------------------------------
00007 *
00008 * linux-wlan
00009 *
00010 *   The contents of this file are subject to the Mozilla Public
00011 *   License Version 1.1 (the "License"); you may not use this file
00012 *   except in compliance with the License. You may obtain a copy of
00013 *   the License at http://www.mozilla.org/MPL/
00014 *
00015 *   Software distributed under the License is distributed on an "AS
00016 *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00017 *   implied. See the License for the specific language governing
00018 *   rights and limitations under the License.
00019 *
00020 *   Alternatively, the contents of this file may be used under the
00021 *   terms of the GNU Public License version 2 (the "GPL"), in which
00022 *   case the provisions of the GPL are applicable instead of the
00023 *   above.  If you wish to allow the use of your version of this file
00024 *   only under the terms of the GPL and not to allow others to use
00025 *   your version of this file under the MPL, indicate your decision
00026 *   by deleting the provisions above and replace them with the notice
00027 *   and other provisions required by the GPL.  If you do not delete
00028 *   the provisions above, a recipient may use your version of this
00029 *   file under either the MPL or the GPL.
00030 *
00031 * --------------------------------------------------------------------
00032 *
00033 * Inquiries regarding the linux-wlan Open Source project can be
00034 * made directly to:
00035 *
00036 * AbsoluteValue Systems Inc.
00037 * info@linux-wlan.com
00038 * http://www.linux-wlan.com
00039 *
00040 * --------------------------------------------------------------------
00041 *
00042 * Portions of the development of this software were funded by 
00043 * Intersil Corporation as part of PRISM(R) chipset product development.
00044 *
00045 * --------------------------------------------------------------------
00046 *
00047 * This file declares the functions, types and macros that perform 
00048 * Ethernet to/from 802.11 frame conversions.  
00049 *
00050 * --------------------------------------------------------------------
00051 */
00052 
00053 #ifndef _LINUX_P80211CONV_H
00054 #define _LINUX_P80211CONV_H
00055 
00056 /*================================================================*/
00057 /* Constants */
00058 
00059 #define WLAN_ETHADDR_LEN        6
00060 #define WLAN_IEEE_OUI_LEN       3
00061 
00062 #define WLAN_ETHCONV_ENCAP      1
00063 #define WLAN_ETHCONV_RFC1042    2
00064 #define WLAN_ETHCONV_8021h      3
00065 
00066 #define WLAN_MIN_ETHFRM_LEN     60
00067 #define WLAN_MAX_ETHFRM_LEN     1514
00068 #define WLAN_ETHHDR_LEN         14
00069 
00070 #define P80211CAPTURE_VERSION   0x80211001
00071 
00072 /*================================================================*/
00073 /* Macros */
00074 
00075 #define P80211_FRMMETA_MAGIC            0x802110
00076 
00077 #define P80211SKB_FRMMETA(s) \
00078         (((((p80211_frmmeta_t*)((s)->cb))->magic)==P80211_FRMMETA_MAGIC) ? \
00079                 ((p80211_frmmeta_t*)((s)->cb)) : \
00080                 (NULL))
00081 
00082 #define P80211SKB_RXMETA(s) \
00083         (P80211SKB_FRMMETA((s)) ?  P80211SKB_FRMMETA((s))->rx : ((p80211_rxmeta_t*)(NULL)))
00084 
00085 typedef struct p80211_rxmeta
00086 {
00087         struct wlandevice       *wlandev;
00088 
00089         UINT64  mactime;        /* Hi-rez MAC-supplied time value */
00090         UINT64  hosttime;       /* Best-rez host supplied time value */
00091 
00092         UINT    rxrate;         /* Receive data rate in 100kbps */
00093         UINT    priority;       /* 0-15, 0=contention, 6=CF */
00094         INT     signal;         /* An SSI, see p80211netdev.h */
00095         INT     noise;          /* An SSI, see p80211netdev.h */
00096         UINT    channel;        /* Receive channel (mostly for snifs) */
00097         UINT    preamble;       /* P80211ENUM_preambletype_* */
00098         UINT    encoding;       /* P80211ENUM_encoding_* */
00099 
00100 } p80211_rxmeta_t;
00101 
00102 typedef struct p80211_frmmeta
00103 {
00104         UINT                    magic;
00105         p80211_rxmeta_t         *rx;
00106 } p80211_frmmeta_t;
00107 
00108 void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb);
00109 int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb);
00110 void p80211skb_rxmeta_detach(struct sk_buff *skb);
00111 
00112 /*================================================================*/
00113 /* Types */
00114 
00115 /*
00116  * Frame capture header.  (See doc/capturefrm.txt)
00117  */
00118 typedef struct p80211_caphdr
00119 {
00120         UINT32          version         __WLAN_ATTRIB_PACK__;
00121         UINT32          length          __WLAN_ATTRIB_PACK__;
00122         UINT64          mactime         __WLAN_ATTRIB_PACK__;
00123         UINT64          hosttime        __WLAN_ATTRIB_PACK__;
00124         UINT32          phytype         __WLAN_ATTRIB_PACK__;
00125         UINT32          channel         __WLAN_ATTRIB_PACK__;
00126         UINT32          datarate        __WLAN_ATTRIB_PACK__;
00127         UINT32          antenna         __WLAN_ATTRIB_PACK__;
00128         UINT32          priority        __WLAN_ATTRIB_PACK__;
00129         UINT32          ssi_type        __WLAN_ATTRIB_PACK__;
00130         INT32           ssi_signal      __WLAN_ATTRIB_PACK__;
00131         INT32           ssi_noise       __WLAN_ATTRIB_PACK__;
00132         UINT32          preamble        __WLAN_ATTRIB_PACK__;
00133         UINT32          encoding        __WLAN_ATTRIB_PACK__;
00134 } p80211_caphdr_t;
00135 
00136 /* buffer free method pointer type */
00137 typedef void (* freebuf_method_t)(void *buf, int size);
00138 
00139 typedef struct p80211_metawep {
00140         void  *data;
00141         UINT8 iv[4];
00142         UINT8 icv[4];
00143 } p80211_metawep_t;
00144 
00145 /* local ether header type */
00146 typedef struct wlan_ethhdr
00147 {
00148         UINT8   daddr[WLAN_ETHADDR_LEN]         __WLAN_ATTRIB_PACK__;
00149         UINT8   saddr[WLAN_ETHADDR_LEN]         __WLAN_ATTRIB_PACK__;
00150         UINT16  type                            __WLAN_ATTRIB_PACK__;
00151 } __WLAN_ATTRIB_PACK__ wlan_ethhdr_t;
00152 
00153 /* local llc header type */
00154 typedef struct wlan_llc
00155 {
00156         UINT8   dsap                            __WLAN_ATTRIB_PACK__;
00157         UINT8   ssap                            __WLAN_ATTRIB_PACK__;
00158         UINT8   ctl                             __WLAN_ATTRIB_PACK__;
00159 } __WLAN_ATTRIB_PACK__ wlan_llc_t;
00160 
00161 /* local snap header type */
00162 typedef struct wlan_snap
00163 {
00164         UINT8   oui[WLAN_IEEE_OUI_LEN]          __WLAN_ATTRIB_PACK__;
00165         UINT16  type                            __WLAN_ATTRIB_PACK__;
00166 } __WLAN_ATTRIB_PACK__ wlan_snap_t;
00167 
00168 /* Circular include trick */
00169 struct wlandevice;
00170 
00171 /*================================================================*/
00172 /* Externs */
00173 
00174 /*================================================================*/
00175 /*Function Declarations */
00176 
00177 int skb_p80211_to_ether( struct wlandevice *wlandev, UINT32 ethconv, 
00178                          struct sk_buff *skb);
00179 int skb_ether_to_p80211( struct wlandevice *wlandev, UINT32 ethconv,
00180                          struct sk_buff *skb, p80211_hdr_t *p80211_hdr,
00181                          p80211_metawep_t *p80211_wep );
00182 
00183 int p80211_stt_findproto(UINT16 proto);
00184 int p80211_stt_addproto(UINT16 proto);
00185 
00186 #endif

Generated on Fri Feb 25 12:02:37 2005 for WifiScanner by  doxygen 1.4.1