From f9d279664c4f3cc6ec5bbc446e5b8d5a2c036e4b Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 18 Jun 2012 17:07:14 -0500 Subject: [PATCH] add test version of mod_redis to vs2010 solution - not built by default --- Freeswitch.2010.sln | 16 + src/mod/applications/mod_redis/credis.c | 18 +- .../mod_redis/mod_redis.2008.vcproj | 295 ++++++++++++++++++ .../mod_redis/mod_redis.2010.vcxproj | 123 ++++++++ 4 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 src/mod/applications/mod_redis/mod_redis.2008.vcproj create mode 100644 src/mod/applications/mod_redis/mod_redis.2010.vcxproj diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 954ce1cc1b..cd22423f5b 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -527,6 +527,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\projects\win\libzrtp.2010.vcxproj", "{C13CC324-0032-4492-9A30-310A6BD64FF5}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_redis", "src\mod\applications\mod_redis\mod_redis.2010.vcxproj", "{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3593,6 +3595,19 @@ Global {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.Build.0 = Release|x64 {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64 Setup.ActiveCfg = Release|Win32 {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x86 Setup.ActiveCfg = Release|Win32 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|Win32.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x64.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x64.Build.0 = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x64 Setup.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x86 Setup.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Debug|Win32.ActiveCfg = Debug|Win32 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Debug|x64.ActiveCfg = Debug|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|Win32.ActiveCfg = Release|Win32 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x64.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x64 Setup.ActiveCfg = Release|x64 + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3648,6 +3663,7 @@ Global {4748FF56-CA85-4809-97D6-A94C0FAC1D77} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2469B306-B027-4FF2-8815-C9C1EA2CAE79} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_redis/credis.c b/src/mod/applications/mod_redis/credis.c index bb71904005..d25756fc3a 100644 --- a/src/mod/applications/mod_redis/credis.c +++ b/src/mod/applications/mod_redis/credis.c @@ -32,6 +32,11 @@ #include #include #include +#ifdef _MSC_VER +#include +#include +#define snprintf _snprintf +#else #include #include #include @@ -39,6 +44,7 @@ #include #include #include +#endif #include #include #include @@ -550,6 +556,7 @@ REDIS credis_connect(const char *host, int port, int timeout) int fd, yes = 1; struct sockaddr_in sa; REDIS rhnd; + int valid = 0; if ((rhnd = cr_new()) == NULL) return NULL; @@ -566,7 +573,16 @@ REDIS credis_connect(const char *host, int port, int timeout) sa.sin_family = AF_INET; sa.sin_port = htons(port); - if (inet_aton(host, &sa.sin_addr) == 0) { +#ifdef WIN32 + sa.sin_addr.S_un.S_addr = inet_addr(host); + if (sa.sin_addr.S_un.S_addr != 0) { + valid = 1; + } +#else + valid = inet_aton(host, &sa.sin_addr); +#endif + + if (valid == 0) { struct hostent *he = gethostbyname(host); if (he == NULL) goto error; diff --git a/src/mod/applications/mod_redis/mod_redis.2008.vcproj b/src/mod/applications/mod_redis/mod_redis.2008.vcproj new file mode 100644 index 0000000000..5afc296984 --- /dev/null +++ b/src/mod/applications/mod_redis/mod_redis.2008.vcproj @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_redis/mod_redis.2010.vcxproj b/src/mod/applications/mod_redis/mod_redis.2010.vcxproj new file mode 100644 index 0000000000..d5cef0ccbb --- /dev/null +++ b/src/mod/applications/mod_redis/mod_redis.2010.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_redis + {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6} + mod_redis + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + false + + + + + + + X64 + + + + false + + + MachineX64 + + + + + + false + + + + + + + X64 + + + + false + + + MachineX64 + + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + + + + \ No newline at end of file