ipsec_strerror
![]() |
![]() |
![]() |
![]() |
ipsec_strerror()
Error code for IPsec policy manipultion library
Synopsis:
#include <netinet6/ipsec.h> const char * ipsec_strerror(void);
Library:
libipsec
Use the -l ipsec option to qcc to link against this library.
Description:
This ipsec_strerror() function is used to obtain the error message string from the last failed IPsec call.
Returns:
A pointer to an error message.
![]() |
Don't modify the string that this function returns. |
Examples:
#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;
}
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
See also:
IPsec, ipsec_dump_policy(), ipsec_get_policylen(), ipsec_set_policy()
setkey in the Utilities Reference
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)

