wlan.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /****************************************************************************
  2. * This file is part of the WLAN-Ethernut device driver.
  3. *
  4. * Copyright (c) 2004 by Michael Fischer. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the author nor the names of its contributors may
  16. * be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  23. * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. ****************************************************************************
  33. * History:
  34. *
  35. * 27.01.04 mifi First Version
  36. ****************************************************************************/
  37. #ifndef __WLAN_H__
  38. #define __WLAN_H__
  39. #include <dev/netbuf.h>
  40. #include <net/if_var.h>
  41. /*
  42. * Available drivers.
  43. */
  44. extern NUTDEVICE devWlan;
  45. /*-------------------------------------------------------------------------*/
  46. /* global defines */
  47. /*-------------------------------------------------------------------------*/
  48. #ifndef DEV_ETHER
  49. #define DEV_ETHER devWlan
  50. #endif
  51. /*
  52. * Networkname
  53. */
  54. #define WLAN_NETWORK_NAME_MAX_LEN 32
  55. /*
  56. * WEP
  57. */
  58. #define WLAN_WEP_MAX_KEY_COUNT 4
  59. #define WLAN_WEP_MAX_KEY_SIZE 16
  60. /*-------------------------------------------------------------------------*/
  61. /* global types */
  62. /*-------------------------------------------------------------------------*/
  63. /*
  64. * IOCTL commands
  65. */
  66. typedef enum {
  67. WLAN_IOCTL_GET_MAC_ADDRESS = 1,
  68. WLAN_IOCTL_SET_CONFIG,
  69. WLAN_IOCTL_GET_STATUS
  70. } WLAN_IOCTL;
  71. /*
  72. * WLAN mode
  73. */
  74. typedef enum {
  75. WLAN_MODE_STOP = 0,
  76. WLAN_MODE_STATION,
  77. WLAN_MODE_ADHOC
  78. } WLAN_MODE;
  79. /*
  80. * Port status
  81. */
  82. typedef enum {
  83. WLAN_STATUS_PORT_DISABLE = 1,
  84. WLAN_STATUS_PORT_SEARCHING = 2,
  85. WLAN_STATUS_PORT_CONN_IBSS = 3,
  86. WLAN_STATUS_PORT_CONN_ESS = 4,
  87. WLAN_STATUS_PORT_OOR_ESS = 5
  88. } WLAN_STATUS_PORT;
  89. /*
  90. * WLAN_WEP
  91. */
  92. typedef enum {
  93. WLAN_USE_NO_WEP = 0,
  94. WLAN_USE_64BIT_WEP = 5,
  95. WLAN_USE_128BIT_WEP = 13
  96. } WLAN_WEP;
  97. typedef struct _wlan_wep_key {
  98. u_char KeyLen;
  99. u_char Key[WLAN_WEP_MAX_KEY_SIZE];
  100. } WLAN_WEP_KEY;
  101. typedef struct _wlan_config {
  102. u_short Size;
  103. WLAN_MODE Mode;
  104. char Networkname[WLAN_NETWORK_NAME_MAX_LEN];
  105. WLAN_WEP UseWEP;
  106. u_char UseWEPTxKey;
  107. WLAN_WEP_KEY WEPKey[WLAN_WEP_MAX_KEY_COUNT];
  108. } WLAN_CONFIG;
  109. typedef struct _wlan_status {
  110. u_char Size;
  111. WLAN_STATUS_PORT PortStatus; // Current port status
  112. u_char BSSIDAddress[6]; // MAC address of the AP?
  113. u_char Channel; // Current Channel
  114. u_char TxRate; // Current TxRate
  115. u_short Quality; // Quality in dBm
  116. u_short Signal; // Signal in dBm negative value
  117. u_short Noise; // Noise in dBm negative value
  118. } WLAN_STATUS;
  119. /*-------------------------------------------------------------------------*/
  120. /* global macros */
  121. /*-------------------------------------------------------------------------*/
  122. /*-------------------------------------------------------------------------*/
  123. /* Prototypes */
  124. /*-------------------------------------------------------------------------*/
  125. /*
  126. * Driver routines.
  127. */
  128. extern int WlanInit(NUTDEVICE * dev);
  129. extern int WlanIOCtl(NUTDEVICE * dev, int req, void *conf);
  130. extern int WlanOutput(NUTDEVICE * dev, NETBUF * nb);
  131. #endif /* !__WLAN_H__ */