TrustCore SDK NanoSec API reference  version 7.0
EAP1X Functions

Provides all EAP1X functions. More...

Functions

MOC_EXTERN MSTATUS EAP1X_authCheckTimers (void)
 Call expired timers' callbacks. More...
 
MOC_EXTERN MSTATUS EAP1X_authDeInit (void)
 Destroy EAP1X timers. More...
 
MOC_EXTERN MSTATUS EAP1X_authGetSesssionStats (ubyte *session, eap1xSessionStats *stats)
 Get an EAP1X session's current statistics. More...
 
MOC_EXTERN MSTATUS EAP1X_authInit (void)
 Start the EAP1X state machine and initialize the EAP1X stack and timers. More...
 
MOC_EXTERN MSTATUS EAP1X_authReceivePkt (ubyte *session, ubyte *pPkt, ubyte4 pktLen)
 Send the received EAP1X packets to the EAP1X layer. More...
 
MOC_EXTERN MSTATUS EAP1X_authSendEAP (ubyte *session, eapHdr_t *eap_hdr, ubyte *eap_data, ubyte4 eap_data_len, ubyte4 headRoom, ubyte **ppPkt, ubyte2 *pPktLen)
 Encapsulate an EAP packet with an EAP1X header. More...
 
MOC_EXTERN MSTATUS EAP1X_authSessionCreate (ubyte *appHdl, ubyte **session, eap1xAuthSessionCfg *cfg)
 Create an EAP1X authenticator session. More...
 
MOC_EXTERN MSTATUS EAP1X_authSessionDelete (ubyte *appHdl, ubyte *session)
 Delete an EAP1X authenticator session. More...
 
MOC_EXTERN MSTATUS EAP1X_authUpdatePortControl (ubyte *session, eap1xPortMode portMode)
 Set (update) an EAP1X session's port control mode. More...
 
MOC_EXTERN MSTATUS EAP1X_authUpdateSetState (ubyte *session, ubyte4 stateInfo)
 Set an EAP1X session's state parameters (which in turn control the EAP state machine). More...
 
MOC_EXTERN MSTATUS EAP1X_authUpdateUnsetState (ubyte *session, ubyte4 stateInfo)
 Clear (unset) an EAP1X session's state parameters (which in turn control the EAP state machine). More...
 
MOC_EXTERN MSTATUS EAP1X_peerCheckTimers ()
 Call expired timers' callbacks. More...
 
MOC_EXTERN MSTATUS EAP1X_peerdeinit ()
 Destroy EAP1X timers. More...
 
MOC_EXTERN MSTATUS EAP1X_peerGetSesssionState (ubyte *session, eap1XPeerState_t *state)
 Get an EAP1X session's current state. More...
 
MOC_EXTERN MSTATUS EAP1X_peerGetSesssionStats (ubyte *session, eap1xPeerStats *stats)
 Get an EAP1X session's current statistics. More...
 
MOC_EXTERN MSTATUS EAP1X_peerInit ()
 Start the EAP1X state machine and initialize the EAP1X stack and timers. More...
 
MOC_EXTERN MSTATUS EAP1X_peerReceivePkt (ubyte *session, ubyte *pPkt, ubyte4 pktLen)
 Send the received EAP1X packets to the EAP1X layer. More...
 
MOC_EXTERN MSTATUS EAP1X_peerSendEAP (ubyte *session, eapHdr_t *eap_hdr, ubyte *eap_data, ubyte4 eap_data_len, ubyte4 headRoom, ubyte **ppPkt, ubyte2 *pPktLen)
 Encapsulate an EAP packet with an EAP1X header. More...
 
MOC_EXTERN MSTATUS EAP1X_peerSessionCreate (ubyte *appHdl, ubyte **session, eap1xPeerSessionCfg *cfg)
 Create an EAP1X peer session. More...
 
MOC_EXTERN MSTATUS EAP1X_peerSessionDelete (ubyte *appHdl, ubyte *session)
 Delete an EAP1X peer session. More...
 
MOC_EXTERN MSTATUS EAP1X_peerUpdatePortControl (ubyte *session, eap1xPortMode portMode)
 Set (update) an EAP1X session's port control mode. More...
 
MOC_EXTERN MSTATUS EAP1X_peerUpdateSetState (ubyte *session, ubyte4 stateInfo)
 Set an EAP1X session's state parameters (which in turn control the EAP state machine). More...
 
MOC_EXTERN MSTATUS EAP1X_peerUpdateUnsetState (ubyte *session, ubyte4 stateInfo)
 Clear (unset) an EAP1X session's state parameters (which in turn control the EAP state machine). More...
 
MOC_EXTERN MSTATUS EAP1X_sendEAPOLLogoff (ubyte *session, ubyte **ppPkt, ubyte4 *pPktLen, ubyte4 headRoom)
 Build an EAPOL-Logoff message. More...
 
MOC_EXTERN MSTATUS EAP1X_sendEAPOLStart (ubyte *session, ubyte **ppPkt, ubyte4 *pPktLen, ubyte4 headRoom)
 Build an EAPOL-Start message. More...
 

Detailed Description

Function Documentation

◆ EAP1X_authCheckTimers()

MOC_EXTERN MSTATUS EAP1X_authCheckTimers ( void  )

This function determines whether any timers have expired, and if so then calls each expired expired timer's callback function. Your application should call this function on every clock tick (every 300 to 500 milliseconds) to provide time to the EAP1X stack.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap1x_auth.h

◆ EAP1X_authDeInit()

MOC_EXTERN MSTATUS EAP1X_authDeInit ( void  )

This function destroys EAP1X timers that were created by EAP1X_authInit. You should call this function after calling EAP1X_authSessionDelete.

Since
6.0
Version
6.0 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authSessionDelete

eap1x_auth.h

◆ EAP1X_authGetSesssionStats()

MOC_EXTERN MSTATUS EAP1X_authGetSesssionStats ( ubyte *  session,
eap1xSessionStats *  stats 
)

This function retrieves an EAP1X session's current statistics.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Parameters
sessionPointer to EAP1X session handle returned from EAP1X_authSessionCreate.
statsOn return, pointer to the session's current statistics values.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authSessionCreate

eap1x_auth.h

◆ EAP1X_authInit()

MOC_EXTERN MSTATUS EAP1X_authInit ( void  )

This function starts the EAP1X state machine and initializes the EAP1X stack and timers. This function needs to be called before calling EAP1X_authSessionCreate.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authSessionCreate

eap1x_auth.h

◆ EAP1X_authReceivePkt()

MOC_EXTERN MSTATUS EAP1X_authReceivePkt ( ubyte *  session,
ubyte *  pPkt,
ubyte4  pktLen 
)

This function sends the received EAP1X packets to the EAP1X layer. First the packet header's type is evaluated. Then based on the type, this function either updates the EAP1X session's state parameters (which in turn control the EAP state machine) or invokes the session's funcPtrEAPOLCallback function.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Parameters
sessionPointer to EAP1X session handle returned from EAP1X_authSessionCreate.
pPktPointer to received EAP1X packet.
pktLenNumber of bytes in the received packet (pPkt).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authSendEAP

eap1x_auth.h

◆ EAP1X_authSendEAP()

MOC_EXTERN MSTATUS EAP1X_authSendEAP ( ubyte *  session,
eapHdr_t *  eap_hdr,
ubyte *  eap_data,
ubyte4  eap_data_len,
ubyte4  headRoom,
ubyte **  ppPkt,
ubyte2 *  pPktLen 
)

This function encapsulates an EAP packet with an EAP1X header. The calling application must provide necessary data headroom for any required prepended data, such as the source or destination MAC address in the EAP1X header.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Note
To prevent a memory leak, be sure to free the resulting packet (ppPkt) after your application is done with it.
Parameters
sessionPointer to EAP1X session handle returned from EAP1X_authSessionCreate.
eap_hdrPointer to EAP packet header.
eap_dataPointer to EAP packet payload.
eap_data_lenNumber of bytes in EAP packet payload (eap_data).
headRoomNumber of bytes available to fill in the lower layer header. (These bytes will be included in the returned pPktLen value.)
ppPktOn return, pointer to resulting encapsulated packet.
pPktLenOn return, pointer to number of bytes (including the headRoom) in the resulting encapsulated packet (ppPkt).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authReceivePkt

eap1x_auth.h

◆ EAP1X_authSessionCreate()

MOC_EXTERN MSTATUS EAP1X_authSessionCreate ( ubyte *  appHdl,
ubyte **  session,
eap1xAuthSessionCfg *  cfg 
)

This function creates an EAP1X authenticator session based on the specified parameters, returning the resultant session handle through the session parameter. Before calling this function, your application must first call EAP1X_authInit.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Parameters
appHdlPointer to application cookie.
sessionOn return, pointer to EAP1X session handle.
cfgPointer to desired EAP1X session parameters.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authInit

eap1x_auth.h

◆ EAP1X_authSessionDelete()

MOC_EXTERN MSTATUS EAP1X_authSessionDelete ( ubyte *  appHdl,
ubyte *  session 
)

This function deletes an EAP1X authenticator session.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Parameters
appHdlPointer to application cookie.
sessionPointer to EAP1X session handle returned from EAP1X_authSessionCreate.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authInit

eap1x_auth.h

◆ EAP1X_authUpdatePortControl()

MOC_EXTERN MSTATUS EAP1X_authUpdatePortControl ( ubyte *  session,
eap1xPortMode  portMode 
)

This function sets (updates) an EAP1X session's port control mode.

For EAP-based authentication, the port control mode should be set to EAP1X_PORT_MODE_AUTO. You can force the port into an authorized or unauthorized state by setting the port control mode parameter to EAP1X_PORT_MODE_FORCED_AUTHORIZED or EAP1X_PORT_MODE_FORCED_UNAUTHORIZED, respectively.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Parameters
sessionEAP session handle returned from EAP1X_authSessionCreate.
portModeAny of the eap1xPortMode enumerated values (defined in eap1x.h).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap1x_auth.h

◆ EAP1X_authUpdateSetState()

MOC_EXTERN MSTATUS EAP1X_authUpdateSetState ( ubyte *  session,
ubyte4  stateInfo 
)

This function sets an EAP1X session's state parameters (which in turn control the EAP state machine).

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Note
The state parameters are defined in IEEE Standard 802.1X-2004, Section 8.2.4 (Authenticator State machine).
Parameters
sessionEAP session handle returned from EAP1X_authSessionCreate.
stateInfoBitmask combination (created by OR — ing definitions together) of desired state parameters to set. Valid state parameter definitions are:

  • EAP1X_EAPOL_INITIALIZE
  • EAP1X_EAPOL_START
  • EAP1X_EAPOL_LOGOFF
  • EAP1X_EAP_REQUEST
  • EAP1X_EAP_RESTART
  • EAP1X_EAP_AUTH_SUCCESS
  • EAP1X_EAP_AUTH_FAIL
  • EAP1X_EAP_EAP_SUCCESS
  • EAP1X_EAP_EAP_FAIL
  • EAP1X_EAP_AUTH_TIMEOUT
  • EAP1X_EAP_AUTH_ABORT
  • EAP1X_EAP_PORT_VALID
  • EAP1X_EAP_PORT_ENABLED
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authUpdateUnsetState

eap1x_auth.h

◆ EAP1X_authUpdateUnsetState()

MOC_EXTERN MSTATUS EAP1X_authUpdateUnsetState ( ubyte *  session,
ubyte4  stateInfo 
)

This function clears (unsets) an EAP1X session's state parameters (which in turn control the EAP state machine).

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_AUTH__

eap1x_auth.h

Note
The state parameters are defined in IEEE Standard 802.1X-2004, Section 8.2.4 (Authenticator State machine).
Parameters
sessionEAP session handle returned from EAP1X_authSessionCreate.
stateInfoBitmask combination (created by OR — ing definitions together) of desired state parameters to clear (unset). Valid state parameter definitions are:

  • EAP1X_EAPOL_INITIALIZE
  • EAP1X_EAPOL_START
  • EAP1X_EAPOL_LOGOFF
  • EAP1X_EAP_REQUEST
  • EAP1X_EAP_RESTART
  • EAP1X_EAP_AUTH_SUCCESS
  • EAP1X_EAP_AUTH_FAIL
  • EAP1X_EAP_EAP_SUCCESS
  • EAP1X_EAP_EAP_FAIL
  • EAP1X_EAP_AUTH_TIMEOUT
  • EAP1X_EAP_AUTH_ABORT
  • EAP1X_EAP_PORT_VALID
  • EAP1X_EAP_PORT_ENABLED
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_authUpdateSetState

eap1x_auth.h

◆ EAP1X_peerCheckTimers()

MOC_EXTERN MSTATUS EAP1X_peerCheckTimers ( )

This function determines whether any timers have expired, and if so then calls each expired expired timer's callback function. Your application should call this function on every clock tick (every 300 to 500 milliseconds) to provide time to the EAP1X stack.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

eap1x_peer.h

◆ EAP1X_peerdeinit()

MOC_EXTERN MSTATUS EAP1X_peerdeinit ( )

This function destroys EAP1X timers that were created by EAP1X_peerInit. You should call this function after calling EAP1X_peerSessionDelete.

Since
3.1
Version
3.1 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerSessionDelete

eap1x_peer.h

◆ EAP1X_peerGetSesssionState()

MOC_EXTERN MSTATUS EAP1X_peerGetSesssionState ( ubyte *  session,
eap1XPeerState_t *  state 
)

This function retrieves an EAP1X session's current state.

Since
2.45
Version
2.45 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
sessionPointer to EAP1X session handle returned from EAP1X_peerSessionCreate.
stateOn return, pointer to the session's current state values.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerSessionCreate

eap1x_peer.h

◆ EAP1X_peerGetSesssionStats()

MOC_EXTERN MSTATUS EAP1X_peerGetSesssionStats ( ubyte *  session,
eap1xPeerStats *  stats 
)

This function retrieves an EAP1X session's current statistics.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
sessionPointer to EAP1X session handle returned from EAP1X_peerSessionCreate.
statsOn return, pointer to the session's current statistics values.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerSessionCreate

eap1x_peer.h

◆ EAP1X_peerInit()

MOC_EXTERN MSTATUS EAP1X_peerInit ( )

This function starts the EAP1X state machine and initializes the EAP1X stack and timers. This function needs to be called before calling EAP1X_peerSessionCreate.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerSessionCreate

eap1x_peer.h

◆ EAP1X_peerReceivePkt()

MOC_EXTERN MSTATUS EAP1X_peerReceivePkt ( ubyte *  session,
ubyte *  pPkt,
ubyte4  pktLen 
)

This function sends the received EAP1X packets to the EAP1X layer. First the packet header's type is evaluated. For EAP1X_EAP_EAPOL messages, this function invokes the session's funcPtrEAPOLCallback function.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
sessionPointer to EAP1X session handle returned from EAP1X_peerSessionCreate.
pPktPointer to received EAP1X packet.
pktLenNumber of bytes in the received packet (pPkt).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerSendEAP
EAP1X_sendEAPOLStart
EAP1X_sendEAPOLLogoff

eap1x_peer.h

◆ EAP1X_peerSendEAP()

MOC_EXTERN MSTATUS EAP1X_peerSendEAP ( ubyte *  session,
eapHdr_t *  eap_hdr,
ubyte *  eap_data,
ubyte4  eap_data_len,
ubyte4  headRoom,
ubyte **  ppPkt,
ubyte2 *  pPktLen 
)

This function encapsulates an EAP packet with an EAP1X header. The calling application must provide necessary data headroom for any required prepended data, such as the source or destination MAC address in the EAP1X header.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Note
To prevent a memory leak, be sure to free the resulting packet (ppPkt) after your application is done with it.
Parameters
sessionPointer to EAP1X session handle returned from EAP1X_peerSessionCreate.
eap_hdrPointer to EAP packet header.
eap_dataPointer to EAP packet payload.
eap_data_lenNumber of bytes in EAP packet payload (eap_data).
headRoomNumber of bytes available to fill in the lower layer header. (These bytes will be included in the returned pPktLen value.)
ppPktOn return, pointer to resulting encapsulated packet.
pPktLenOn return, pointer to number of bytes (including the headRoom) in the resulting encapsulated packet (ppPkt).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerReceivePkt
EAP1X_sendEAPOLStart
EAP1X_sendEAPOLLogoff

eap1x_peer.h

◆ EAP1X_peerSessionCreate()

MOC_EXTERN MSTATUS EAP1X_peerSessionCreate ( ubyte *  appHdl,
ubyte **  session,
eap1xPeerSessionCfg *  cfg 
)

This function creates an EAP1X peer session based on the specified parameters, returning the resultant session handle through the session parameter. Before calling this function, your application must first call EAP1X_peerInit.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
appHdlPointer to application cookie.
sessionOn return, pointer to EAP1X session handle.
cfgPointer to desired EAP1X session parameters.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerInit

eap1x_peer.h

◆ EAP1X_peerSessionDelete()

MOC_EXTERN MSTATUS EAP1X_peerSessionDelete ( ubyte *  appHdl,
ubyte *  session 
)

This function deletes an EAP1X peer session. After you delete the session, you should call EAP1X_peerdeinit to destroy the session's timers.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
appHdlPointer to application cookie.
sessionPointer to EAP1X session handle returned from EAP1X_peerSessionCreate.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerInit
EAP1X_peerdeinit

eap1x_peer.h

◆ EAP1X_peerUpdatePortControl()

MOC_EXTERN MSTATUS EAP1X_peerUpdatePortControl ( ubyte *  session,
eap1xPortMode  portMode 
)

This function sets (updates) an EAP1X session's port control mode.

For EAP-based authentication, the port control mode should be set to EAP1X_PORT_MODE_AUTO. You can force the port into an authorized or unauthorized state by setting the port control mode parameter to EAP1X_PORT_MODE_FORCED_AUTHORIZED or EAP1X_PORT_MODE_FORCED_UNAUTHORIZED, respectively.

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Parameters
sessionEAP session handle returned from EAP1X_peerSessionCreate.
portModeAny of the eap1xPortMode enumerated values (defined in eap1x.h).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerUpdateSetState

eap1x_peer.h

◆ EAP1X_peerUpdateSetState()

MOC_EXTERN MSTATUS EAP1X_peerUpdateSetState ( ubyte *  session,
ubyte4  stateInfo 
)

This function sets an EAP1X session's state parameters (which in turn control the EAP state machine).

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Note
The state parameters are defined in IEEE Standard 802.1X-2004, Section 8.2.11 (Peer State machine).
Parameters
sessionEAP session handle returned from EAP1X_peerSessionCreate.
stateInfoBitmask combination (created by OR — ing definitions together) of desired state parameters to set. Valid state parameter definitions are:

  • EAP1X_EAPOL_INITIALIZE
  • EAP1X_EAPOL_USERLOGOFF
  • EAP1X_EAPOL_LOGOFF
  • EAP1X_EAP_EAPOL
  • EAP1X_EAP_RESTART
  • EAP1X_EAP_PEER_SUCCESS
  • EAP1X_EAP_PEER_FAIL
  • EAP1X_EAP_EAP_SUCCESS
  • EAP1X_EAP_EAP_FAIL
  • EAP1X_EAP_PEER_TIMEOUT
  • EAP1X_EAP_PORT_VALID
  • EAP1X_EAP_PORT_ENABLED
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerUpdateUnsetState

eap1x_peer.h

◆ EAP1X_peerUpdateUnsetState()

MOC_EXTERN MSTATUS EAP1X_peerUpdateUnsetState ( ubyte *  session,
ubyte4  stateInfo 
)

This function clears (unsets) an EAP1X session's state parameters (which in turn control the EAP state machine).

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Note
The state parameters are defined in IEEE Standard 802.1X-2004, Section 8.2.11 (Peer State machine).
Parameters
sessionEAP session handle returned from EAP1X_peerSessionCreate.
stateInfoBitmask combination (created by OR — ing definitions together) of desired state parameters to clear (unset). Valid state parameter definitions are:

  • EAP1X_EAPOL_INITIALIZE
  • EAP1X_EAPOL_USERLOGOFF
  • EAP1X_EAPOL_LOGOFF
  • EAP1X_EAP_EAPOL
  • EAP1X_EAP_RESTART
  • EAP1X_EAP_PEER_SUCCESS
  • EAP1X_EAP_PEER_FAIL
  • EAP1X_EAP_EAP_SUCCESS
  • EAP1X_EAP_EAP_FAIL
  • EAP1X_EAP_PEER_TIMEOUT
  • EAP1X_EAP_PORT_VALID
  • EAP1X_EAP_PORT_ENABLED
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_peerUpdateSetState

eap1x_peer.h

◆ EAP1X_sendEAPOLLogoff()

MOC_EXTERN MSTATUS EAP1X_sendEAPOLLogoff ( ubyte *  session,
ubyte **  ppPkt,
ubyte4 *  pPktLen,
ubyte4  headRoom 
)

This function builds an EAPOL-Logoff message, returning it through the ppPkt parameter. Your application can then send the message using the appropriate transport layer functions

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Note
To prevent a memory leak, be sure to free the resulting packet (ppPkt) after your application is done with it.
Parameters
sessionEAP session handle returned from EAP1X_peerSessionCreate.
ppPktOn return, pointer to resultant EAPOL-Logoff message packet.
pPktLenOn return, pointer to number of bytes (including the headRoom) in resultant EAPOL-Logoff message packet (ppPkt).
headRoomNumber of bytes available to fill in the lower layer header. (These bytes will be included in the returned pPktLen value.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_sendEAPOLStart

eap1x_peer.h

◆ EAP1X_sendEAPOLStart()

MOC_EXTERN MSTATUS EAP1X_sendEAPOLStart ( ubyte *  session,
ubyte **  ppPkt,
ubyte4 *  pPktLen,
ubyte4  headRoom 
)

This function builds an EAPOL-Start message, returning it through the ppPkt parameter. Your application can then send the message using the appropriate transport layer functions

Since
2.02
Version
2.02 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_EAP_PEER__

eap1x_peer.h

Note
To prevent a memory leak, be sure to free the resulting packet (ppPkt) after your application is done with it.
Parameters
sessionEAP session handle returned from EAP1X_peerSessionCreate.
ppPktOn return, pointer to resultant EAPOL-Start message packet.
pPktLenOn return, pointer to number of bytes (including the headRoom) in resultant EAPOL-Start message packet (ppPkt).
headRoomNumber of bytes available to fill in the lower layer header. (These bytes will be included in the returned pPktLen value.)
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
See also
EAP1X_sendEAPOLLogoff

eap1x_peer.h