7#include <applibs/log.h>
11 #define NI_MAXHOST 256
25static int util_PrintIfAddr(
void)
27 char host[NI_MAXHOST];
28 struct ifaddrs* ifaddr, * nxt;
32 if (getifaddrs(&ifaddr) != 0) {
33 fprintf(stderr,
"ERROR: Getting network interface and IP address");
34 return WOLFSSL_FAILURE;
36 printf(
"\nInterface IP Address\n");
38 for (nxt = ifaddr; nxt != NULL; nxt = nxt->ifa_next) {
39 if (nxt->ifa_addr == NULL)
41 family = nxt->ifa_addr->sa_family;
43 if (family == AF_INET) {
44 info = getnameinfo(nxt->ifa_addr,
sizeof(
struct sockaddr_in),
45 host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
47 fprintf(stderr,
"Failed to getnameinfo");
49 return WOLFSSL_FAILURE;
52 n = (int)strlen(
"Interface ") - (int)strlen(nxt->ifa_name);
54 printf(
"%s %*c%s>\n", nxt->ifa_name, n,
'<', host);
59 return WOLFSSL_SUCCESS;
WOLFSSL_API void wolfSSL_free(WOLFSSL *)
This function frees an allocated wolfSSL object.
Definition ssl.c:557
WOLFSSL_API void wolfSSL_CTX_free(WOLFSSL_CTX *)
This function frees an allocated WOLFSSL_CTX object. This function decrements the CTX reference count...
Definition ssl.c:446
WOLFSSL_API int wolfSSL_Cleanup(void)
Un-initializes the wolfSSL library from further use. Doesn’t have to be called, though it will free a...
Definition ssl.c:12129
Definition internal.h:2595
Definition internal.h:3849
Header file containing key wolfSSL API.