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