tfUseIpsec

Jump to: navigation, search

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference


#include <trsocket.h>


int tfUseIpsec (void);


Function Description

tfUseIpsec() must be called after tfStartTreck(), and before tfStartIke() (if IKE is defined). We suggest calling it before tfOpenInterface(). tfUseIpsec() allocates and initializes the IPsec global variable tvIpsecPtr.


Returns

  • TM_ENOERROR
    Success.
  • TM_EIPSECNOTINITIALIZED
    TM_USE_IPSEC is not defined
  • TM_EALREADY
    IPsec global variable tvIpsecPtr is not NULL before this call.
  • TM_ENOBUFS
    No more buffers for tvIpsecPtr


Example

{
...
/* start treck */
    errorCode = tfStartTreck();
    if (errorCode != TM_ENOERROR)
    {
    }
...
/* Initialize IPsec global variables */
#ifdef TM_USE_IPSEC
    errorCode = tfUseIpsec();
    if (errorCode != TM_ENOERROR)
    {
    }
#endif /* TM_USE_IPSEC*/
 
/* Open the added Loop back interface */
    errorCode = tfOpenInterface(...);
...
}

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference