#ifndef __AEEWIMPROMPT_H__
#define __AEEWIMPROMPT_H__

#include "AEERSA.h"
#include "AEEWebOpts.h"
#include "AEEWeb.h"
#include "AEESSL.h"
//makise[S]
//#include "WIMPrompt.bid"
#include "OEMClassIDs.h"

typedef void (* PFNNEGHANDLER)(void *, const SSLInfo *, IWebOpts *, int *, AEECallback *);
//makise[E]

typedef struct IWIMPrompt IWIMPrompt;

AEEINTERFACE(IWIMPrompt) {
	INHERIT_IQueryInterface(IWIMPrompt);

	void (*GetClientCertAndKey)(IWIMPrompt * po, const SSLSecurityInfo * pSecInfo, IRSA ** ppobj, IWebOpts * clientCert, IWebOpts * rootCerts, byte * pDNList, AEECallback * pcb, int * pnErr);
};

#define IWIMPROMPT_AddRef(p)                 AEEGETPVTBL((p),IWIMPrompt)->AddRef((p))
#define IWIMPROMPT_Release(p)                AEEGETPVTBL((p),IWIMPrompt)->Release((p))
#define IWIMPROMPT_QueryInterface(p,i,o)     AEEGETPVTBL((p),IWIMPrompt)->QueryInterface((p),(i),(o))
#define IWIMPROMPT_GetClientCertAndKey(p, psec, ppobj, ccer, rcer, cl, pcb, pn)\
                                             AEEGETPVTBL((p),IWIMPrompt)->GetClientCertAndKey((p), (psec), (ppobj), (ccer), (rcer), (cl), (pcb), (pn))

/*=======================================================================
  INTERFACES   DOCUMENTATION
 ========================================================================

IWIMPrompt Interface

This interface provides the UI for choosing PKI client certificate 
from the WIM card. The BREW application can pass the DN list and 
root certs and related parameters to the interface to filter out
invalid (inadequate) certs.

The following header file is required:

IWIMPrompt.h

=============================================================================

IWIMPROMPT_AddRef()

Description:
    This function is inherited from IBASE_AddRef(). 

See Also:

    IWIMPROMPT_Release()

=============================================================================

IWIMPROMPT_Release()

Description:
    This function releases references to IWIMPrompt. 

Prototype:
    void IWIMPROMPT_Release(IWIMPrompt *pIWIMPrompt);

Parameters:
    pIWIMPrompt :  The Interface pointer

Return Value:
    none

Comments:
   If the reference count goes to zero all memory held is freed and all callbacks
   are cancelled. Callbacks should be cancelled explicitly rather than relying on IWIMPROMPT_Release.

See Also:

    IWIMPROMPT_AddRef()

=============================================================================

IWIMPROMPT_QueryInterface()

Description:
    This function is inherited from IQI_QueryInterface().


=============================================================================

IWIMPROMPT_GetClientCertAndKey()

Description:
    This function invokes the UI to select the PKI client certificate from
    the WIM card. The result is notified in AEECallback.

Prototype:
	void IWIMPROMPT_GetClientCertAndKey(IWIMPrompt * po, const SSLSecurityInfo * pSecInfo, IRSA ** ppobj, 
		                                 IWebOpts * clientCert, IWebOpts * rootCerts, byte * pDNList,
		                                 AEECallback * pcb, int * pnErr);

Parameters:
    pIWIMPrompt :  The Interface pointer
    pSecInfo    :  The SSL security info which is passed from the SSL server in the PFNNEGHANDLER.
    ppObj       :  The pointer to the pointer for the IRSA interface.
                   IWIMPrompt will fill the *pobj with the pointer to the IRSA obj which corresponds
                   to the client certificate.
    clientCert  :  The IWebOpts pointer. IWIMPrompt will AddOpt the client certificate to the IWebOpts.
    rootCerts   :  The IWebOpts pointer. This should contain the SSL root certs. IWIMPrompt will GetOpt
                   from the object to obtain the root certificates.
    pDNList     :  The CA DN List, in the same format as CerficateRequest message (refer: TLS RFC 2246).
    pcb         :  The pointer to the AEECallback. The results will be notified to the callback.
    pnErr       :  The placeholder for the result code of IWIMPrompt operation. 

Return Value:
    none

Comments:
   All passed pointers should be valid till the AEECallback gets called.

See Also:

    WEBOPT_SSL_CA_DN_LIST
    PFNNEGHANDLER
    SSLInfo
================================================================================*/


#endif /* __AEEWIMPROMPT_H__ */

