tfStartEnhancedIke
Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference
| #include <trsocket.h> |
| int tfStartEnhancedIke | ( |
| unsigned int idType, | |
| unsigned int idLength, | |
| ttUserVoidPtr idPtr, | |
| const struct sockaddr_storage TM_FAR * ikeSockaddrPtr, | |
| ttUserInterface interfaceHandle | |
| ); | |
| Conditional parameter. See details in Parameters below. | |
Function Description
If the ID in IKE phase 1 exchange is different than the IP address we run IKE, for example, we use domain name, email address, username etc, tfStartEnhancedIke() should be used. Actually, tfStartEnhancedIke() can do anything that tfStartIke() can do. tfStartIke() is just a special case of tfStartEnhancedIke().
Parameters
- idType
- Identification type of Treck IKE participant. Could be: TM_DOI_ID_IPV4_ADDR, a single four octets IPv4 address TM_DOI_ID_FQDN, a fully qualified domain name string, like "foo.bar.com".
- TM_DOI_ID_USER_FQDN, a fully qualified username string, like jok@foo.bar.com
- TM_DOI_ID_DER_ASN1_DN, a Distinguished name in the host certificate
- TM_DOI_ID_IPV6_ADDR, a single 16-octet IPv6 address. Please note that, if idType is IPv4 or IPv6 address, you may want to use tfStartIke().
- idLength
- The length of identification.
- For TM_DOI_ID_IPV4_ADDR, it should be 4,
- For TM_DOI_ID_IPV6_ADDR it should be 16,
- For TM_DOI_ID_DER_ASN1_DN, it should be zero.
- For other idType, it will be the length of name string.
- idPtr
- Pointer to the IKE participant identification.
- If idType = TM_DOI_ID_IPV4_ADDR, it points to the four-octet IPv4 address (in network-byte order)
- If idType = TM_DOI_ID_IPV6_ADDR, it points to the sixteen-octet IPv6 address (in network-byte order)
- If idType = TM_DOI_ID_FQDN or TM_DOI_ID_USER_FQDN, it points to the name string.
- ikeSockaddrPtr
- Pointer to a struct sockaddr_storage. It has the IP address information of the IKE participant.
- interfaceHandle
- Restrict IKE packet traffic to the specified interface. Specify (ttUserInterface)0 to allow traffic on all interfaces. NOTE: This parameter is conditional and only present when macro TM_USE_STRONG_ESL is defined at compile time. For more information, please see Appendix C: Strong End System Model / Weak End System Model.
Returns
- TM_ENOERROR
- Success.
- TM_EIPSECNOTINITIALIZED
- TM_USE_IKE is not defined.
- TM_EALREADY
- IKE global variable tvIkePtr is not NULL before this call.
- TM_ENOBUFS
- No more buffers available.
- Other Errors
- Most likely a socket error. The user can call tfStrError(errorCode) to get a string representation of the error code.
Example: This example starts IKE using identification type TM_DOI_ID_FQDN for digital signature authentication, and is using IP address "3FFF::1"
{ ... struct sockaddr_storage clientIpAddr; ... tm_bzero(&clientIpAddr, sizeof(struct sockaddr_storage)); clientIpAddr.ss_len = sizeof(struct sockaddr_in6); clientIpAddr.ss_family = PF_INET6; inet_pton(PF_INET6, "3FFF::1", &clientIpAddr.addr.ipv6.sin6_addr); /* assert the return value of inet_pton is valid*/ ... /* start treck */ errorCode = tfStartTreck(); /* assert the return value */ ... /* Initialize IPsec global variables */ #ifdef TM_USE_IPSEC errorCode = tfUseIpsec(); if (errorCode != TM_ENOERROR) { } #endif /* TM_USE_IPSEC*/ /* Open the interface */ errorCode = tfNgOpenInterface(...); /* assert errorCode */ ... #ifdef TM_USE_IKE errorCode = tfStartEnhancedIke(TM_DOI_ID_ FQDN , 14, (void*)"www.treck.com", &clientIpAddr); /* assert return value */ #endif /* TM_USE_IKE*/ ... }
Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference