1/* 2 * WPS Enrollee API 3 * 4 * Copyright (C) 2013, Broadcom Corporation 5 * All Rights Reserved. 6 * 7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; 8 * the contents of this file may not be disclosed to third parties, copied 9 * or duplicated in any form, in whole or in part, without the prior 10 * written permission of Broadcom Corporation. 11 * 12 * $Id: wps_enrapi.h 383924 2013-02-08 04:14:39Z $ 13 */ 14 15#ifndef __WPS_ENROLLEE_API_H__ 16#define __WPS_ENROLLEE_API_H__ 17 18#include <wps_devinfo.h> 19 20/* eap state machine states */ 21enum { 22 INIT = 0, 23 EAPOL_START_SENT, 24 EAP_IDENTITY_SENT, 25 PROCESSING_PROTOCOL, 26 REG_SUCCESSFUL, 27 REG_FAILED, 28 EAP_TIMEOUT, 29 EAP_FAILURE 30}; 31 32/* returned to callers of process_registrar_message or process_timers */ 33enum { 34 INTERNAL_ERROR = 0, /* internal processing erro (eap not initialized ..) */ 35 REG_SUCCESS, /* registration completed */ 36 REG_FAILURE /* registration failed */ 37}; 38 39enum { 40 PBC_NOT_FOUND = 0, 41 PBC_FOUND_OK, 42 PBC_OVERLAP, 43 PBC_TIMEOUT 44}; 45 46/* AuthorizedMAC */ 47enum { 48 AUTHO_MAC_NOT_FOUND = 0, 49 AUTHO_MAC_PIN_FOUND, 50 AUTHO_MAC_PBC_FOUND, 51 AUTHO_MAC_WC_PIN_FOUND, 52 AUTHO_MAC_WC_PBC_FOUND, 53 AUTHO_MAC_TIMEOUT 54}; 55 56#define ENCRYPT_NONE 1 57#define ENCRYPT_WEP 2 58#define ENCRYPT_TKIP 4 59#define ENCRYPT_AES 8 60typedef struct wps_ap_list_info { 61 bool used; 62 uint8 ssid[SIZE_SSID_LENGTH]; 63 uint8 ssidLen; 64 uint8 BSSID[6]; 65 uint8 *ie_buf; 66 uint32 ie_buflen; 67 uint8 channel; 68 uint16 band; 69 uint8 wep; 70 uint8 scstate; 71 uint8 version2; /* WSC 2.0 support */ 72 uint8 authorizedMACs[SIZE_MAC_ADDR * 5]; /* WSC 2.0 authorizedMACS */ 73} wps_ap_list_info_t; 74 75uint32 wpssta_enr_init(DevInfo *user_info); 76uint32 wpssta_reg_init(DevInfo *user_info, char *nwKey, char *bssid); 77bool wps_is_wep_incompatible(bool role_reg); 78void wps_cleanup(void); 79uint32 wpssta_start_enrollment(char *dev_pin, unsigned long time); 80uint32 wpssta_start_enrollment_devpwid(char *dev_pin, uint16 devicepwid, unsigned long time); 81uint32 wpssta_start_registration(char *ap_pin, unsigned long time); 82uint32 wpssta_start_registration_devpwid(char *ap_pin, uint8 *pub_key_hash, uint16 devicepwid, 83 unsigned long time); 84void wpssta_get_credentials(WpsEnrCred* credential, const char *ssid, int len); 85void wpssta_get_reg_M7credentials(WpsEnrCred* credential); 86void wpssta_get_reg_M8credentials(WpsEnrCred* credential); 87int wps_process_ap_msg(char *eapol_msg, int len); 88 89int wps_get_msg_to_send(char **data, uint32 time); 90int wps_get_eapol_msg_to_send(char **data, uint32 time); 91int wps_get_retrans_msg_to_send(char **data, uint32 time, char *mtype); 92int wps_get_frag_msg_to_send(char **data, uint32 time); 93 94int wps_eap_check_timer(uint32 time); 95int wps_get_aplist(wps_ap_list_info_t *list_in, wps_ap_list_info_t *list_out); 96int wps_get_pin_aplist(wps_ap_list_info_t *list_in, wps_ap_list_info_t *list_out); 97int wps_get_pbc_ap(wps_ap_list_info_t *list_in, char *bssid, char *ssid, uint8 *wep, 98 unsigned long time, char start); 99int wps_get_amac_ap(wps_ap_list_info_t *list_in, uint8 *mac, char wildcard, char *bssid, 100 char *ssid, uint8 *wep, unsigned long time, char start); 101uint32 wps_build_pbc_proberq(uint8 *buff, int len); 102uint32 wps_eap_send_msg(char * dataBuffer, uint32 dataLen); 103int wps_get_sent_msg_id(void); 104bool wps_get_select_reg(const wps_ap_list_info_t *ap_in); 105 106char* wps_get_msg_string(int mtype); 107int wps_get_recv_msg_id(void); 108int wps_get_eap_state(void); 109char wps_get_msg_type(char *eapol_msg, int len); 110bool wps_validateChecksum(IN unsigned long int PIN); 111uint32 wps_update_RFBand(uint8 rfBand); 112 113/* WSC 2.0 */ 114uint32 wps_build_def_proberq(uint8 *buff, int len); 115uint32 wps_build_def_assocrq(uint8 *buff, int len); 116 117#ifdef WFA_WPS_20_TESTBED 118uint32 wps_update_partial_ie(uint8 *buff, int buflen, uint8 *ie, uint8 ie_len, 119 uint8 *updie, uint8 updie_len); 120int sta_eap_sm_set_eap_frag_threshold(int eap_frag_threshold); 121#endif /* WFA_WPS_20_TESTBED */ 122 123#endif /* __WPS_ENROLLEE_API_H__ */ 124