wifi_scan_list.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2023 ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #include <stddef.h>
21 
22 #include "l2scan_list.h"
23 #include "net/netdev/wifi.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
36 static inline void wifi_scan_list_empty(wifi_scan_list_t *list,
37  wifi_scan_list_node_t *nodes,
38  unsigned nodes_numof)
39 {
40  l2scan_list_empty(list, &nodes->node, nodes_numof,
41  sizeof(wifi_scan_list_node_t));
42 }
43 
52 static inline void wifi_scan_list_insert(wifi_scan_list_t *list,
53  wifi_scan_list_node_t *nodes,
54  unsigned nodes_numof,
55  const wifi_scan_result_t *result)
56 {
57  l2scan_list_insert(list, &nodes->node, nodes_numof,
58  sizeof(wifi_scan_list_node_t), &result->base);
59 }
60 
70 static inline unsigned wifi_scan_list_to_array(const wifi_scan_list_t *list,
71  wifi_scan_result_t *array,
72  unsigned numof)
73 {
74  return l2scan_list_to_array(list, array, numof,
75  sizeof(wifi_scan_list_node_t));
76 }
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
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:33
Node type in a wifi scan list wifi_scan_list_t.
Definition: wifi.h:95
list_node_t node
Basic list node.
Definition: wifi.h:96
A Wi-Fi scan result.
Definition: wifi.h:55
netopt_scan_result_t base
Basic scan result.
Definition: wifi.h:56