wifi_scan_list.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
20 #ifndef NET_WIFI_SCAN_LIST_H
21 #define NET_WIFI_SCAN_LIST_H
22 
23 #include <stddef.h>
24 
25 #include "l2scan_list.h"
26 #include "net/netdev/wifi.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
39 static inline void wifi_scan_list_empty(wifi_scan_list_t *list,
40  wifi_scan_list_node_t *nodes,
41  unsigned nodes_numof)
42 {
43  l2scan_list_empty(list, &nodes->node, nodes_numof,
44  sizeof(wifi_scan_list_node_t));
45 }
46 
55 static inline void wifi_scan_list_insert(wifi_scan_list_t *list,
56  wifi_scan_list_node_t *nodes,
57  unsigned nodes_numof,
58  const wifi_scan_result_t *result)
59 {
60  l2scan_list_insert(list, &nodes->node, nodes_numof,
61  sizeof(wifi_scan_list_node_t), &result->base);
62 }
63 
73 static inline unsigned wifi_scan_list_to_array(const wifi_scan_list_t *list,
74  wifi_scan_result_t *array,
75  unsigned numof)
76 {
77  return l2scan_list_to_array(list, array, numof,
78  sizeof(wifi_scan_list_node_t));
79 }
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif /* NET_WIFI_SCAN_LIST_H */
Definitions for netdev common Wi-Fi code.
unsigned l2scan_list_to_array(const l2scan_list_t *list, void *nodes_array, unsigned nodes_numof, size_t node_size)
Copy the content of a L2 scan list to an array to get rid of the list overhead.
void l2scan_list_empty(l2scan_list_t *list, list_node_t *nodes, unsigned nodes_numof, size_t node_size)
Empty the list to start a new scan.
void l2scan_list_insert(l2scan_list_t *list, list_node_t *nodes, unsigned nodes_numof, size_t node_size, const netopt_scan_result_t *result)
Insert a new scan result into the list.
static void wifi_scan_list_empty(wifi_scan_list_t *list, wifi_scan_list_node_t *nodes, unsigned nodes_numof)
Empty the WiFi scan list to start a new scan.
static void wifi_scan_list_insert(wifi_scan_list_t *list, wifi_scan_list_node_t *nodes, unsigned nodes_numof, const wifi_scan_result_t *result)
Insert a new WiFi scan result into the list.
static unsigned wifi_scan_list_to_array(const wifi_scan_list_t *list, wifi_scan_result_t *array, unsigned numof)
Copy the content of a WiFi scan list to an array to get rid of the list overhead.
L2 Scan list API.
Type of a Link Layer scan list.
Definition: l2scan_list.h:37
Node type in a wifi scan list wifi_scan_list_t.
Definition: wifi.h:96
list_node_t node
Basic list node.
Definition: wifi.h:97
A Wi-Fi scan result.
Definition: wifi.h:56
netopt_scan_result_t base
Basic scan result.
Definition: wifi.h:57