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