source: mainline/uspace/lib/ieee80211/include/ieee80211.h@ a35b458

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since a35b458 was a35b458, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 8 years ago

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

  • Property mode set to 100644
File size: 6.7 KB
RevLine 
[59fa7ab]1/*
2 * Copyright (c) 2015 Jan Kolarik
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
[8a64320e]29/**
[59fa7ab]30 * @addtogroup libieee80211
31 * @{
32 */
33/**
34 * @file ieee80211.h
35 * @brief Public header exposing IEEE 802.11 to drivers.
36 */
37
38#ifndef LIB_IEEE80211_H
39#define LIB_IEEE80211_H
40
41#include <ddf/driver.h>
42#include <nic.h>
43#include <ops/ieee80211.h>
44
[8a64320e]45#define DEVICE_CATEGORY_IEEE80211 "ieee80211"
[59fa7ab]46
47struct ieee80211_dev;
48typedef struct ieee80211_dev ieee80211_dev_t;
49
50/** Initial channel frequency. */
[8a64320e]51#define IEEE80211_FIRST_FREQ 2412
[59fa7ab]52
53/** Max supported channel frequency. */
[8a64320e]54#define IEEE80211_MAX_FREQ 2472
[59fa7ab]55
[8a64320e]56/** Gap between IEEE80211 channels in MHz. */
57#define IEEE80211_CHANNEL_GAP 5
[59fa7ab]58
[8a64320e]59/** Max AMPDU factor. */
60#define IEEE80211_MAX_AMPDU_FACTOR 13
[1dcc0b9]61
[8a64320e]62/** Max authentication password length. */
63#define IEEE80211_MAX_PASSW_LEN 64
[1dcc0b9]64
65/** IEEE 802.11 b/g supported data rates in units of 500 kb/s. */
66static const uint8_t ieee80211bg_data_rates[] = {
67 2, 4, 11, 12, 18, 22, 24, 36, 48, 72, 96, 108
68};
69
[59fa7ab]70/** Device operating modes. */
71typedef enum {
72 IEEE80211_OPMODE_ADHOC,
73 IEEE80211_OPMODE_MESH,
74 IEEE80211_OPMODE_AP,
75 IEEE80211_OPMODE_STATION
76} ieee80211_operating_mode_t;
77
[1dcc0b9]78/** Key flags. */
79typedef enum {
80 IEEE80211_KEY_FLAG_TYPE_PAIRWISE = 0x01,
81 IEEE80211_KEY_FLAG_TYPE_GROUP = 0x02
82} ieee80211_key_flags_t;
83
[a931b7b]84typedef enum {
85 IEEE80211_TKIP_TX_MIC_OFFSET = 16,
86 IEEE80211_TKIP_RX_MIC_OFFSET = 24
87} ieee80211_tkip_mic_offset_t;
88
[1dcc0b9]89/** Key config structure. */
90typedef struct {
91 uint8_t id;
92 uint8_t flags;
93 ieee80211_security_suite_t suite;
94 uint8_t data[32];
95} ieee80211_key_config_t;
96
[59fa7ab]97/** IEEE 802.11 callback functions. */
98typedef struct {
[8a64320e]99 /** unction that is called at device initalization.
100 *
101 * This should get device into running state.
102 *
[59fa7ab]103 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]104 *
[cde999a]105 * @return EOK if succeed, error code otherwise.
[8a64320e]106 *
[59fa7ab]107 */
[b7fd2a0]108 errno_t (*start)(struct ieee80211_dev *);
[a35b458]109
[8a64320e]110 /** Scan neighborhood for networks.
111 *
112 * There should be implemented scanning of whole bandwidth.
113 * Incoming results are processed by IEEE 802.11 framework itself.
114 *
[59fa7ab]115 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]116 *
[cde999a]117 * @return EOK if succeed, error code otherwise.
[8a64320e]118 *
[59fa7ab]119 */
[b7fd2a0]120 errno_t (*scan)(struct ieee80211_dev *);
[a35b458]121
[8a64320e]122 /** Handler for TX frames to be send from device.
123 *
124 * This should be called for every frame that has to be send
125 * from IEEE 802.11 device.
126 *
[59fa7ab]127 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]128 * @param buffer Buffer with data to be send.
129 * @param buffer_size Size of buffer.
130 *
[cde999a]131 * @return EOK if succeed, error code otherwise.
[8a64320e]132 *
[59fa7ab]133 */
[b7fd2a0]134 errno_t (*tx_handler)(struct ieee80211_dev *, void *, size_t);
[a35b458]135
[8a64320e]136 /** Set device operating frequency to given value.
137 *
[59fa7ab]138 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]139 * @param freq New device operating frequency.
140 *
[cde999a]141 * @return EOK if succeed, error code otherwise.
[8a64320e]142 *
[59fa7ab]143 */
[b7fd2a0]144 errno_t (*set_freq)(struct ieee80211_dev *, uint16_t);
[a35b458]145
[8a64320e]146 /** Callback to inform device about BSSID change.
147 *
[1dcc0b9]148 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]149 * @param connected True if connected to new BSSID, otherwise false.
150 *
[cde999a]151 * @return EOK if succeed, error code otherwise.
[8a64320e]152 *
[1dcc0b9]153 */
[b7fd2a0]154 errno_t (*bssid_change)(struct ieee80211_dev *, bool);
[a35b458]155
[8a64320e]156 /** Callback to setup encryption key in IEEE 802.11 device.
157 *
[1dcc0b9]158 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
[8a64320e]159 * @param key_conf Key config structure.
160 * @param insert True to insert this key to device,
161 * false to remove it.
162 *
[cde999a]163 * @return EOK if succeed, error code otherwise.
[8a64320e]164 *
[1dcc0b9]165 */
[b7fd2a0]166 errno_t (*key_config)(struct ieee80211_dev *,
[8a64320e]167 ieee80211_key_config_t *key_conf, bool);
[59fa7ab]168} ieee80211_ops_t;
169
170/* Initialization functions. */
171extern ieee80211_dev_t *ieee80211_device_create(void);
[b7fd2a0]172extern errno_t ieee80211_device_init(ieee80211_dev_t *, ddf_dev_t *);
173extern errno_t ieee80211_init(ieee80211_dev_t *, ieee80211_ops_t *,
[8a64320e]174 ieee80211_iface_t *, nic_iface_t *, ddf_dev_ops_t *);
[59fa7ab]175
176/* Getters & setters, queries & reports. */
[8a64320e]177extern void *ieee80211_get_specific(ieee80211_dev_t *);
178extern void ieee80211_set_specific(ieee80211_dev_t *, void *);
179extern ddf_dev_t *ieee80211_get_ddf_dev(ieee80211_dev_t *);
180extern ieee80211_operating_mode_t
181 ieee80211_query_current_op_mode(ieee80211_dev_t *);
182extern uint16_t ieee80211_query_current_freq(ieee80211_dev_t *);
183extern void ieee80211_query_bssid(ieee80211_dev_t *, nic_address_t *);
184extern bool ieee80211_is_connected(ieee80211_dev_t *);
185extern void ieee80211_report_current_op_mode(ieee80211_dev_t *,
186 ieee80211_operating_mode_t);
187extern void ieee80211_report_current_freq(ieee80211_dev_t *, uint16_t);
188extern uint16_t ieee80211_get_aid(ieee80211_dev_t *);
189extern int ieee80211_get_pairwise_security(ieee80211_dev_t *);
190extern bool ieee80211_is_ready(ieee80211_dev_t *);
191extern void ieee80211_set_ready(ieee80211_dev_t *, bool);
192extern bool ieee80211_query_using_key(ieee80211_dev_t *);
193extern void ieee80211_setup_key_confirm(ieee80211_dev_t *, bool);
194
195extern bool ieee80211_is_data_frame(uint16_t);
196extern bool ieee80211_is_mgmt_frame(uint16_t);
197extern bool ieee80211_is_beacon_frame(uint16_t);
198extern bool ieee80211_is_probe_response_frame(uint16_t);
199extern bool ieee80211_is_auth_frame(uint16_t);
200extern bool ieee80211_is_assoc_response_frame(uint16_t);
[59fa7ab]201
202/* Worker functions. */
[b7fd2a0]203extern errno_t ieee80211_rx_handler(ieee80211_dev_t *, void *, size_t);
[59fa7ab]204
[8a64320e]205#endif
[59fa7ab]206
207/** @}
208 */
Note: See TracBrowser for help on using the repository browser.