[ab365c4] | 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 |
|
---|
| 29 | /** @addtogroup libnet
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | /** @file ieee80211.h
|
---|
| 34 | *
|
---|
| 35 | * IEEE 802.11 interface definition.
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | #ifndef LIBNET_IEEE80211_H
|
---|
| 39 | #define LIBNET_IEEE80211_H
|
---|
| 40 |
|
---|
| 41 | #include <ddf/driver.h>
|
---|
| 42 | #include <sys/types.h>
|
---|
| 43 |
|
---|
| 44 | /** Initial channel frequency. */
|
---|
| 45 | #define IEEE80211_FIRST_CHANNEL 2412
|
---|
| 46 |
|
---|
| 47 | /** Max supported channel frequency. */
|
---|
| 48 | #define IEEE80211_MAX_CHANNEL 2472
|
---|
| 49 |
|
---|
| 50 | /* Gap between IEEE80211 channels in MHz. */
|
---|
| 51 | #define IEEE80211_CHANNEL_GAP 5
|
---|
| 52 |
|
---|
| 53 | struct ieee80211_dev;
|
---|
| 54 |
|
---|
| 55 | /** Device operating modes. */
|
---|
| 56 | typedef enum {
|
---|
| 57 | IEEE80211_OPMODE_ADHOC,
|
---|
| 58 | IEEE80211_OPMODE_MESH,
|
---|
| 59 | IEEE80211_OPMODE_AP,
|
---|
| 60 | IEEE80211_OPMODE_STATION
|
---|
| 61 | } ieee80211_operating_mode_t;
|
---|
| 62 |
|
---|
| 63 | /** IEEE 802.11 functions. */
|
---|
| 64 | typedef struct {
|
---|
| 65 | int (*start)(struct ieee80211_dev *);
|
---|
| 66 | int (*scan)(struct ieee80211_dev *);
|
---|
| 67 | } ieee80211_ops_t;
|
---|
| 68 |
|
---|
| 69 | /** IEEE 802.11 WiFi device structure. */
|
---|
| 70 | typedef struct ieee80211_dev {
|
---|
| 71 | /** Backing DDF device. */
|
---|
| 72 | ddf_dev_t *ddf_dev;
|
---|
| 73 |
|
---|
| 74 | /** Pointer to implemented IEEE 802.11 operations. */
|
---|
| 75 | ieee80211_ops_t *ops;
|
---|
| 76 |
|
---|
| 77 | /** Pointer to driver specific data. */
|
---|
| 78 | void *driver_data;
|
---|
| 79 | } ieee80211_dev_t;
|
---|
| 80 |
|
---|
| 81 | extern int ieee80211_device_init(ieee80211_dev_t *ieee80211_dev,
|
---|
| 82 | void *driver_data, ddf_dev_t *ddf_dev);
|
---|
| 83 | extern int ieee80211_init(ieee80211_dev_t *ieee80211_dev,
|
---|
| 84 | ieee80211_ops_t *ieee80211_ops);
|
---|
| 85 |
|
---|
| 86 | #endif /* LIBNET_IEEE80211_H */
|
---|
| 87 |
|
---|
| 88 | /** @}
|
---|
| 89 | */
|
---|