247 lines
8.1 KiB
C
247 lines
8.1 KiB
C
/* ipwps_config_adaptor.h - IPWPS Config Adaptor header file */
|
|
/*
|
|
* Copyright (c) 2009 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
|
|
--------------------
|
|
01a,26Feb09,mry Created
|
|
*/
|
|
#ifndef IPWPS_CONFIG_ADAPTOR_H
|
|
#define IPWPS_CONFIG_ADAPTOR_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* This is a common header file that may be included by internal WPS modules
|
|
* that need to query the WPS config method (PIN, PBC, etc) and its details
|
|
* (Device Password Id, Device Password, etc).
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_type.h>
|
|
#include <ipcom_cstyle.h>
|
|
|
|
#include "ipwps_common.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
typedef enum {
|
|
IPWPS_CA_EVENT_PUSHBUTTON,
|
|
IPWPS_CA_EVENT_PIN
|
|
} Ipwps_config_adaptor_eventtype;
|
|
|
|
typedef struct Ipwps_config_adaptor_event_st {
|
|
Ipwps_config_adaptor_eventtype type;
|
|
Ipwps_operation_status status;
|
|
union {
|
|
Ipwps_dev_pwd_container dev_pwd;
|
|
} content;
|
|
} Ipwps_config_adaptor_event;
|
|
|
|
typedef Ip_err (*Ipwps_config_adaptor_cb_handler)(struct Ipwps_ctx_st* ctx, Ipwps_config_adaptor_event *event);
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_init
|
|
*===========================================================================
|
|
* Description:
|
|
* Initialize and configure the nfig Adaptor module.
|
|
* This initializes any configured WPS Config Methods (PIN, PBC, etc).
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid Ready wps context.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successful, an error indication otherwise.
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_init
|
|
(
|
|
struct Ipwps_ctx_st *ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_shutdown
|
|
*===========================================================================
|
|
* Description:
|
|
* Shutdown the Config Adaptor module.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid Ready wps context.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successful, an error indication otherwise.
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_shutdown
|
|
(
|
|
struct Ipwps_ctx_st *ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_register_cb
|
|
*===========================================================================
|
|
* Description:
|
|
* Register a Callback handler that will receive PushButton or PIN events.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps context with config adaptor ready.
|
|
* Ipwps_config_adaptor_cb_handler cb_handler - Callback handler registered by
|
|
* the WPS app so that it can be notified of a PIN or PUSHBUTTON event.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successful, an error indication otherwise.
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_register_cb
|
|
(
|
|
struct Ipwps_ctx_st *ctx,
|
|
Ipwps_config_adaptor_cb_handler cb_handler
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_deregister_cb
|
|
*===========================================================================
|
|
* Description:
|
|
* Deregister a registered Callback handler.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps context with config adaptor ready.
|
|
* Ipwps_config_adaptor_cb_handler cb_handler - Callback handler that
|
|
* has been registered before (must match a previously registered callback).
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successful, an error indication otherwise.
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_deregister_cb
|
|
(
|
|
struct Ipwps_ctx_st *ctx,
|
|
Ipwps_config_adaptor_cb_handler cb_handler
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_cm_reset
|
|
*===========================================================================
|
|
* Description:
|
|
* Resets the operational Config Method to the default supported value
|
|
* if one is configured.
|
|
* Typically called by the registrar after a WPS registration session is complete.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps context with config adaptor ready.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_cm_reset
|
|
(
|
|
Ipwps_ctx *ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_config_adaptor_handle_event
|
|
*===========================================================================
|
|
* Description: Handle a protocol event stored in the ipwps context.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid Ready wps context.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successful, an error indication otherwise.
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_config_adaptor_handle_event
|
|
(
|
|
struct Ipwps_ctx_st *ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_ca_get_dev_pwdid
|
|
*===========================================================================
|
|
* Description:
|
|
* Retrieve the Device Password Id for the current WPS session.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid Ready wps context.
|
|
*
|
|
* Returns:
|
|
* Ipwps_device_pwdid - A valid (non zero) dev pwd id value if successful
|
|
* IPWPS_DEVPWDID_INVALID otherwise.
|
|
*/
|
|
IP_GLOBAL Ipwps_device_pwdid ipwps_ca_get_dev_pwdid
|
|
(
|
|
struct Ipwps_ctx_st* ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_ca_get_device_password
|
|
*===========================================================================
|
|
* Description:
|
|
* Retrieve the Device Password for the current WPS session.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid Ready wps context.
|
|
* Ipwps_dev_pwd_container *dev_pwd - A pointer to an Ipwps_dev_pwd_container
|
|
* structure that will contain the following:
|
|
* if return code (Ipwps_operation_status) == IPWPS_OPSTATUS_OK,
|
|
* then dev_pwd->pwd and dev_pwd->len contain the device password and its length.
|
|
* if return code == IPWPS_OPSTATUS_PENDING, then the device password
|
|
* is not immediately available and is pending retrieval (e.g. from user input)
|
|
* In this case, dev_pwd->len=0 and dev_pwd->pwd should not be used yet, instead
|
|
* the registered callback handler will be called with a pointer to an event containing
|
|
* an Ipwps_dev_pwd_container which has
|
|
* the valid device password if dev_pwd->status == IPWPS_OPSTATUS_OK or
|
|
* an error indication in dev_pwd->status if the device password could not be retrieved.
|
|
* if return code < 0 then an error occurred and the device password
|
|
* canot be retrieved.
|
|
* Returns:
|
|
* Ipwps_operation_status - See above
|
|
*/
|
|
IP_GLOBAL Ipwps_operation_status ipwps_ca_get_device_password
|
|
(
|
|
struct Ipwps_ctx_st* ctx,
|
|
Ipwps_dev_pwd_container *dev_pwd
|
|
);
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|