tfUseServerEapol

Jump to: navigation, search

Table of Contents >> Optional Protocols >> EAPoL Interface (IEEE 802.1X)


#include <trsocket.h>


ttUserLinkLayer tfUseServerEapol (
ttUserLnkNotifyFuncPtr lnkNotifyFuncPtr,
int etherType,
int llMode
);


Function Description

This function is used to initialize the EAPoL server link layer (IEEE 802.1X Authenticator). Parameter etherType specifies what type of Ethernet header to use (see Ethernet Link Types below). Pass the handle returned to your call to tfAddInterface(). When you open the interface, the server waits for a client request and upon receipt, begins the EAPoL authentication. When authentication is complete, you will receive notification of the result via the lnkNotifyFuncPtr function you provide (see Link Status Signals below).

This function requires that you uncomment the following compile time macro in your trsystem.h.

TM_USE_EAPOL_SERVER


Ethernet Link Types

The etherType parameter can be one of the following.

Value Description
TM_LINK_LAYER_ETHERNET or 0 Ethernet II or DIX (EtherType header == next protocol).
TM_LINK_LAYER_E8023 IEEE 802.3 (EtherType header is replaced by a length).
TM_LINK_LAYER_ETHER_TAG VLAN tagged.

Link Status Signals

The callback function you provide will receive one of the following signals.

Flag Description
TM_LL_EAP_UP Authentication was successful. The link is established.
TM_LL_OPEN_FAILED Authentication failed. The link must be closed.


Parameters

  • lnkNotifyFuncPtr
    A callback function to receive EAPoL link status. Specify NULL for no callback.
  • etherType
    The underlying Ethernet type: TM_LINK_LAYER_ETHERNET or 0, TM_LINK_LAYER_E8023 or TM_LINK_LAYER_ETHER_TAG.
  • llMode
    Link layer mode. Not currently used. Set to 0.


Returns

  • A non-NULL link layer handle if successful.
  • A NULL value for an invalid parameter or memory allocation failure.


Example

If you provide a non-NULL lnkNotifyFuncPtr, it could be coded as follows.

/*
 * Setup the interface
 */
void myEapolSetup(void)
{
    ttUserLinkLayer llHandle;
    ttUserInterface ifHandle;
    int             errorCode;
 
/* Get the link layer handle */
    llHandle = tfUseServerEapol(myEapolNotify, 0, 0);
    assert(llHandle != (ttUserLinkLayer)0);
 
/* Create the interface */
    ifHandle = tfAddInterface( "EAPoL.Server",
                               llHandle,
                               myEapolOpen,
                               myEapolClose,
                               myEapolSend,
                               myEapolRecv,
                               myEapolFreeRecv,
                               myEapolIoctl,
                               myEapolGetPhysAddr,
                               &errorCode );
    assert(ifHandle != (ttUserInterface)0);
 
/* Set options */
    myEapolOptions();
 
/* Open the interface */
    myEapolStart();
}
 
/*
 * EAPOL callback to notify that link setup has completed
 */
void myEapolNotify(
    ttUserInterface ifHandle,
    unsigned int    flags )
{
    if (flags & TM_LL_EAP_UP)
    {
        /* Authentication completed successfully */
    }
    else if (flags & TM_LL_OPEN_FAILED)
    {
        /* Authentication failed */
    }
}
 


Table of Contents >> Optional Protocols >> EAPoL Interface (IEEE 802.1X)