aboutsummaryrefslogtreecommitdiffstats
path: root/lib/includes/hicn/util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/includes/hicn/util')
-rw-r--r--lib/includes/hicn/util/ip_address.h11
-rw-r--r--lib/includes/hicn/util/log.h2
-rw-r--r--lib/includes/hicn/util/windows/dlfcn.h33
-rwxr-xr-xlib/includes/hicn/util/windows/windows_utils.h8
4 files changed, 53 insertions, 1 deletions
diff --git a/lib/includes/hicn/util/ip_address.h b/lib/includes/hicn/util/ip_address.h
index 27880047c..a43f16754 100644
--- a/lib/includes/hicn/util/ip_address.h
+++ b/lib/includes/hicn/util/ip_address.h
@@ -135,6 +135,17 @@ const u8 * ip_address_get_buffer(const ip_address_t * ip_address, int family);
int ip_address_ntop (const ip_address_t * ip_address, char *dst,
const size_t len, int family);
int ip_address_pton (const char *ip_address_str, ip_address_t * ip_address);
+
+/**
+ * @brief Return the ip_address provided as parameter in string format.
+ * E.g. (for ipv4): "0.0.0.0"
+ *
+ * @param[in, out] s String to store the parsed address
+ * @param[in] size Size of the string @p s
+ * @param[in] ip_address Address to parse to string
+ * @param[in] family Address family (e.g. AF_INET, AF_INET6)
+ * @return int Length of the string generated parsing the addr
+ */
int ip_address_snprintf(char * s, size_t size, const ip_address_t * ip_address,
int family);
int ip_address_to_sockaddr(const ip_address_t * ip_address, struct sockaddr *sa,
diff --git a/lib/includes/hicn/util/log.h b/lib/includes/hicn/util/log.h
index 6763d464f..5650a164e 100644
--- a/lib/includes/hicn/util/log.h
+++ b/lib/includes/hicn/util/log.h
@@ -34,7 +34,7 @@ typedef struct {
} log_conf_t;
#define DEFAULT_LOG_CONF { \
- .log_level = LOG_INFO, \
+ .log_level = LOG_TRACE, \
.debug = 0, \
.log_file = NULL, \
};
diff --git a/lib/includes/hicn/util/windows/dlfcn.h b/lib/includes/hicn/util/windows/dlfcn.h
new file mode 100644
index 000000000..7775226cd
--- /dev/null
+++ b/lib/includes/hicn/util/windows/dlfcn.h
@@ -0,0 +1,33 @@
+/* dlfcn.h */
+
+#ifndef DLFCN_H
+#define DLFCN_H
+#define RTLD_GLOBAL 0x100 /* do not hide entries in this module */
+#define RTLD_LOCAL 0x000 /* hide entries in this module */
+
+#define RTLD_LAZY 0x000 /* accept unresolved externs */
+#define RTLD_NOW 0x001 /* abort if module has unresolved externs */
+
+/*
+ How to call in Windows:
+
+ void *h = dlopen ("path\\library.dll", flags)
+ void (*fun)() = dlsym (h, "entry")
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void *dlopen (const char *filename, int flag);
+ int dlclose (void *handle);
+
+ void *dlsym (void *handle, const char *name);
+
+const char *dlerror (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif \ No newline at end of file
diff --git a/lib/includes/hicn/util/windows/windows_utils.h b/lib/includes/hicn/util/windows/windows_utils.h
index c4662af5e..d24aaadbf 100755
--- a/lib/includes/hicn/util/windows/windows_utils.h
+++ b/lib/includes/hicn/util/windows/windows_utils.h
@@ -17,12 +17,16 @@
#define WINDOWS_UTILS_H
#define WIN32_LEAN_AND_MEAN
#define HAVE_STRUCT_TIMESPEC
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
#include <Windows.h>
#include <stdint.h>
#include <io.h>
#include <stdlib.h>
#include <winsock2.h>
#include <WS2tcpip.h>
+#include "dlfcn.h"
#ifndef IOVEC
#define IOVEC
@@ -152,3 +156,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp);
((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \
| (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
#endif
+
+#ifndef bzero
+#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
+#endif \ No newline at end of file