tfEapTlsRegisterNotify
Table of Contents >> Optional Protocols >> PPP Interface
#include <trsocket.h> |
int tfEapTlsRegisterNotify | ( |
ttUserInterface interfaceHandle, | |
ttEapTlsNotifyFunc authFuncPtr, | |
void TM_FAR * userPtr | |
); |
Function Description
Register a callback function for EAP-TLS event notification. Supported events are listed in the table below. EAP-TLS is described in detail on the EAP-TLS Authentication method page.Example that shows configuring, receiving and servicing of the TM_CB_SSL_HANDSHK_PROCESS event:
/** ** Set up EAP before opening the interface **/ void myEapSetup( ttUserInterface myInterfaceHandle, /* created via tfAddInterface() */ struct myEapData * myDataPtr) /* some optional application data */ { int optVal; int errorCode; /* * Additional EAP, EAP-TLS, TLS/SSL and PKI setup, as required */ . . . /* Register a callback for EAP-TLS event notification */ errorCode = tfEapTlsRegisterNotify( myInterfaceHandle, myEapTlsNotifyFunc, /* app function */ myDataPtr ); assert(errorCode == TM_ENOERROR); /* Defer processing of received EAP-TLS records */ optVal = 1; errorCode = tfEapSetOption( myInterfaceHandle, TM_EAPTLS_USER_PROCESS, (char *)&optVal, sizeof(optVal) ); assert(errorCode == TM_ENOERROR); . . . } /** ** Callback function for EAP-TLS events **/ void myEapTlsNotifyFunc( ttUserInterface interfaceHandle, unsigned int eventFlags, void TM_FAR * userPtr) { struct myEapData * myDataPtr = (struct myEapData *)userPtr; if (eventFlags & TM_CB_SSL_HANDSHK_PROCESS) { /* * TLS records have been received and queued. * Processing has been deferred, so as not to burden the receive task. * Pass this event on to a low priority task, however that's done * for your operating system. */ } } /** ** Low priority task for processing deferred EAP-TLS events **/ void myEapTlsTask( ttUserInterface interfaceHandle, unsigned int eventFlags, struct myEapData * myDataPtr) { if (eventFlags & TM_CB_SSL_HANDSHK_PROCESS) { errorCode = tfEapTlsProcessHandshake(interfaceHandle); assert(errorCode == TM_ENOERROR); } }
EAP-TLS events
Signal | Reason / Action required |
---|---|
TM_CB_SSL_HANDSHK_PROCESS | TLS records have been received and queued. Call tfEapTlsProcessHandshake() to service the TLS records.
This event is disabled by default and enabled by calling tfEapSetOption() and setting option TM_EAPTLS_USER_PROCESS. Normally, TLS records are processed when they are received, the receive queue never fills and this event is never signaled. |
Parameters
- interfaceHandle
- The interface handle returned by tfAddInterface().
- notifyFuncPtr
- The pointer to a function to receive event notifications (function prototype ttEapTlsNotifyFunc). Set this parameter to NULL to remove the pointer.
- userPtr
- A pointer to be passed to the function. This parameter is optional and may be NULL.
Returns
- TM_ENOERROR
- Success.
- TM_EINVAL
- Invalid parameter.