xref: /freebsd/contrib/wpa/src/common/ocv.h (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1 /*
2  * Operating Channel Validation (OCV)
3  * Copyright (c) 2018, Mathy Vanhoef
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef OCV_H
10 #define OCV_H
11 
12 struct wpa_channel_info;
13 
14 struct oci_info {
15 	/* Values in the OCI element */
16 	u8 op_class;
17 	u8 channel;
18 	u8 seg1_idx;
19 
20 	/* Derived values for easier verification */
21 	int freq;
22 	int sec_channel;
23 	int chanwidth;
24 };
25 
26 #define OCV_OCI_LEN		3
27 #define OCV_OCI_EXTENDED_LEN	(3 + OCV_OCI_LEN)
28 #define OCV_OCI_KDE_LEN		(2 + RSN_SELECTOR_LEN + OCV_OCI_LEN)
29 
30 extern char ocv_errorstr[256];
31 
32 int ocv_derive_all_parameters(struct oci_info *oci);
33 int ocv_insert_oci(struct wpa_channel_info *ci, u8 **argpos);
34 int ocv_insert_oci_kde(struct wpa_channel_info *ci, u8 **argpos);
35 int ocv_insert_extended_oci(struct wpa_channel_info *ci, u8 *pos);
36 int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
37 			 struct wpa_channel_info *ci, int tx_chanwidth,
38 			 int tx_seg1_idx);
39 
40 #endif /* OCV_H */
41