Nut/OS  4.10.3
API Reference
wlan.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 *  This file is part of the WLAN-Ethernut device driver.
00003 *
00004 *  Copyright (c) 2004 by Michael Fischer. All rights reserved.
00005 *
00006 *  Redistribution and use in source and binary forms, with or without 
00007 *  modification, are permitted provided that the following conditions 
00008 *  are met:
00009 *  
00010 *  1. Redistributions of source code must retain the above copyright 
00011 *     notice, this list of conditions and the following disclaimer.
00012 *  2. Redistributions in binary form must reproduce the above copyright
00013 *     notice, this list of conditions and the following disclaimer in the 
00014 *     documentation and/or other materials provided with the distribution.
00015 *  3. Neither the name of the author nor the names of its contributors may 
00016 *     be used to endorse or promote products derived from this software 
00017 *     without specific prior written permission.
00018 *
00019 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00020 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
00021 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
00022 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00023 *  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
00024 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
00025 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
00026 *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
00027 *  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
00028 *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 
00029 *  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00030 *  SUCH DAMAGE.
00031 *
00032 ****************************************************************************
00033 *  History:
00034 *
00035 *  27.01.04  mifi   First Version 
00036 ****************************************************************************/
00037 #ifndef __WLAN_H__
00038 #define __WLAN_H__
00039 
00040 
00041 #include <dev/netbuf.h>
00042 #include <net/if_var.h>
00043 
00044 /*
00045  * Available drivers.
00046 */
00047 extern NUTDEVICE devWlan;
00048 
00049 /*-------------------------------------------------------------------------*/
00050 /* global defines                                                          */
00051 /*-------------------------------------------------------------------------*/
00052 #ifndef DEV_ETHER
00053 #define DEV_ETHER   devWlan
00054 #endif
00055 
00056 /*
00057  * Networkname
00058 */ 
00059 #define WLAN_NETWORK_NAME_MAX_LEN 32
00060 
00061 /*
00062  * WEP
00063  */
00064 #define WLAN_WEP_MAX_KEY_COUNT    4
00065 #define WLAN_WEP_MAX_KEY_SIZE     16
00066 
00067 /*-------------------------------------------------------------------------*/
00068 /* global types                                                            */
00069 /*-------------------------------------------------------------------------*/
00070 
00071 /*
00072  * IOCTL commands
00073  */ 
00074 typedef enum {
00075   WLAN_IOCTL_GET_MAC_ADDRESS = 1,
00076   
00077   WLAN_IOCTL_SET_CONFIG,
00078   WLAN_IOCTL_GET_STATUS  
00079 
00080 } WLAN_IOCTL;
00081 
00082 /*
00083  * WLAN mode
00084 */
00085 typedef enum {
00086   WLAN_MODE_STOP = 0,
00087   WLAN_MODE_STATION,
00088   WLAN_MODE_ADHOC
00089 } WLAN_MODE; 
00090 
00091 /*
00092  * Port status
00093  */
00094 typedef enum {
00095   WLAN_STATUS_PORT_DISABLE   = 1,
00096   WLAN_STATUS_PORT_SEARCHING = 2,
00097   WLAN_STATUS_PORT_CONN_IBSS = 3,
00098   WLAN_STATUS_PORT_CONN_ESS  = 4,
00099   WLAN_STATUS_PORT_OOR_ESS   = 5
00100 } WLAN_STATUS_PORT;
00101 
00102 /*
00103  * WLAN_WEP
00104 */
00105 typedef enum {
00106   WLAN_USE_NO_WEP     = 0,
00107   WLAN_USE_64BIT_WEP  = 5,
00108   WLAN_USE_128BIT_WEP = 13  
00109 } WLAN_WEP;
00110 
00111 typedef struct _wlan_wep_key {
00112   uint8_t  KeyLen;
00113   uint8_t  Key[WLAN_WEP_MAX_KEY_SIZE];
00114 } WLAN_WEP_KEY;
00115 
00116 typedef struct _wlan_config {
00117   uint16_t       Size;
00118   WLAN_MODE     Mode;
00119   char          Networkname[WLAN_NETWORK_NAME_MAX_LEN];
00120   WLAN_WEP      UseWEP;
00121   uint8_t        UseWEPTxKey;
00122   WLAN_WEP_KEY  WEPKey[WLAN_WEP_MAX_KEY_COUNT];
00123 } WLAN_CONFIG;
00124 
00125 typedef struct _wlan_status {
00126   uint8_t            Size;
00127   WLAN_STATUS_PORT  PortStatus;       // Current port status
00128   uint8_t            BSSIDAddress[6];  // MAC address of the AP?
00129   uint8_t            Channel;          // Current Channel
00130   uint8_t            TxRate;           // Current TxRate
00131   uint16_t           Quality;          // Quality in dBm
00132   uint16_t           Signal;           // Signal in dBm negative value
00133   uint16_t           Noise;            // Noise in dBm negative value
00134 } WLAN_STATUS;
00135 
00136 /*-------------------------------------------------------------------------*/
00137 /* global macros                                                           */
00138 /*-------------------------------------------------------------------------*/
00139 
00140 /*-------------------------------------------------------------------------*/
00141 /* Prototypes                                                              */
00142 /*-------------------------------------------------------------------------*/
00143 
00144 /*
00145  * Driver routines.
00146 */
00147 extern int WlanInit(NUTDEVICE * dev);
00148 extern int WlanIOCtl(NUTDEVICE * dev, int req, void *conf);
00149 extern int WlanOutput(NUTDEVICE * dev, NETBUF * nb);
00150 
00151 #endif /* !__WLAN_H__ */