From 07133ac060c2af721941f7b47c52c075df3168ba Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 30 Apr 2021 12:26:57 +0200 Subject: [HICN-703] Update windows-sdk and hicn code Signed-off-by: Angelo Mantellini <@ngelo.mantellini@cisco.com> Change-Id: I05e4c92ce7de3640f0272afae127e1377862bd3e Signed-off-by: Angelo Mantellini --- lib/includes/hicn/base.h | 5 +++- lib/includes/hicn/common.h | 3 +++ lib/includes/hicn/util/windows/dlfcn.h | 33 ++++++++++++++++++++++++++ lib/includes/hicn/util/windows/windows_utils.h | 8 +++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 lib/includes/hicn/util/windows/dlfcn.h (limited to 'lib/includes') diff --git a/lib/includes/hicn/base.h b/lib/includes/hicn/base.h index 797912f91..1061724ce 100644 --- a/lib/includes/hicn/base.h +++ b/lib/includes/hicn/base.h @@ -22,8 +22,11 @@ #define HICN_BASE_H #include "common.h" +#ifdef _WIN32 +#include +#else #include - +#endif /* Default header fields */ #define HICN_DEFAULT_TTL 254 diff --git a/lib/includes/hicn/common.h b/lib/includes/hicn/common.h index a5ca2878b..05f8ad95f 100644 --- a/lib/includes/hicn/common.h +++ b/lib/includes/hicn/common.h @@ -104,6 +104,9 @@ typedef uword ip_csum_t; /* Windows compatibility headers */ #define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX +#define NOMINMAX +#endif #include #include #include 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 #include #include #include #include #include +#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 -- cgit 1.2.3-korg