Loading...
Searching...
No Matches
wifi.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Fabian Hüßler ML!PA Consulting GmbH
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for
6 * more details.
7 */
8
20#ifndef NET_NETDEV_WIFI_H
21#define NET_NETDEV_WIFI_H
22
23#include "net/ethernet/hdr.h"
24#include "net/netopt.h"
25#include "net/wifi.h"
26#include "net/l2scan_list.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
39
47#define WIFI_SCAN_REQUEST_INITIALIZER(ch, cb, ms) \
48 (wifi_scan_request_t) { \
49 .base = NETOPT_SCAN_REQUEST_INITIALIZER(ch, cb), \
50 .timeout_ms_per_ch = ms, \
51 }
52
62
70#define WIFI_SCAN_RESULT_INITIALIZER(ch, str, sec) \
71 (wifi_scan_result_t) { \
72 .base = NETOPT_SCAN_RESULT_INITIALIZER(ch, str), \
73 .sec_mode = sec, \
74 .bssid = { 0 }, \
75 .ssid = { 0 }, \
76 }
77
82
88#define WIFI_SCAN_LIST_INITIALIZER(list) \
89 (wifi_scan_list_t) { \
90 .head = (list_node_t *)list, \
91 }
92
100
104typedef void (*wifi_on_scan_result_t) (void *netif, const wifi_scan_list_t *res);
105
114
123#define WIFI_CONNECT_REQUEST_INITIALIZER(ch, ccb, dcb, cr) \
124 (wifi_connect_request_t) { \
125 .base = NETOPT_CONNECT_REQUEST_INITIALIZER(ch, ccb, dcb), \
126 .cred = cr, \
127 .ssid = { 0 }, \
128 }
129
143
150#define WIFI_CONNECT_RESULT_INITIALIZER(ch, p_ssid) \
151 (wifi_connect_result_t) { \
152 .base = NETOPT_CONNECT_RESULT_INITIALIZER(ch), \
153 .ssid = p_ssid, \
154 .credentials = { .sec = WIFI_SECURITY_MODE_OPEN }, \
155 }
156
160typedef void (*wifi_on_connect_result_t) (void *netif, const wifi_connect_result_t *res);
161
168
174#define WIFI_DISCONNECT_REQUEST_INITIALIZER(dcb) \
175 (wifi_disconnect_request_t) { \
176 .base = NETOPT_DISCONNECT_REQUEST_INITIALIZER(dcb), \
177 }
178
186
193#define WIFI_DISCONNECT_RESULT_INITIALIZER(ch, p_ssid) \
194 (wifi_disconnect_result_t) { \
195 .base = NETOPT_DISCONNECT_RESULT_INITIALIZER(ch), \
196 .ssid = p_ssid, \
197 }
198
202typedef void (*wifi_on_disconnect_result_t) (void *netif, const wifi_disconnect_result_t *res);
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* NET_NETDEV_WIFI_H */
struct wifi_scan_list_node wifi_scan_list_node_t
Node type in a wifi scan list wifi_scan_list_t.
struct wifi_scan_result wifi_scan_result_t
A Wi-Fi scan result.
struct wifi_disconnect_result wifi_disconnect_result_t
A Wi-Fi disconnect result.
void(* wifi_on_scan_result_t)(void *netif, const wifi_scan_list_t *res)
Wi-Fi scan result callback prototype.
Definition wifi.h:104
void(* wifi_on_connect_result_t)(void *netif, const wifi_connect_result_t *res)
Wi-Fi connect result callback prototype.
Definition wifi.h:160
l2scan_list_t wifi_scan_list_t
A Wi-Fi scan list.
Definition wifi.h:81
void(* wifi_on_disconnect_result_t)(void *netif, const wifi_disconnect_result_t *res)
Wi-Fi disconnect result callback prototype.
Definition wifi.h:202
struct wifi_connect_request wifi_connect_request_t
A Wi-Fi connect request.
struct wifi_disconnect_request wifi_disconnect_request_t
A Wi-Fi disconnect request.
struct wifi_connect_result wifi_connect_result_t
A Wi-Fi connect result.
struct wifi_scan_request wifi_scan_request_t
A Wi-Fi scan request.
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
Definition hdr.h:32
wifi_security_mode_t
Type to express a Wi-Fi security mode.
Definition wifi.h:105
#define WIFI_SSID_LEN_MAX
Maximum length of an SSID.
Definition wifi.h:115
L2 Scan list API.
Ethernet header definitions.
Definition of global configuration options.
Type of a Link Layer scan list.
Definition l2scan_list.h:37
List node structure.
Definition list.h:40
Basic network connect request.
Definition netopt.h:1038
Basic network connect result.
Definition netopt.h:994
Basic network disconnect request.
Definition netopt.h:1061
Basic disconnect result.
Definition netopt.h:1011
Basic network scan request.
Definition netopt.h:974
Basic network scan result.
Definition netopt.h:942
A Wi-Fi connect request.
Definition wifi.h:109
char ssid[WIFI_SSID_LEN_MAX+1]
SSID of AP to connect to.
Definition wifi.h:112
netopt_connect_request_t base
Basic connect request.
Definition wifi.h:110
const wifi_security_mode_t * cred
Pointer to credentials.
Definition wifi.h:111
A Wi-Fi connect result.
Definition wifi.h:133
wifi_security_mode_t sec
WiFi security mode.
Definition wifi.h:137
wifi_security_wep_psk_t wep
WEP security mode.
Definition wifi.h:139
wifi_security_wpa_enterprise_t wpa_enterprise
WPA2 enterprise security mode.
Definition wifi.h:140
wifi_security_wpa_psk_t wpa_psk
WPA2 PSK security mode.
Definition wifi.h:138
const char * ssid
SSID of currently connected AP.
Definition wifi.h:135
union wifi_connect_result::@229 credentials
Credentials.
netopt_connect_result_t base
Basic connect result.
Definition wifi.h:134
A Wi-Fi disconnect request.
Definition wifi.h:165
netopt_disconnect_request_t base
Basic disconnect request.
Definition wifi.h:166
A Wi-Fi disconnect result.
Definition wifi.h:182
const char * ssid
SSID of the AP no longer connected to.
Definition wifi.h:184
netopt_disconnect_result_t base
Basic disconnect result.
Definition wifi.h:183
Node type in a wifi scan list wifi_scan_list_t.
Definition wifi.h:96
wifi_scan_result_t result
Wi-Fi scan result.
Definition wifi.h:98
list_node_t node
Basic list node.
Definition wifi.h:97
A Wi-Fi scan request.
Definition wifi.h:35
uint16_t timeout_ms_per_ch
timeout for each channel to scan
Definition wifi.h:37
netopt_scan_request_t base
Basic scan request.
Definition wifi.h:36
A Wi-Fi scan result.
Definition wifi.h:56
wifi_security_mode_t sec_mode
Security mode of AP.
Definition wifi.h:58
uint8_t bssid[ETHERNET_ADDR_LEN]
BSSID of AP.
Definition wifi.h:59
netopt_scan_result_t base
Basic scan result.
Definition wifi.h:57
char ssid[WIFI_SSID_LEN_MAX+1]
SSID of AP.
Definition wifi.h:60
A WEP pre-shared-key.
Definition wifi.h:148
WPA2 Enterprise credentials.
Definition wifi.h:156
A WPA pre-shared-key.
Definition wifi.h:140
Definitions for Wi-Fi.