835 lines
29 KiB
C
835 lines
29 KiB
C
/* ipwps_private_api.h - IPWPS Private API 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
|
|
--------------------
|
|
01d,05mar09,mry Add priliminary enrollee support
|
|
01c,03mar09,dwb Fixing IPWPS_WSC_RC_TIMEOUT enum to be a negative number
|
|
01b,06feb09,hfc add drv msg type
|
|
01a,24Dec08,mry Created
|
|
*/
|
|
#ifndef IPWPS_PRIVATE_API_H
|
|
#define IPWPS_PRIVATE_API_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* This header file is to be included by internal modules ONLY and should not
|
|
* be included by external applications using ipwps.
|
|
* It defines the data structures and APIs used by internal modules to
|
|
* communicate with 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_public.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
#define IPWPS_PROCESS_NAME "ipwps"
|
|
|
|
#define IPWPS_PREPARE_IPD_MSG(msg, _ipdmsgtype_, _msgerr_, _wpsmsgtype_) { \
|
|
ipcom_memset((msg), 0, sizeof(Ipwps_ipd_msg)); \
|
|
(msg)->ipd_msg.msgtype = (int)(_ipdmsgtype_); \
|
|
(msg)->ipd_msg.msgerr = (Ip_err)(_msgerr_); \
|
|
(msg)->wps_msg_type.overlay = (Ip_u32)(_wpsmsgtype_); \
|
|
}
|
|
|
|
#define IPWPS_PREPARE_RESPONSE_MSG(ctx, _msgerr_) { \
|
|
ipcom_memset(&((ctx)->response_msg), 0, sizeof(Ipwps_ipd_msg)); \
|
|
(ctx)->response_msg.ipd_msg.msgtype = (ctx)->rcvd_ipd_msg.ipd_msg.msgtype; \
|
|
(ctx)->response_msg.ipd_msg.msgerr = _msgerr_; \
|
|
(ctx)->response_msg.wps_msg_type = (ctx)->rcvd_ipd_msg.wps_msg_type; \
|
|
}
|
|
|
|
#define IPWPS_PREPARE_RESPONSE_MSG_WITHTYPE(ctx, _msgerr_, _msg_type_) { \
|
|
ipcom_memset(&((ctx)->response_msg), 0, sizeof(Ipwps_ipd_msg)); \
|
|
(ctx)->response_msg.ipd_msg.msgtype = (ctx)->rcvd_ipd_msg.ipd_msg.msgtype; \
|
|
(ctx)->response_msg.ipd_msg.msgerr = _msgerr_; \
|
|
(ctx)->response_msg.wps_msg_type.overlay = (Ip_u32)(_msg_type_); \
|
|
}
|
|
|
|
/* APIs to test and Retrieve IPWPS Timeout event within a timeout handler routine */
|
|
#define IPWPS_ISVALID_TIMEOUT_EVENT_TYPE(_tmo_ev_) \
|
|
((_tmo_ev_) && ((_tmo_ev_) < IPWPS_MSG_TYPE_WPSTIMEOUT_MAXTYPE))
|
|
|
|
#define IPWPS_ISVALID_TIMEOUT_EVENT(_ctx_) \
|
|
(((_ctx_)->event == IPWPS_IPD_EVENT_WPSTIMEOUT) && \
|
|
IPWPS_ISVALID_TIMEOUT_EVENT_TYPE((_ctx_)->rcvd_ipd_msg.wps_msg_type.wpstmo))
|
|
|
|
#define IPWPS_GET_TIMEOUT_EVENT_TYPE(_ctx_) \
|
|
(IPWPS_ISVALID_TIMEOUT_EVENT((_ctx_)) ? (_ctx_)->rcvd_ipd_msg.wps_msg_type.wpstmo : IPWPS_MSG_TYPE_WPSTIMEOUT_INVALID)
|
|
|
|
#define IPWPS_TIMEOUT_VAL_SEC_TO_MSEC(_seconds_) ((_seconds_)*1000)
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
#define IPWPS_RC_DEBUG_LOOPBACK 1000 /* return code used for debugging purposes */
|
|
|
|
/* IPWPS Event types */
|
|
typedef enum {
|
|
IPWPS_IPD_EVENT_WPSFIRST = 100,
|
|
IPWPS_IPD_EVENT_WPSAPI = IPWPS_IPD_EVENT_WPSFIRST, /* Used by command subsystem and external Apps */
|
|
IPWPS_IPD_EVENT_WPSPROTO, /* Used by Protocol Adaptor */
|
|
IPWPS_IPD_EVENT_WPSDRV, /* Used by the driver interface to provide driver notifications (e.g. Probe Req events) */
|
|
IPWPS_IPD_EVENT_WPSDATA, /* For future use by Out Of Band interfaces, e.g. nfc */
|
|
IPWPS_IPD_EVENT_WPSTIMEOUT, /* For timeout events */
|
|
|
|
/* DO NOT CHANGE. Add other events before these */
|
|
IPWPS_IPD_EVENT_WPSDEBUG,
|
|
IPWPS_IPD_EVENT_WPSLAST
|
|
} Ipwps_event;
|
|
|
|
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSAPI_GETPUBLICCTX = 0,
|
|
IPWPS_MSG_TYPE_WPSAPI_GETCREDENTIALS,
|
|
IPWPS_MSG_TYPE_WPSAPI_GETSTATS,
|
|
IPWPS_MSG_TYPE_WPSAPI_PBC_EVENT,
|
|
IPWPS_MSG_TYPE_WPSAPI_PIN_EVENT,
|
|
IPWPS_MSG_TYPE_WPSAPI_ENROLLEE_EVENT,
|
|
IPWPS_MSG_TYPE_WPSAPI_REGISTRAR_EVENT,
|
|
IPWPS_MSG_TYPE_WPSAPI_CREDENTIAL_EVENT,
|
|
|
|
IPWPS_MSG_TYPE_WPSAPI_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpsapi;
|
|
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSPROTO_WSCNOTIFY = 0,
|
|
IPWPS_MSG_TYPE_WPSPROTO_WSCRESPONSE,
|
|
IPWPS_MSG_TYPE_WPSPROTO_EAPOL_NOTIFY,
|
|
|
|
IPWPS_MSG_TYPE_WPSPROTO_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpsproto;
|
|
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSDRV_NOTIFY,
|
|
IPWPS_MSG_TYPE_WPSDRV_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpsdrv;
|
|
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSDATA_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpsdata;
|
|
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_INVALID = 0, /* DO NOT CHANGE */
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_PROTO_STE_TIMER, /* WPS Protocol exchange Start to End timer timeout */
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_ENROLLEE_WALK_TIMER,
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_ENROLLEE_DEVPWD_PEND,
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_DRV_SCANDATA_RETRIVE_TIMER,
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_AP_WALK_TIMER,
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_REGISTRAR_MONITOR_TIMER,
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_REGISTRAR_WALK_TIMER,
|
|
|
|
IPWPS_MSG_TYPE_WPSTIMEOUT_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpstimeout;
|
|
|
|
#ifdef IPWPS_DEBUG
|
|
typedef enum {
|
|
IPWPS_MSG_TYPE_WPSDEBUG_WPS_BEGIN, /* trigger a WSC-Start event */
|
|
IPWPS_MSG_TYPE_WPSDEBUG_AP_SHOW, /* Display Debug information about the AP */
|
|
IPWPS_MSG_TYPE_WPSDEBUG_ENROLLEE_SHOW, /* Display Debug information about the Enrollee */
|
|
IPWPS_MSG_TYPE_WPSDEBUG_REGISTRAR_SHOW, /* Display Debug information about the Registrar */
|
|
IPWPS_MSG_TYPE_WPSDEBUG_TIMERS_SHOW, /* Display debug information about the WPS timers */
|
|
|
|
IPWPS_MSG_TYPE_WPSDEBUG_MAXTYPE /* Keep as last enum */
|
|
} Ipwps_msg_type_wpsdebug;
|
|
#endif
|
|
|
|
typedef union {
|
|
Ipwps_msg_type_wpsapi wpsapi;
|
|
Ipwps_msg_type_wpsproto wpsproto;
|
|
Ipwps_msg_type_wpsdrv wpsdrv;
|
|
Ipwps_msg_type_wpsdata wpsdata;
|
|
Ipwps_msg_type_wpstimeout wpstmo;
|
|
#ifdef IPWPS_DEBUG
|
|
Ipwps_msg_type_wpsdebug wpsdebug;
|
|
#endif
|
|
Ip_u32 overlay;
|
|
} Ipwps_msg_type;
|
|
|
|
typedef struct Ipwps_ipd_msg_st {
|
|
/* This is an overlay struct.
|
|
DO NOT MOVE THIS MEMBER! */
|
|
Ipcom_ipd_msg ipd_msg;
|
|
|
|
Ipwps_msg_type wps_msg_type;
|
|
Ipwps_msg_data wps_msg_data;
|
|
} Ipwps_ipd_msg;
|
|
|
|
|
|
/* IPWPS events corresponding to WSC pkts received by the EAP-WSC module */
|
|
typedef enum {
|
|
IPWPS_WSC_EVENT_RCV_ID_RESP = 0, /* used to notify the ipwps protocol adapter when an EAP Identity response is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_WSC_START, /* used to notify the ipwps protocol adapter when an EAP WSC-Start is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_WSC_ACK, /* used to notify the ipwps protocol adapter when an EAP WSC-Ack is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_WSC_NACK, /* used to notify the ipwps protocol adapter when an EAP WSC-Nack is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_WSC_MSG, /* used to notify the ipwps protocol adapter when an EAP WSC-Msg is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_WSC_DONE, /* used to notify the ipwps protocol adapter when an EAP WSC-Done is received from peer */
|
|
IPWPS_WSC_EVENT_RCV_EAP_FAIL /* used to notify the ipwps protocol adapter when an EAP Failure is received from peer */
|
|
} Ipwps_wsc_event;
|
|
|
|
/* Return code supplied by the IPWPS Protocol Adapter to the caller (WSC-EAP module)
|
|
* used in desciding what EAP-WSC message to send in response to the peer.
|
|
*/
|
|
typedef enum {
|
|
IPWPS_WSC_RC_NOT_SET = 0,
|
|
IPWPS_WSC_RC_OK, /* Generic success return code that doesn't require sending anything to the peer */
|
|
IPWPS_WSC_RC_SEND_WSC_START, /* indication to send a WSC-Start to the peer */
|
|
IPWPS_WSC_RC_SEND_WSC_ACK, /* indication to send a WSC-Ack to the peer with msg_data contents specified by wsc_resp_data */
|
|
IPWPS_WSC_RC_SEND_WSC_NACK, /* indication to send a WSC-Nack to the peer with msg_data contents specified by wsc_resp_data */
|
|
IPWPS_WSC_RC_SEND_WSC_MSG, /* indication to send a WSC-Msg to the peer with msg_data contents specified by wsc_resp_data */
|
|
IPWPS_WSC_RC_SEND_WSC_DONE, /* indication to send a WSC-Done to the peer with msg_data contents specified by wsc_resp_data */
|
|
IPWPS_WSC_RC_TERMINATE_EAP, /* indication that the EAP exchange should be termintated and an EAP-FAIL should be sent to peer */
|
|
|
|
/* Keep failures below this line (i.e. negative values */
|
|
IPWPS_WSC_RC_FAIL = -1, /* Generic failure response to be handled appropriately by the EAP-WSC module */
|
|
IPWPS_WSC_RC_TIMEOUT = -2 /* timeout indication to be handled appropriately by the EAP-WSC module (by sending a WSC-Nack to the peer) */
|
|
} Ipwps_wsc_rc;
|
|
|
|
/* IPWPS events corresponding to EAPOL events received by the 802.1x module */
|
|
typedef enum {
|
|
IPWPS_EAPOL_EVENT_RCV_START = 0 /* used to notify the ipwps protocol adapter when an EAPOL START is received from peer */
|
|
} Ipwps_eapol_event;
|
|
|
|
struct Ipwps_ctx_st;
|
|
|
|
/* Timer related types */
|
|
typedef enum {
|
|
IPWPS_TIMER_START, /* Start a timer */
|
|
IPWPS_TIMER_STOP /* Stop a timer */
|
|
} Ipwps_timer_control;
|
|
|
|
typedef enum {
|
|
IPWPS_TIMER_DONTCARE = 0,
|
|
IPWPS_TIMER_ONE_SHOT, /* One shot timer, expires after firing or when cancelled */
|
|
IPWPS_TIMER_PERIODIC /* Periodic timer, doesn't expire until cancelled */
|
|
} Ipwps_timer_type;
|
|
|
|
/* IPWPS Timeout event handler routine signature */
|
|
typedef Ip_err (*Ipwps_timeout_handler)(struct Ipwps_ctx_st* ctx);
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_register_timeout_handler
|
|
*===========================================================================
|
|
* Description:
|
|
* Register/Deregister a timeout handler with the IPWPS core. Called by
|
|
* IPWPS application modules wishing to receive wps timout events.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps context.
|
|
* Ipwps_msg_type_wpstimeout tmo_evtype - A valid timeout event type for
|
|
* which a handler is being registered.
|
|
* Ipwps_timeout_handler tmo_handler - If this is a non-NULL value then
|
|
* it is a function pointer for the timeout handler that will be called when
|
|
* the specified "tmo_evtype" is received. The actual tmo event type is retrieved by
|
|
* the handler using the IPWPS_GET_TIMEOUT_EVENT_TYPE() api.
|
|
* If "tmo_handler" set to NULL, the existing handler is deregistered if one is found,
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successfully registered/deregistered, error indication (<0) otherwise
|
|
*/
|
|
IP_PUBLIC Ip_err ipwps_register_timeout_handler
|
|
(
|
|
struct Ipwps_ctx_st* ctx,
|
|
Ipwps_msg_type_wpstimeout tmo_evtype,
|
|
Ipwps_timeout_handler tmo_handler
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_timer_request
|
|
*===========================================================================
|
|
* Description:
|
|
* Start/Stop a timer. Called by IPWPS app modules.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps context.
|
|
* Ipwps_msg_type_wpstimeout tmo_evtype - A valid timeout event type for
|
|
* which a timer is being started/stopped. The timer event must have been
|
|
* properly registered with ipwps_register_timeout_handler before calling
|
|
* this function.
|
|
* Ipwps_timer_control - Start/Stop the timer.
|
|
* Ipwps_timer_type - Type of timer being Started. Use IPWPS_TIMER_DONTCARE for Stop.
|
|
* Ip_u32 timeout_msec - Timeout value in milliseconds. Incosequential for Stop.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successfully registered/deregistered, error indication (<0) otherwise
|
|
*/
|
|
IP_PUBLIC Ip_err ipwps_timer_request
|
|
(
|
|
struct Ipwps_ctx_st* ctx,
|
|
Ipwps_msg_type_wpstimeout tmo_evtype,
|
|
Ipwps_timer_control tmo_ctrl,
|
|
Ipwps_timer_type tmo_type,
|
|
Ip_u32 timeout_msec
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_send_timeout_event
|
|
*===========================================================================
|
|
* Description:
|
|
* Send an IPWPS timeout event to an IPWPS application module.
|
|
* This is a non-blocking function that can be called from a timer callback
|
|
* routine context.
|
|
* Parameters:
|
|
* Ipwps_msg_type_wpstimeout tmo_evtype - A valid timeout event type to send.
|
|
* Returns:
|
|
* IPCOM_SUCCESS if successfully sent, error indication (<0) otherwise
|
|
*/
|
|
IP_PUBLIC Ip_err ipwps_send_timeout_event
|
|
(
|
|
Ipwps_msg_type_wpstimeout tmo_evtype
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_timer_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the name of the timeout event type
|
|
* Parameters:
|
|
* Ipwps_msg_type_wpstimeout ttype: timeout event type
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_GLOBAL IP_CONST char *ipwps_timer_name
|
|
(
|
|
Ipwps_msg_type_wpstimeout ttype
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_daemon_status
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the name of the ipwpsd status
|
|
* for the provided context.
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - A valid wps public context.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_daemon_status
|
|
(
|
|
Ipwps_ctx_public *pub_ctx
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_module_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing a description of the ipwps module status
|
|
* Parameters:
|
|
* Ipwps_module_status status - module status value
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_module_status_name
|
|
(
|
|
Ipwps_module_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_config_error_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the configuration error description
|
|
* Parameters:
|
|
* Ip_u16 config_err - configuration error value.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_GLOBAL IP_CONST char *ipwps_get_config_error_name
|
|
(
|
|
Ip_u16 config_err
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_conn_types_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Copy the descriptions of the connection types in the "conn_types" flag
|
|
* into the buffer pointed to by "name".
|
|
* Parameters:
|
|
* Ip_u8 conn_types - flag containing bit-or values of
|
|
* WPS "CONNECTION TYPE FLAGS" defined in "ipwps_common.h".
|
|
* char *name - Pointer to a buffer to contain the description string.
|
|
* It will always be NULL terminated and never exceeds "maxlen" bytes
|
|
* including the NULL character.
|
|
* Use ipcom_strlen() to find the actual length of data copied into it.
|
|
* Ip_u32 maxlen - maximum # of bytes that can be written into the "name"
|
|
* buffer. MUST BE > 0.
|
|
* Returns:
|
|
* None
|
|
*/
|
|
IP_GLOBAL void ipwps_get_conn_types_name
|
|
(
|
|
Ip_u8 conn_types,
|
|
char *name,
|
|
Ip_u32 maxlen
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_encr_types_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Copy the descriptions of the encryption types in the "encr_types" flag
|
|
* into the buffer pointed to by "name".
|
|
* Parameters:
|
|
* Ip_u16 encr_types - flag containing bit-or values of
|
|
* WPS "ENCRYPTION TYPE FLAGS" defined in "ipwps_common.h".
|
|
* char *name - Pointer to a buffer to contain the description string.
|
|
* It will always be NULL terminated and never exceeds "maxlen" bytes
|
|
* including the NULL character.
|
|
* Use ipcom_strlen() to find the actual length of data copied into it.
|
|
* Ip_u32 maxlen - maximum # of bytes that can be written into the "name"
|
|
* buffer. MUST BE > 0.
|
|
* Returns:
|
|
* None
|
|
*/
|
|
IP_GLOBAL void ipwps_get_encr_types_name
|
|
(
|
|
Ip_u16 encr_types,
|
|
char *name,
|
|
Ip_u32 maxlen
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_auth_types_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Copy the descriptions of the encryption types in the "auth_types" flag
|
|
* into the buffer pointed to by "name".
|
|
* Parameters:
|
|
* Ip_u16 auth_types - flag containing bit-or values of
|
|
* WPS "AUTHENTICATION TYPE FLAGS" defined in "ipwps_common.h".
|
|
* char *name - Pointer to a buffer to contain the description string.
|
|
* It will always be NULL terminated and never exceeds "maxlen" bytes
|
|
* including the NULL character.
|
|
* Use ipcom_strlen() to find the actual length of data copied into it.
|
|
* Ip_u32 maxlen - maximum # of bytes that can be written into the "name"
|
|
* buffer. MUST BE > 0.
|
|
* Returns:
|
|
* None
|
|
*/
|
|
IP_GLOBAL void ipwps_get_auth_types_name
|
|
(
|
|
Ip_u16 auth_types,
|
|
char *name,
|
|
Ip_u32 maxlen
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_config_methods_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Copy the descriptions of the encryption types in the "config_methods" flag
|
|
* into the buffer pointed to by "name".
|
|
* Parameters:
|
|
* Ip_u16 config_methods - flag containing bit-or values of
|
|
* WPS "CONFIG METHODS" defined in "ipwps_common.h".
|
|
* char *name - Pointer to a buffer to contain the description string.
|
|
* It will always be NULL terminated and never exceeds "maxlen" bytes
|
|
* including the NULL character.
|
|
* Use ipcom_strlen() to find the actual length of data copied into it.
|
|
* Ip_u32 maxlen - maximum # of bytes that can be written into the "name"
|
|
* buffer. MUST BE > 0.
|
|
* Returns:
|
|
* None
|
|
*/
|
|
IP_GLOBAL void ipwps_get_config_methods_name
|
|
(
|
|
Ip_u16 config_methods,
|
|
char *name,
|
|
Ip_u32 maxlen
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_rf_bands_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Copy the descriptions of the encryption types in the "rfbands" flag
|
|
* into the buffer pointed to by "name".
|
|
* Parameters:
|
|
* Ip_u8 rfbands - flag containing bit-or values of
|
|
* WPS "RF BANDS" defined in "ipwps_common.h".
|
|
* char *name - Pointer to a buffer to contain the description string.
|
|
* It will always be NULL terminated and never exceeds "maxlen" bytes
|
|
* including the NULL character.
|
|
* Use ipcom_strlen() to find the actual length of data copied into it.
|
|
* Ip_u32 maxlen - maximum # of bytes that can be written into the "name"
|
|
* buffer. MUST BE > 0.
|
|
* Returns:
|
|
* None
|
|
*/
|
|
IP_GLOBAL void ipwps_get_rf_bands_name
|
|
(
|
|
Ip_u8 rfbands,
|
|
char *name,
|
|
Ip_u32 maxlen
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_wps_state_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the Wi-Fi Protected Setup State description
|
|
* Parameters:
|
|
* Ip_u16 config_err - state value.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_GLOBAL IP_CONST char *ipwps_get_wps_state_name
|
|
(
|
|
Ipwps_wps_state wps_state
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_get_assoc_state_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS Association State description
|
|
* Parameters:
|
|
* Ip_u16 assoc_state - state value.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_GLOBAL IP_CONST char *ipwps_get_assoc_state_name
|
|
(
|
|
Ip_u16 assoc_state
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_wps_role_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS role description
|
|
* Parameters:
|
|
* Ipwps_role role - WPS role.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_wps_role_name
|
|
(
|
|
Ipwps_role role
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_peer_type_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS peer type description
|
|
* Parameters:
|
|
* Ipwps_peer_type type - WPS peer type.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_peer_type_name
|
|
(
|
|
Ipwps_peer_type type
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_wps_session_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS session status description
|
|
* Parameters:
|
|
* Ipwps_session_status status - WPS session status.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_wps_session_status_name
|
|
(
|
|
Ipwps_session_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_dev_pwdid_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS Device Password ID description
|
|
* Parameters:
|
|
* Ipwps_device_pwdid pwd_id - Device Password ID =
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_GLOBAL IP_CONST char *ipwps_dev_pwdid_name
|
|
(
|
|
Ipwps_device_pwdid pwd_id
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_ap_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS AP status description
|
|
* Parameters:
|
|
* Ipwps_ap_status status - WPS AP status.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_ap_status_name
|
|
(
|
|
Ipwps_ap_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_registrar_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS registrar status description
|
|
* Parameters:
|
|
* Ipwps_registrar_status status - WPS Registrar status.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_registrar_status_name
|
|
(
|
|
Ipwps_registrar_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_enrollee_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS enrollee status description
|
|
* Parameters:
|
|
* Ipwps_enrollee_status status - WPS Enrollee status.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_enrollee_status_name
|
|
(
|
|
Ipwps_enrollee_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_api_enrollee_apjoin_status_name
|
|
*===========================================================================
|
|
* Description:
|
|
* Return a string containing the WPS enrollee AP Join status description
|
|
* Parameters:
|
|
* Ipwps_enrollee_apjoin_status status - WPS Enrollee AP Join status.
|
|
* Returns:
|
|
* String pointer
|
|
*/
|
|
IP_PUBLIC IP_CONST char *ipwps_api_enrollee_apjoin_status_name
|
|
(
|
|
Ipwps_enrollee_apjoin_status status
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_handle_wsc_event
|
|
*===========================================================================
|
|
* Description:
|
|
* This is the only ipwps API called by the EAP-WSC module.
|
|
* It is implemented by the protocol adaptor to handle the various WSC pkts.
|
|
* It sends the events and associated data over the ipd socket to the WPS daemon
|
|
* and then blocks till a response is received (or a timeout occurs).
|
|
* The return code contains the response inidication and may also has associated
|
|
* WSC data to be sent back to peer by the EAP-WSC module.
|
|
*
|
|
* Parameters:
|
|
* Ipwps_wsc_proto_msg *wsc_rcvd_msg:
|
|
* Specifies the WSC event received from peer. Note that in case of fragmented
|
|
* WSC-MSG, this event is only sent once after all fragments have been
|
|
* successfully assembled by the ESP-WSC module.
|
|
* Also contains any reassembled WSC data associated with the WSC event.
|
|
*
|
|
* Ipwps_wsc_rc *wsc_rc:
|
|
* Stores the return code indicating to the caller (EAP-WSC module)
|
|
* the result of handling the event and what it needs to do next.
|
|
* Ipwps_proto_data **wsc_resp_data:
|
|
* Returns pointer to the response msg from the IPWPS application if applicable
|
|
* which usually contains wsc-msg data to be sent to peer, NULL otherwise.
|
|
*
|
|
* Returns:
|
|
* IPCOM_SUCCESS upon success, otherwise a failure or timeout indication
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_handle_wsc_event
|
|
(
|
|
Ipwps_wsc_proto_msg *wsc_rcvd_msg,
|
|
Ipwps_wsc_rc *wsc_rc,
|
|
Ipwps_proto_data **wsc_resp_data
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_create_proto_msg_data
|
|
*===========================================================================
|
|
* Description:
|
|
* This function is used to allocate and initialize an Ipwps proto msg data structure
|
|
*
|
|
* Parameters:
|
|
* int event_or_rc - event or return code to be set in the structure
|
|
* Ip_u32 datasize - Size of data in the structure (can be 0 to indicate no data).
|
|
* Ip_u8 *data - Data to copy into the structure. MUST NOT be NULL is datasize is not 0.
|
|
*
|
|
* Returns:
|
|
* pointer to allocated and initialized Ipwps_wsc_proto_msg struct or
|
|
* IP_NULL if allocation failed or any other error encountered.
|
|
*/
|
|
IP_GLOBAL Ipwps_wsc_proto_msg *ipwps_create_proto_msg_data
|
|
(
|
|
int event_or_rc,
|
|
Ip_u32 datasize,
|
|
Ip_u8 *data
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_notify_eapol_start
|
|
*===========================================================================
|
|
* Description:
|
|
* This ipwps API is called by the ip8021x module to provide notification
|
|
* that an EAPOL start event was received.
|
|
* It is implemented by the protocol adaptor to handle the eapol start event.
|
|
* It sends the events and associated data over the ipd socket to the WPS daemon
|
|
* and then blocks till a response is received (or a timeout occurs).
|
|
* The return code is either a success of failure.
|
|
* Parameters:
|
|
* char* wls_if:
|
|
* Name of the wireless interface on which the EAPOL start was received.
|
|
* Ip_u32 ip8021x_instance:
|
|
* The Ip8021x instance on which the EAPOL start was received.
|
|
* Ip_u8* peer_eth_addr:
|
|
* Mac Address of the peer who sent the EAPOL Start.
|
|
* Returns:
|
|
* IPCOM_SUCCESS upon success, otherwise a failure indication
|
|
*/
|
|
IP_GLOBAL Ip_err ipwps_notify_eapol_start
|
|
(
|
|
char* wls_if,
|
|
Ip_u32 ip8021x_instance,
|
|
Ip_u8* peer_eth_addr
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_dump_data
|
|
*===========================================================================
|
|
* Description:
|
|
* Log the contents of the provided buffer as hex values
|
|
* Parameters:
|
|
* char *prefix_str - Prefix string for log output.
|
|
* Ip_u8* buf - Ptr to buffer whose contents are to be logged.
|
|
* int len - length of buffer (in bytes).
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipwps_dump_data
|
|
(
|
|
char *prefix_str,
|
|
Ip_u8* buf,
|
|
int len
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_dump_ascii
|
|
*===========================================================================
|
|
* Description:
|
|
* Log the contents of the provided buffer in ascii
|
|
* Parameters:
|
|
* char *prefix_str - Prefix string for log output.
|
|
* Ip_u8* buf - Ptr to buffer whose contents are to be logged.
|
|
* int len - length of buffer (in bytes).
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipwps_dump_ascii
|
|
(
|
|
char *prefix_str,
|
|
Ip_u8* buf,
|
|
int len
|
|
);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipwps_wls_drv_get_current_mode
|
|
*===========================================================================
|
|
* Description:
|
|
* Retrieve the driver's current mode
|
|
* Parameters:
|
|
* Ipwps_ctx* ctx - ipwps context
|
|
* Returns:
|
|
* current mode
|
|
*/
|
|
IP_PUBLIC Ip_u16 ipwps_wls_drv_get_current_mode(struct Ipwps_ctx_st* ctx);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|