From f5a0b8a5e24cede05e15ab696f0e15257a503525 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Thu, 31 Jan 2019 18:20:48 +0100 Subject: [HICN24] Windows compatibility for hicn-light Change-Id: I8e19e52c9b4ec0fcbd7344c28765f5da1937569c Signed-off-by: Angelo Mantellini --- hicn-light/src/config/configurationListeners.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'hicn-light/src/config/configurationListeners.c') diff --git a/hicn-light/src/config/configurationListeners.c b/hicn-light/src/config/configurationListeners.c index 0982a2b13..01ab9a3e7 100644 --- a/hicn-light/src/config/configurationListeners.c +++ b/hicn-light/src/config/configurationListeners.c @@ -13,13 +13,15 @@ * limitations under the License. */ +#ifndef _WIN32 #include +#include +#endif #include #include #include #include #include -#include #include #include @@ -40,7 +42,7 @@ static bool _setupHicnListenerOnInet4(Forwarder *forwarder, const char *symbolic, Address *address) { bool success = false; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(_WIN32) ListenerOps *ops = hicnListener_CreateInet(forwarder, (char *)symbolic, address); if (ops != NULL) { @@ -48,14 +50,14 @@ static bool _setupHicnListenerOnInet4(Forwarder *forwarder, parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet", symbolic); } -#endif /* __APPLE__ */ +#endif /* __APPLE__ _WIN32*/ return success; } static bool _setupHicnListenerOnInet6(Forwarder *forwarder, const char *symbolic, Address *address) { bool success = false; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(_WIN32) ListenerOps *ops = hicnListener_CreateInet6(forwarder, (char *)symbolic, address); if (ops != NULL) { @@ -63,7 +65,7 @@ static bool _setupHicnListenerOnInet6(Forwarder *forwarder, parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet", symbolic); } -#endif /* __APPLE__ */ +#endif /* __APPLE__ _WIN32 */ return success; } @@ -79,7 +81,7 @@ bool configurationListeners_Remove(const Configuration *config) { bool _AddPuntingInet(const Configuration *config, Punting *punting, unsigned ingressId) { -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(_WIN32) struct sockaddr *addr = parcNetwork_SockAddress("0.0.0.0", 1234); if (addr == NULL) { printf("Error creating address\n"); @@ -139,7 +141,7 @@ bool _AddPuntingInet(const Configuration *config, Punting *punting, bool _AddPuntingInet6(const Configuration *config, Punting *punting, unsigned ingressId) { -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(_WIN32) struct sockaddr *addr = parcNetwork_SockAddress("0::0", 1234); if (addr == NULL) { printf("Error creating address\n"); @@ -149,9 +151,9 @@ bool _AddPuntingInet6(const Configuration *config, Punting *punting, Address *fakeAddr = addressCreateFromInet6((struct sockaddr_in6 *)addr); // comments: - // EncapType: I use the Hicn encap since the punting is available only for Hicn - // listeners LocalAddress: The only listern for which we need punting rules is - // the main one, which has no address + // EncapType: I use the Hicn encap since the punting is available only for + // Hicn listeners LocalAddress: The only listern for which we need punting + // rules is the main one, which has no address // so I create a fake empty address. This need to be consistent // with the address set at creation time -- cgit 1.2.3-korg