This addresses autobuild failures for windows. DNS SRV lookup is not
implemented in matahari for Windows. We'll have to do some research on
the Linux equivalent.
THanks
( adam stokes ) || ( adam.stokes(a)gmail.com )
On Wed, Jun 22, 2011 at 10:55 AM, Adam Stokes <astokes(a)fedoraproject.org> wrote:
- Handle compilation on windows since DNS SRV is
not implemented yet.
---
src/lib/CMakeLists.txt | 4 ++-
src/lib/dnssrv_private.h | 42 -------------------------------
src/lib/dnssrv_windows.c | 35 ++++++++++++++++++++++++++
src/tests/CMakeLists.txt | 2 +-
src/tests/mh_hsa.h | 59 --------------------------------------------
src/tests/mh_hsa_linux.h | 59 ++++++++++++++++++++++++++++++++++++++++++++
src/tests/mh_hsa_windows.h | 59 ++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 157 insertions(+), 103 deletions(-)
delete mode 100644 src/lib/dnssrv_private.h
create mode 100644 src/lib/dnssrv_windows.c
delete mode 100644 src/tests/mh_hsa.h
create mode 100644 src/tests/mh_hsa_linux.h
create mode 100644 src/tests/mh_hsa_windows.h
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index ab21bba..f03d6e0 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -31,12 +31,14 @@ if(WIN32)
target_link_libraries(${lib} wsock32)
install(TARGETS ${lib} DESTINATION sbin)
endforeach (lib ${LIBS})
+ add_library(mcommon_resolv SHARED dnssrv_${VARIANT}.c)
+ target_link_libraries(mcommon mcommon_resolv)
else(WIN32)
foreach (lib ${LIBS})
install(TARGETS ${lib} DESTINATION lib${LIB_SUFFIX})
endforeach (lib ${LIBS})
# libresolv
- add_library(mcommon_resolv SHARED dnssrv_linux.c)
+ add_library(mcommon_resolv SHARED dnssrv_${VARIANT}.c)
target_link_libraries(mcommon mcommon_resolv resolv)
endif(WIN32)
diff --git a/src/lib/dnssrv_private.h b/src/lib/dnssrv_private.h
deleted file mode 100644
index 0752311..0000000
--- a/src/lib/dnssrv_private.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* dnssrv.h - Copyright (c) 2011 Red Hat, Inc.
- * Written by Adam Stokes <astokes(a)fedoraproject.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define MAX_NAME_LEN 1024
-
-struct srv_reply
-{
- int prio;
- int weight;
- int port;
- char name[];
-};
-
-struct srv_reply **srv_lookup(char *service,
- char *protocol,
- char *domain);
-
-void srv_free(struct srv_reply **srv);
-
-/*
- * Local Variables:
- * mode: c
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- * vim: et
- */
diff --git a/src/lib/dnssrv_windows.c b/src/lib/dnssrv_windows.c
new file mode 100644
index 0000000..32b00ee
--- /dev/null
+++ b/src/lib/dnssrv_windows.c
@@ -0,0 +1,35 @@
+/* dnssrv_windows.c - Copyright (c) 2011 Red Hat, Inc.
+ * Written by Adam Stokes <astokes(a)fedoraproject.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "matahari/dnssrv.h"
+
+/**
+ * Domain lookup providing a Matahari broker
+ *
+ * \param[in] srv record query i.e. "_matahari._tcp.matahariproject.org
+ * \param[in] set buffer to hold domain retrieved
+ * \param[in] set buffer length
+ *
+ * \return 0 or greater for successful match
+ */
+
+int
+mh_srv_lookup(const char *query, char *target, size_t len)
+{
+ return -1;
+}
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index f57b9f0..5f79618 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -5,7 +5,7 @@ if(CXXTEST_FOUND)
ENABLE_TESTING()
CXXTEST_ADD_TEST(mh_api_network_unittest network_unittest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mh_api_network.h)
CXXTEST_ADD_TEST(mh_api_host_unittest host_unittest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mh_api_host.h)
- CXXTEST_ADD_TEST(mh_hsa_unittest hsa_unittest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mh_hsa.h)
+ CXXTEST_ADD_TEST(mh_hsa_unittest hsa_unittest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mh_hsa_${VARIANT}.h)
add_library(mh_tester SHARED test_utilities.c)
target_link_libraries(mh_tester ${pcre_LIBRARIES} mcommon mnetwork mhost)
target_link_libraries(mh_api_network_unittest mh_tester)
diff --git a/src/tests/mh_hsa.h b/src/tests/mh_hsa.h
deleted file mode 100644
index 17034f0..0000000
--- a/src/tests/mh_hsa.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * mh_hs.h: dns srv high availability test
- *
- * Copyright (C) 2011 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Adam Stokes <astokes(a)fedoraproject.org>
- */
-
-
-#ifndef __MH_HSA_UNITTEST_H
-#define __MH_HSA_UNITTEST_H
-
-#include <string.h>
-#include <stdlib.h>
-#include <cxxtest/TestSuite.h>
-
-extern "C" {
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include "mh_test_utilities.h"
-#include "matahari/dnssrv.h"
-};
-
-using namespace std;
-
-class MhHsaSuite : public CxxTest::TestSuite
-{
- public:
- std::stringstream infomsg;
-
- void testSrvLookup(void)
- {
- char target[NS_MAXDNAME];
- const char *host = "_matahari._tcp.matahariproject.org";
- int ret = 0;
-
- ret = mh_srv_lookup(host, target, NS_MAXDNAME);
- TS_ASSERT(ret == 0);
- TS_ASSERT((mh_test_is_match("^qpid.*matahariproject\\.org$",
- target)) >= 0);
- }
-};
-
-#endif
diff --git a/src/tests/mh_hsa_linux.h b/src/tests/mh_hsa_linux.h
new file mode 100644
index 0000000..17034f0
--- /dev/null
+++ b/src/tests/mh_hsa_linux.h
@@ -0,0 +1,59 @@
+/*
+ * mh_hs.h: dns srv high availability test
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Adam Stokes <astokes(a)fedoraproject.org>
+ */
+
+
+#ifndef __MH_HSA_UNITTEST_H
+#define __MH_HSA_UNITTEST_H
+
+#include <string.h>
+#include <stdlib.h>
+#include <cxxtest/TestSuite.h>
+
+extern "C" {
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#include "mh_test_utilities.h"
+#include "matahari/dnssrv.h"
+};
+
+using namespace std;
+
+class MhHsaSuite : public CxxTest::TestSuite
+{
+ public:
+ std::stringstream infomsg;
+
+ void testSrvLookup(void)
+ {
+ char target[NS_MAXDNAME];
+ const char *host = "_matahari._tcp.matahariproject.org";
+ int ret = 0;
+
+ ret = mh_srv_lookup(host, target, NS_MAXDNAME);
+ TS_ASSERT(ret == 0);
+ TS_ASSERT((mh_test_is_match("^qpid.*matahariproject\\.org$",
+ target)) >= 0);
+ }
+};
+
+#endif
diff --git a/src/tests/mh_hsa_windows.h b/src/tests/mh_hsa_windows.h
new file mode 100644
index 0000000..1cf1ea8
--- /dev/null
+++ b/src/tests/mh_hsa_windows.h
@@ -0,0 +1,59 @@
+/*
+ * mh_hs.h: dns srv high availability test
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Adam Stokes <astokes(a)fedoraproject.org>
+ */
+
+
+#ifndef __MH_HSA_UNITTEST_H
+#define __MH_HSA_UNITTEST_H
+
+#include <string.h>
+#include <stdlib.h>
+#include <cxxtest/TestSuite.h>
+
+extern "C" {
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include "mh_test_utilities.h"
+#include "matahari/dnssrv.h"
+};
+
+using namespace std;
+
+class MhHsaSuite : public CxxTest::TestSuite
+{
+ public:
+ std::stringstream infomsg;
+
+ void testSrvLookup(void)
+ {
+ char target[NI_MAXHOST];
+ const char *host = "_matahari._tcp.matahariproject.org";
+ int ret = 0;
+
+ ret = mh_srv_lookup(host, target, NI_MAXHOST);
+ TS_ASSERT(ret == 0);
+ TS_ASSERT((mh_test_is_match("^qpid.*matahariproject\\.org$",
+ target)) >= 0);
+ }
+};
+
+#endif
--
1.7.5.4