![]()  | 
![]()  | 
![]()  | 
![]()  | 
![]()  | 
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. | 
Error code for IPsec policy manipultion library
#include <netinet6/ipsec.h> const char * ipsec_strerror(void);
libipsec
Use the -l ipsec option to qcc to link against this library.
This ipsec_strerror() function is used to obtain the error message string from the last failed IPsec call.
A pointer to an error message.
![]()  | 
Don't modify the string that this function returns. | 
#include <netinet6/ipsec.h>
#include <sys/socket.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
int
main(void)
{
   char *sadb;
   char *policy = "in discard";
   int len;
   sadb = ipsec_set_policy(policy, strlen(policy));
   if (sadb == NULL) {
      fprintf(stderr, "ipsec_set_policy: %s\n", ipsec_strerror());
      return 1;
   }
   len = ipsec_get_policylen(sadb);
   printf("len: %d\n", len);
   policy = NULL;
   policy = ipsec_dump_policy(sadb, NULL);
   if (policy == NULL) {
      fprintf(stderr, "ipsec_dump_policy: %s\n", ipsec_strerror());
      return 1;
   }
   printf("policy: %s\n", policy);
   free(policy);
   free(sadb);
   return 0;
}
| Safety: | |
|---|---|
| Cancellation point | No | 
| Interrupt handler | Yes | 
| Signal handler | Yes | 
| Thread | Yes | 
IPsec, ipsec_dump_policy(), ipsec_get_policylen(), ipsec_set_policy()
setkey in the Utilities Reference
![]()  | 
![]()  | 
![]()  | 
![]()  |