Files
2026-07-30 11:19:44 +05:30

1324 lines
45 KiB
C

/* ipwps_public.h - IPWPS Public header file */
/*
* Copyright (c) 2008 Wind River Systems, Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*
*/
/*
modification history
--------------------
01c,05mar09,mry Add priliminary enrollee support
01b,12feb09,hfc add Ipwps_drv_msg struct
01a,24Dec08,mry Created
*/
#ifndef IPWPS_PUBLIC_H
#define IPWPS_PUBLIC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/* This header file is to be included by internal modules as well as external
* applications using ipwps. It defines the public structures and APIs for the
* ipwps module.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipwps_sysvar.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#include <ipcom_sock.h>
#include <ipcom_ipd.h>
#include "ipwps_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef enum {
IPWPS_ROLE_NONE = 0,
IPWPS_ROLE_TESTAPP, /* VALID ONLY When debug mode is enabled */
IPWPS_ROLE_ENROLLEE,
IPWPS_ROLE_STANDALONE_AP,
IPWPS_ROLE_STANDALONE_REGISTRAR,
IPWPS_ROLE_AP_WITH_BUILTIN_REGISTRAR
#if IPWPS_NOT_SUPPORTED
,
IPWPS_ROLE_AP_WITH_EXT_WLANMGR_REGISTRAR
#endif
} Ipwps_role;
typedef enum {
/* MAKE SURE THESE STAY IN ASCENDING ORDER corresponding to Operational sequence */
IPWPSD_STATUS_ERROR = -1,
IPWPSD_STATUS_UNINTIALIZED = 0,
IPWPSD_STATUS_INITIALIZED,
IPWPSD_STATUS_CONFIGURED,
IPWPSD_STATUS_READY,
IPWPSD_STATUS_PENDING,
IPWPSD_STATUS_PROCESSING
} Ipwpsd_status;
typedef enum {
IPWPSD_MODULE_STATUS_NOT_PRESENT,
IPWPSD_MODULE_STATUS_UNINITIALIZED,
IPWPSD_MODULE_STATUS_INIT_NOTCONFIG,
IPWPSD_MODULE_STATUS_INIT_NOTSTARTED,
IPWPSD_MODULE_STATUS_READY,
IPWPSD_MODULE_STATUS_ERROR
} Ipwps_module_status;
typedef enum {
IPWPS_WPSSTATE_NOTCONFIG = 0x01,
IPWPS_WPSSTATE_CONFIG
} Ipwps_wps_state;
typedef struct Ipwps_module_info_st {
Ipwps_module_status status; /* Operational Status of the module */
Ip_bool enabled; /* Enable/Disable status of the module */
} Ipwps_module_info;
/* WPS Common Device Information */
typedef struct Ipwps_common_device_info_st {
Ip_bool valid;
char manufacturer[IPWPS_DEVICE_INFO_MANUFACTURER_STRLEN];
char model_name[IPWPS_DEVICE_INFO_STRLEN];
char model_number[IPWPS_DEVICE_INFO_STRLEN];
char serial_number[IPWPS_DEVICE_INFO_STRLEN];
Ipwps_device_type primary_dev_type;
char dev_name[IPWPS_DEVICE_INFO_STRLEN];
Ip_u32 osversion; /* Stores value of os version used by WPS */
} Ipwps_common_device_info;
/* WPS AP Information */
typedef struct Ipwps_ap_info_st {
Ipwps_ap_status status; /* AP Status */
Ip_bool ap_configured; /* Reflects the AP's WPS State: unconfigured or configured */
Ip_bool ap_locked; /* AP Locked flag */
Ip_bool sel_reg_set; /* Specifies if the Selected Registrar is set or not. */
Ip_u16 sel_reg_config_methods; /* Selected Registrar's Config Methods. */
Ip_u8 uuid_e[IPWPS_UUID_SIZE]; /* UUID of the AP. */
} Ipwps_ap_info;
/* WPS Enrollee Information */
typedef struct Ipwps_enrollee_info_st {
Ipwps_enrollee_status status; /* Enrollee runtime status */
Ipwps_enrollee_apjoin_status join_success; /* Indicates whether the Enrollee successfully joined an AP after successful completion of the WPS session */
Ip_u16 credential_setno; /* The Credential Set # used by the enrollee to successfully associate with the AP */
Ip_bool adhoc_support; /* Whether the Enrollee supports registering with a standalone Registrar in Adhoc mode */
Ip_bool auto_reg_init; /* Whether the Enrollee registration is initiated automatically or manually */
Ip_u8 mac_addr[6]; /* MAC Address of the enrolee (local or peer). */
Ip_u8 uuid_e[IPWPS_UUID_SIZE]; /* UUID of the enrollee (local or peer). */
} Ipwps_enrollee_info;
/* WPS Registrar Information */
typedef struct Ipwps_registrar_info_st {
Ipwps_registrar_status status; /* Registrar runtime status */
Ipwps_device_pwdid dev_pwdid; /* Registrar Device Password Id (when Selected) */
Ip_u8 uuid_r[IPWPS_UUID_SIZE]; /* UUID of the registrar (local or peer). */
Ip_bool reg_mode_on; /* Registrar's default Registration Mode. If TRUE, registrar will be started automatically */
Ip_bool offer_all_creds; /* Registrar's Credential offering mode.
* If TRUE, registrar will offer all credentiakls regardless of Enrollee's indicated capabilities.
*/
} Ipwps_registrar_info;
/* WPS Common Operational Information */
typedef struct Ipwps_coop_info_st {
char credentials_config_method[IPWPS_CREDENTIALS_CONFIG_METHOD_STRLEN]; /* Credentials Configuration Method
* (only valid if wps_credentials_module is enabled)
*/
Ipwps_credential_method cred_method; /* same as above but enum */
Ipwps_role wps_role; /* current role of the WPS module */
Ipwps_session_status session_status; /* Current WPS session status */
Ip_bool session_timedout; /* Set when a WPS session timeout occurs during the WPS registration protocol exchange */
Ipwps_peer_info peer_info; /* WPS Peer information */
Ip_u16 config_method; /* Selected Config Method for current WPS exchange */
Ip_u32 proto_version; /* Currently supported WPS Protocol version */
Ip_u8 wps_rfband; /* RF Band corrsponding to current wps exchange */
Ipwps_wps_state wps_state;
Ip_u16 assoc_state; /* Bit-ORed values from WPS "ASSOCIATION STATE" VALUES in "ipwps_common.h" */
Ip_u16 config_error; /* Bit-ORed values from WPS "CONFIGURATION ERROR" VALUES in "ipwps_common.h" */
} Ipwps_coop_info;
/* WPS Credentials */
typedef struct Ipwps_credential_set_st {
Ip_bool valid; /* IP_TRUE if this is a valid credential set, IP_FALSE otherwise */
Ip_bool donotoffer; /* Transient flag used to indicate that this credentials should not be used in the current WPS session offering */
char ssid[IPWPS_SSID_MAXLEN+1]; /* with room for a null terminating char */
Ip_u8 mac_addr[6];
Ip_u16 auth_type;
Ip_u16 encr_type;
Ip_u8 network_idx; /* defaults to 1 */
Ip_u8 netkey_idx; /* defaults to 1 */
Ip_u8 netkey[IPWPS_PROTO_NETWORK_KEY_MAXLEN]; /* We Only support 1 key */
Ip_u8 netkey_size;
Ip_bool enabled_8021x;
Ip_u8 eap_type[8]; /* Valid if enabled_8021x is TRUE */
char eap_id[IPWPS_MAX_EAP_ID_LEN+1]; /* Valid if enabled_8021x is TRUE, with room for a null terminating char that is not sent*/
Ip_bool key_auto; /* Inidcates whether the key was provided automatically */
} Ipwps_credential_set;
typedef struct Ipwps_credentials_st {
/* Credentials retrieved by the Enrollee */
Ip_u16 num_enrollee_creds;
Ipwps_credential_set enrollee_credentials[IPWPS_NUM_CEDENTIALS_MAX];
/* Credentials used by the resgistrar to send to enrollees */
Ip_u16 num_registrar_creds;
Ipwps_credential_set registrar_credentials[IPWPS_NUM_CEDENTIALS_MAX];
/* Credential set used by the AP to configure itself or used by registrar to send to a registering AP */
Ip_bool ap_creds;
Ipwps_credential_set ap_credentials;
} Ipwps_credentials;
typedef struct Ipwps_config_methods_info_st {
Ip_bool pbc_supported, pbc_enabled;
Ip_bool pin_supported, pin_enabled;
char pin_mode[IPWPS_PINMODE_MAXLEN];
} Ipwps_config_methods_info;
/* Public WPS Context portion */
typedef struct Ipwps_ctx_pub_st {
Ip_bool enabled; /* Global WPS enable/disable flag. */
Ipwpsd_status daemon_status; /* Indicates the current status of the wps daemon */
char if_name[IPWPS_MAX_IFNAME]; /* name of interface that WPS is currently bound to */
Ip_u8 if_mac_addr[6]; /* Mac address of interface that WPS is currently bound to */
char wsc_identity[IPWPS_MAX_WSC_ID_LEN]; /* EAP identity used in ipeap_wsc exchanges */
Ip_bool ip8021x_ok; /* IP8021X interface properly configured */
Ip_u32 ip8021x_inst; /* IP8021X instance for the wls_if */
Ipwps_module_info wps_config_methods_module; /* Module that supports the WPS Config Methods functionality */
Ipwps_module_info wps_protocol_module; /* Module that supports the WPS Protocol functionality */
Ipwps_module_info wps_credentials_module; /* Module that supports the WPS Credentials config and auto-gen */
Ipwps_module_info wps_enrollee_module; /* Module that supports the WPS Enrollee functionality */
Ipwps_module_info wps_ap_module; /* Module that supports the WPS AP functionality */
Ipwps_module_info wps_registrar_module; /* Module that supports the WPS Registrar functionality */
Ipwps_module_info wps_drv_module; /* Module that supports the WPS DRV interface */
Ipwps_config_methods_info cm_info; /* Config Method Info */
Ipwps_common_device_info local_dev_info; /* Local Common Device Info */
Ipwps_common_device_info peer_dev_info; /* Peer's Common Device Info */
Ipwps_ap_info ap_info; /* AP Info */
Ipwps_enrollee_info enrollee_info; /* Enrollee Info */
Ipwps_registrar_info registrar_info; /* Registrar Info */
Ipwps_coop_info coop_info; /* Common Operational Info */
Ipwps_capability_info cap_info; /* Our Capability Info */
Ipwps_capability_info peer_cap_info; /* Peer's Capability Info */
} Ipwps_ctx_public;
/* WSC Protocol message struct used to communicate between the WSC module and WPS Protocol Adaptor */
typedef struct Ipwps_wsc_proto_msg_st {
int event_or_rc; /* event or return code */
Ipwps_proto_data proto_data;
} Ipwps_wsc_proto_msg;
typedef struct Ipwps_eapol_notification_st {
int eapol_event; /* The event being notified about */
char if_name[IPWPS_MAX_IFNAME]; /* name of interface that the eapol event was received on */
Ip_u32 ip8021x_inst; /* IP8021X instance providing the notification */
Ip_u8 peeraddr[6]; /* MAC address of the peer who sent this eapol event */
} Ipwps_eapol_notification;
typedef enum {
IPWPS_DEVINFO_MANUFACTURER,
IPWPS_DEVINFO_MODELNAME,
IPWPS_DEVINFO_MODELNO,
IPWPS_DEVINFO_SERIALNO,
IPWPS_DEVINFO_DEVNAME,
IPWPS_DEVINFO_CATID,
IPWPS_DEVINFO_OUI,
IPWPS_DEVINFO_SUBCATID
} Ipwps_dev_info_type;
#include <ipcom_align16.h>
/* WPS Drv data struct */
typedef IP_PACKED1 struct Ipwps_drv_data_st {
Ip_u8 ssid[32+1];
Ip_u8 scan_count;
Ip_u8 bssid[6];
Ip_u8 buf[256];
Ip_u16 buflen;
Ip_u16 band;
Ip_u8 src_mac[6];
Ip_u8 pad[2];
} IP_PACKED2
Ipwps_drv_data;
#include <ipcom_align16.h>
/* Drv message struct to communicate between drv_interface and ipwps daemon */
#define IPWPS_MAX_DRV_DATA 1
typedef struct Ipwps_drv_msg_st {
Ip_u16 event_or_rc;
Ip_u8 total_no_of_received_drv_data;
Ip_u8 starting_msg_index;
Ipwps_drv_data drv_data[IPWPS_MAX_DRV_DATA];
}Ipwps_drv_msg;
#ifdef IPWPS_USE_STATS
/*
*===========================================================================
* Ipwps_stats
*===========================================================================
* WPS statistic counters
*/
typedef struct Ipwps_stats_st
{
Ip_u32 tbd;
} Ipwps_stats;
#endif
typedef union wps_msg_data_union {
Ipwps_ctx_public wps_public_ctx;
Ipwps_credentials credentials;
#ifdef IPWPS_USE_STATS
Ipwps_stats wps_stats;
#endif
Ipwps_wsc_proto_msg wps_proto_msg;
Ipwps_event_msg wps_event_msg;
Ipwps_eapol_notification wps_eapol_notify;
Ipwps_drv_msg wps_drv_msg;
} Ipwps_msg_data;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipwps_api_wps_enable - Enable/Disable WPS functionality
*
* This routine is used to enable/disable the WPS functionality at runtime.
* Note that ipwps_api_wps_start() needs to be called after enabling WPS
* and optionally changing the active wireless interface.
* NOTE: Calling this function will abruptly terminate any current WPS activities.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_wps_set_if - Set the active wireless interface for WPS
*
* This routine is used to set the wireless interface to be used by WPS.
* Note that you need to call ipwps_api_wps_reconfig() for it to take effect.
*
* PARAMETERS:
* \is
* \i <wls_if>
* char *: Name of the WPS active interface, e.g. "wls0"
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_set_if
(
char * if_name
);
/*******************************************************************************
*
* ipwps_api_wps_reconfig - Reconfigure the WPS service
*
* This routine is used to reconfigure the WPS service (e.g. after changing the
* active wireless interface setting).
* NOTE: Calling this function will abruptly terminate any current WPS activities.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_reconfig(void);
/*******************************************************************************
*
* ipwps_api_wps_set_commondevinfo - Set WPS Common Device Info value
*
* This routine is used to set a specific Common Device Info value to be used by
* the WPS.
* Note that you need to call ipwps_api_wps_reconfig() for it to take effect.
*
* PARAMETERS:
* \is
* \i <devinfo>
* Ipwps_dev_info_type: One of the following supported device info value:
* IPWPS_DEVINFO_MANUFACTURER:
* IPWPS_DEVINFO_MODELNAME
* IPWPS_DEVINFO_MODELNO
* IPWPS_DEVINFO_SERIALNO
* IPWPS_DEVINFO_DEVNAME
* IPWPS_DEVINFO_CATID
* IPWPS_DEVINFO_OUI
* IPWPS_DEVINFO_SUBCATID
* \i <val>
* char *: A string containing the value to set for the specified devinfo as follows:
* IPWPS_DEVINFO_MANUFACTURER:
* Up to 64 ascii characters representing identification of the device manufacturer.
* IPWPS_DEVINFO_MODELNAME
* Up to 32 ascii characters representing identification of the device model.
* IPWPS_DEVINFO_MODELNO
* Up to 32 ascii digits representing identification of the device model number.
* IPWPS_DEVINFO_SERIALNO
* Up to 32 ascii digits representing identification of the device serial number.
* IPWPS_DEVINFO_DEVNAME
* Up to 32 UTF-8 encoded bytes representing a descriptive name of the device.
* IPWPS_DEVINFO_CATID
* A single digit represnting the category id of the device
* IPWPS_DEVINFO_OUI
* A 4 byte hex value repesenting the oui for the device
* e.g. use val of "0050F204" for the Wi-Fi Alliance OUI.
* IPWPS_DEVINFO_SUBCATID
* A single digit represnting the sub-category id of the device
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_set_commondevinfo
(
Ipwps_dev_info_type devinfo,
char *val
);
/*******************************************************************************
*
* ipwps_api_wpsproto_enable - Enable/Disable WPS Protocol Support
*
* This routine is used to enable/disable the WPS Protocol Support at runtime
* if WPS protocol support is present.
* NOTE: Calling this function when WPS protocol support is present will abruptly
* terminate any current WPS activities.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wpsproto_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_enrollee_enable - Enable/Disable WPS Enrollee Support
*
* This routine is used to enable/disable the WPS Enrollee Support at runtime
* if WPS Enrollee support is present.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_enrollee_start - Start the WPS Enrollee Registration process
*
* This routine is used to start the WPS Enrollee Registration process
* at runtime if WPS Enrollee support is present.
* Note that if a registration is already in progress, this function call will have
* no effect. You need to call ipwps_api_enrollee_stop first.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_start(void);
/*******************************************************************************
*
* ipwps_api_enrollee_stop - Stop the WPS Enrollee Registration process
*
* This routine is used to stop the WPS Enrollee Registration process
* if WPS Enrollee support is present.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_stop(void);
/*******************************************************************************
*
* ipwps_api_enrollee_set_uuid - Set the WPS Enrollee's UUID
*
* This routine is used to set the WPS Enrollee UUID at runtime
* if WPS Enrollee support is present.
* You need to call "ipwps_api_wps_reconfig" for this to take effect.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <uuid>
* Ip_u8 *: Pointer to the buffer containing the 16 octet UUID value.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_set_uuid
(
Ip_u8 *uuid
);
/*******************************************************************************
*
* ipwps_api_enrollee_autoreg - Enable/Disable WPS Enrollee Auotmatic Registration Initiation
*
* This routine is used to enable/disable the WPS Enrollee Auotmatic Registration Initiation
* at runtime if WPS Enrollee support is present.
* It is recommended that this be disabled if PS Enrollee support for Non-WPS capable drivers
* is enabled.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_autoreg
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_enrollee_nonwps_drv - Enable/Disable WPS Enrollee support for Non-WPS capable drivers
*
* This routine is used to enable/disable the WPS Enrollee support for Non-WPS capable drivers
* at runtime if WPS Enrollee support is present. If enabled, this allows the Enrollee
* to run properly even if the driver does not support the WPS IE or notification capabilities.
* Note that this cannot be enabled when the PBC Config Method is selected.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_nonwps_drv
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_enrollee_adhoc - Enable/Disable WPS Enrollee Adhoc Registration mode support
*
* This routine is used to enable/disable the WPS Enrollee Adhoc Registration mode support
* at runtime if WPS Enrollee support is present. If enabled, this allows the Enrollee
* to rbe able to register with a Standalone registrar configured in adhoc mode.
* Note that this cannot be enabled when the support for Non-WPS capable drivers is also enabled.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS Enrollee support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_enrollee_adhoc
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_ap_enable - Enable/Disable WPS AP Support
*
* This routine is used to enable/disable the WPS AP Support at runtime
* if WPS AP support is present.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS AP support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_ap_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_registrar_enable - Enable/Disable WPS Registrar Support
*
* This routine is used to enable/disable the WPS Registrar Support at runtime
* if WPS Registrar support is present.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_registrar_start - Start the WPS Registrar Registration process
*
* This routine is used to start the WPS Registrar Registration process
* at runtime if WPS Registrar support is present.
* Note that if a registration is already in progress, this function call will have
* no effect. You need to call ipwps_api_registrar_stop first.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_start(void);
/*******************************************************************************
*
* ipwps_api_registrar_stop - Stop the WPS Registrar Registration process
*
* This routine is used to stop the WPS Registrar Registration process
* if WPS Registrar support is present.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_stop(void);
/*******************************************************************************
*
* ipwps_api_registrar_reg_mode - Turn the default WPS Registrar Registration mode On/off.
*
* This routine is used to set the default WPS Registrar Registration mode On/off
* at runtime if WPS Registrar support is present. If set to On, this means the registrar
* will be automatically started and will respond to registration requests,
* otherwise if set to Off, the registrar will need to be manually started (by calling
* "ipwps_api_registrar_start") to allow registration to proceed.
* You need to call "ipwps_api_wps_reconfig" for this to take effect.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to set On, 0 to set Off.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_reg_mode
(
Ip_u32 on
);
/*******************************************************************************
*
* ipwps_api_registrar_offer_all_creds - Indicate whether the registrar
* should offer all credentials to the Enrollee.
*
* This routine is used to allow the registrar to offer all configured credentials
* to the Enrollee if "on" is set to IP_TRUE. If set to IP_FALSE, the registrar
* will only offer credentials matching the capabilities indicated by the Enrollee
* during WPS registrations.
* You need to call "ipwps_api_wps_reconfig" for this to take effect.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to set On, 0 to set Off.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_offer_all_creds
(
Ip_u32 on
);
/*******************************************************************************
*
* ipwps_api_registrar_set_uuid - Set the WPS Registrar's UUID
*
* This routine is used to set the WPS Registrar UUID at runtime
* if WPS Registrar support is present.
* You need to call "ipwps_api_wps_reconfig" for this to take effect.
* If WPS Registrar support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <uuid>
* Ip_u8 *: Pointer to the buffer containing the 16 octet UUID value.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_registrar_set_uuid
(
Ip_u8 *uuid
);
/*******************************************************************************
*
* ipwps_api_pbc_enable - Enable/Disable WPS PBC Config Method
*
* This routine is used to enable/disable the WPS PBC Config Method at runtime
* if PBC Config Method support is present and if WPS protocol support is present..
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
* If PBC Config Method support is not present, this function call will return an error.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pbc_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_pbc_start - Trigger a PushButton event
*
* This routine is used to trigger a PushButton event at runtime
* if PBC Config Method support is present.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* None.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pbc_start(void);
/*******************************************************************************
*
* ipwps_api_pin_enable - Enable/Disable WPS PIN Config Method
*
* This routine is used to enable/disable the WPS PIN Config Method at runtime
* if PIN Config Method support is present and if WPS protocol support is present.
* You need to call "ipwps_api_wps_reconfig" for enable/disable to take effect.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <enable_flag>
* Ip_u32: 1 to enable, 0 to disable.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_enable
(
Ip_u32 enable_flag
);
/*******************************************************************************
*
* ipwps_api_pin_set_cm - Set the current WPS PIN Config Method
*
* This routine is used to set the WPS PIN Config Method at runtime
* if PIN Config Method support is present and if WPS protocol support is present.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <config_method>
* Ip_u16: One of the following Config Method values:
* IPWPS_CONFIG_METHOD_LABEL
* IPWPS_CONFIG_METHOD_DISPLAY
* IPWPS_CONFIG_METHOD_KEYPAD
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_set_cm
(
Ip_u16 config_method
);
/*******************************************************************************
*
* ipwps_api_pin_set_mode - Set the WPS PIN Mode
*
* This routine is used to set the WPS PIN Mode at runtime
* if PIN Config Method support is present and if WPS protocol support is present.
* You need to call "ipwps_api_wps_reconfig" for this operation to take effect.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <pin_mode>
* ipwps_pin_mode: The PIN mode to set. One of the following:
* IPWPS_PINMODE_VAL_AUTO: Automatically generate a machine-specified PIN value.
* IPWPS_PINMODE_VAL_INTERACT_USER: Prompt for a registrar-specified PIN value (interactive mode).
* IPWPS_PINMODE_VAL_INTERACT_REGS: Prompt for a user-specified PIN value (interactive mode).
* IPWPS_PINMODE_VAL_HARDCODE: Use the hardcoded PIN value (if one is programmed).
* To program a hardcoded PIN value, set the IPWPS_SYSVAR_PIN_HARDCODED_VAL sysvar
* to a valid 8 digit WPS PIN (Note that as per WPS specification, the 8th digit
* of the PIN value MUST BE a checksum of the other 7).
* If IPWPS_SYSVAR_PIN_HARDCODED_VAL is not set or set to an invalid value, an
* error will occur once "ipwps_api_wps_reconfig" is called.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_set_mode
(
ipwps_pin_mode pin_mode
);
/*******************************************************************************
*
* ipwps_api_pin_new - Auto-generate a new WPS PIN value
*
* This routine is used to generate a new machine-specific WPS PIN value at runtime
* if PIN Config Method support is present and configured in "auto" mode
* and if WPS protocol support is present.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <pinbuf>
* Ip_u8 *: pointer to a buffer to which to copy the new PIN.
*
* \i <buflen>
* Ip_u16: Size of pinbuf (MUST BE >= IPWPS_PIN_MAXLEN+1)
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_new
(
Ip_u8 *pinbuf,
Ip_u16 buflen
);
/*******************************************************************************
*
* ipwps_api_pin_set - Set the WPS PIN value
*
* This routine is used to set the WPS PIN value at runtime
* if PIN Config Method support is present and if WPS protocol support is present.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <pin>
* Ip_u8 *: pointer to a string containing the PIN.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_set
(
Ip_u8 *pin
);
/*******************************************************************************
*
* ipwps_api_pin_get - Retrieve the current WPS PIN value
*
* This routine is used to retrieve the current WPS PIN value at runtime
* if PIN Config Method support is present and if WPS protocol support is present.
* If WPS protocol support is not present, this function will return an error without
* proceeding any further.
*
* PARAMETERS:
* \is
* \i <pinbuf>
* Ip_u8 *: pointer to a buffer to which to copy the PIN.
*
* \i <buflen>
* Ip_u16: Size of pinbuf (MUST BE >= IPWPS_PIN_MAXLEN+1)
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_pin_get
(
Ip_u8 *pinbuf,
Ip_u16 buflen
);
/*******************************************************************************
*
* ipwps_api_credential_set_method - Set the WPS Credential Configuration Method
*
* This routine is used to set the method used by WPS for credential configuration.
* Note that using the "auto" and "default" methods will only configure the AP
* credentials and is not used to configure the registrar credentials, with the
* expection of the built-in registrar default credentials set (set #1) which is
* automatically set to the values in the AP credentials. To configure registrar
* credentials, the "interactive" method must be used.
*
* PARAMETERS:
* \is
* \i <method>
* char *: String containing the description of the credential config method to use.
* Must be one of the following:
* - IPWPS_CERDENTIAL_METHOD_AUTO:
* When this method is selected, the following sysvars MAY be specified first:
* IPWPS_SYSVAR_CREDENTIAL_AUTO_KEYLEN: (OPTIONAL)
* Specifies the length/type of security key to auto-generate
* Valid values: 8..64
* 8..63 specifies the length of a passphrase to be auto-generate
* 64 specifies that a PSK must be auto-generated (64 octet hex key).
* If not present, a default value of 64 is assumed.
* IPWPS_SYSVAR_CREDENTIAL_AUTO_NETINDEX:
* Specifies the Network Index to be used for the auto-generated credentials.
* Valid values: 1..255
* If not specified, a default of 1 is used for the Network Index.
* IPWPS_SYSVAR_CREDENTIAL_AUTO_SSID:
* Specifies the SSID to be used for the auto-generated credentials.
* Must contain <= IPWPS_SSID_MAXLEN ascii characters.
* If not specified, a random SSID value is auto-generated.
* ipwps_api_credential_new() can then be used to auto-generate new credentials.
*
* NOTE that using the "auto" method, only AP credentials can be auto-generated.
* If a built-in registrar is configured, its 1st credential set will also be
* updated with the same configuration as the AP credentials.
* Credentials are not modified when the method is set, instead
* ipwps_api_credential_new() needs to be called. This causes existing credentials
* to be deleted/replaced.
*
* - IPWPS_CERDENTIAL_METHOD_DEFAULT:
* When this method is selected, the following sysvars (which describe the
* default credential configuration) MUST first be present and properly configured:
* IPWPS_SYSVAR_CREDENTIAL_DEF_SSID:
* Specifies the SSID to use.
* Must contain <= IPWPS_SSID_MAXLEN ascii characters.
* IPWPS_SYSVAR_CREDENTIAL_DEF_AUTH:
* Specifies the Authentication type to use.
* Valid values:
* IPWPS_CRED_AUTH_OPEN
* IPWPS_CRED_AUTH_WPA
* IPWPS_CRED_AUTH_WPA2
* IPWPS_CRED_AUTH_ALL
* IPWPS_SYSVAR_CREDENTIAL_DEF_ENCR:
* Specifies the Encryption method to use.
* Valid values:
* IPWPS_CRED_ENCR_TKIP
* IPWPS_CRED_ENCR_AES
* IPWPS_CRED_ENCR_ALL
* IPWPS_SYSVAR_CREDENTIAL_DEF_KEY:
* Specifies the passphrase of hex key (PSK) to use
* A passphrase must be 8..63 printable ascii characters.
* A PSK must be exactly 64 hex characters.
* IPWPS_SYSVAR_CREDENTIAL_DEF_8021X:
* Specifies whether to use 802.1X authentication.
* "1" to turn on 802.1X authentication (WPA-enterprise)
* "0" to turn off 802.1X authentication (WPA-personal)
* IPWPS_SYSVAR_CREDENTIAL_DEF_EAP_ID:
* EAP Identity used if 802.1X authentication is on.
* Value is a string containing the EAP identity to use.
* IPWPS_SYSVAR_CREDENTIAL_DEF_EAP_TYPE:
* EAP type used if 802.1X authentication is on.
* Contains the hexadecimal representation of the EAP type to use.
* Must be 1 octet for standard EAP types and 8 octets for extended EAP types.
* The following sysvars can optionally be present:
* IPWPS_SYSVAR_CREDENTIAL_DEF_NETINDEX:
* Specifies the Network Index for the credential set.
* Valid values: 1..255
* If missing, a default value of 1 is used.
* IPWPS_SYSVAR_CREDENTIAL_DEF_KEYINDEX:
* Specifies the Key Index for the supplied key.
* Valid values: 1..255
* If missing, a default value of 1 is used.
*
* NOTE that only AP credentials are updated with the default values.
* If a built-in registrar is also present, then its 1st credential set will
* also be updated with the same configuration as the AP credentials.
* Those existing credential sets will be automatically deleted/replaced.
*
* - IPWPS_CERDENTIAL_METHOD_INTERACTIVE:
* When this method is selected, ipwps_api_credential_add() and
* ipwps_api_credential_delete() can be used to add/delete credentials.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_credential_set_method
(
Ipwps_credential_method cred_method
);
/*******************************************************************************
*
* ipwps_api_credential_add - Add a WPS Credential set
*
* This routine is used to add a WPS credential configuration to the specified
* credential set.
* This routine should be called only when the Credential Configuration Method
* is set to IPWPS_CRED_CONFIG_METHOD_INTERACT, otherwise the operation will fail.
*
* The credential configuration must be written to the following sysvars
* before calling this function:
* IPWPS_SYSVAR_CREDENTIAL_NETINDEX: (OPTIONAL) Specifies the Network Index
* for the credential set. If not specified, a default of 1 is used for
* the Network Index. Valid values: 1..255
* IPWPS_SYSVAR_CREDENTIAL_SSID: Specifies the SSID to use:
* Must contain <= IPWPS_SSID_MAXLEN ascii characters.
* IPWPS_SYSVAR_CREDENTIAL_AUTH: Specifies the Authentication type to use.
* Valid values:
* IPWPS_CRED_AUTH_WPA
* IPWPS_CRED_AUTH_WPA2
* IPWPS_CRED_AUTH_ALL
* IPWPS_SYSVAR_CREDENTIAL_ENCR: Specifies the Encryption method to use.
* Valid values:
* IPWPS_CRED_ENCR_TKIP
* IPWPS_CRED_ENCR_AES
* IPWPS_CRED_ENCR_ALL
* IPWPS_SYSVAR_CREDENTIAL_KEY: Specifies the passphrase of hex key (PSK) to use
* A passphrase must be 8..63 printable ascii characters.
* A PSK must be exactly 64 hex characters.
* IPWPS_SYSVAR_CREDENTIAL_KEYINDEX: (OPTIONAL) Specifies the Key Index for the
* supplied key. If not specified, a default of 1 is used for the Key Index.
* Valid values: 1..255
* IPWPS_SYSVAR_CREDENTIAL_8021X: Specifies whether to use 802.1X authentication.
* "1" to turn on 802.1X authentication (WPA-enterprise)
* "0" to turn off 802.1X authentication (WPA-personal)
* IPWPS_SYSVAR_CREDENTIAL_EAP_ID: EAP Identity used if 802.1X authentication is on.
* A string containing the EAP identity to use.
* IPWPS_SYSVAR_CREDENTIAL_EAP_TYPE: EAP type used if 802.1X authentication is on.
* Contains the hexadecimal representation of the EAP type to use.
* Must be 1 octet for standard EAP types and 8 octets for extended EAP types.
*
* If a valid credential set already exists, it must be deleted first before being
* added again, otherwise the add will fail.
*
* PARAMETERS:
* \is
* \i <set_id>
* Ip_u8: Specifies which credential set to add.
* Valid Values: 0..IPWPS_NUM_CEDENTIALS_MAX
* 0 indicates that an AP credential set is to be added to the AP or registrar
* otherwise it indicates set # for the enrollee credential to be added to the registrar
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_credential_add
(
Ip_u8 set_id
);
/*******************************************************************************
*
* ipwps_api_credential_delete - Delete a WPS Credential set
*
* This routine is used to delete the specified WPS credential set.
* This routine should be called only when the Credential Configuration Method
* is set to IPWPS_CRED_CONFIG_METHOD_INTERACT, otherwise the operation will fail.
*
* PARAMETERS:
* \is
* \i <set_id>
* Ip_u8: Specifies which credential set to delete.
* Valid Values: 0..IPWPS_NUM_CEDENTIALS_MAX
* 0 indicates that an AP credential set is to be deleted from the AP or registrar
* otherwise it indicates set # for the enrollee credential to be deleted from the registrar
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_credential_delete
(
Ip_u8 set_id
);
/*******************************************************************************
*
* ipwps_api_credential_new - Auto-generate a new WPS Credential set
*
* This routine is used to auto-generate the WPS AP credential set.
* If a built-in registrar is also present, then its 1st credential set will
* also be updated with the same configuration as the AP credentials.
* The new credentials will replace exisiting ones.
* This routine should be called only when the Credential Configuration Method
* is set to IPWPS_CRED_CONFIG_METHOD_AUTO, otherwise the operation will fail.
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_credential_new(void);
/*******************************************************************************
*
* ipwps_api_wps_show - Display WPS status and statistics
*
* This routine is used to display the WPS status and its statistics if applicable
* (Note that IPWPS_USE_STATS has to be defined for statistics to be displayed)
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_show(void);
/*******************************************************************************
*
* ipwps_api_wps_get_public_ctx - Retrieve a copy of the WPS public context
*
* This routine is used to retrieve a copy of the WPS public context.
*
* PARAMETERS:
* \is
* \i <pub_ctx>
* Ipwps_ctx_public *: A valid pointer to an Ipwps_ctx_public structure.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_get_public_ctx
(
Ipwps_ctx_public *pub_ctx
);
/*******************************************************************************
*
* ipwps_api_wps_get_credentials - Retrieve a copy of the WPS credentials
*
* This routine is used to retrieve a copy of the WPS credentials.
*
* PARAMETERS:
* \is
* \i <credentials>
* Ipwps_credentials *: A valid pointer to an Ipwps_credentials structure.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_get_credentials
(
Ipwps_credentials *credentials
);
#ifdef IPWPS_USE_STATS
/*******************************************************************************
*
* ipwps_api_wps_getstats - Retrieve a copy of the WPS statistics
*
* This routine is used to retrieve a copy of the WPS statistics.
* (Note that IPWPS_USE_STATS has to be defined for statistics to be displayed)
*
* PARAMETERS:
* \is
* \i <statp>
* Ipwps_stats *: A valid pointer to an Ipwps_stats structure.
*
* \ie
*
* RETURNS:
* IPCOM_SUCCESS on success, otherwise a failure code.
*
*/
IP_PUBLIC Ip_err ipwps_api_wps_getstats
(
Ipwps_stats *statp
);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/