Author: jfrederic.clere(a)jboss.com
Date: 2009-01-29 09:45:07 -0500 (Thu, 29 Jan 2009)
New Revision: 2244
Added:
trunk/mod_cluster/test/native/
trunk/mod_cluster/test/native/Advertise.c
trunk/mod_cluster/test/native/Makefile
Log:
Add a small Advertise test.
Added: trunk/mod_cluster/test/native/Advertise.c
===================================================================
--- trunk/mod_cluster/test/native/Advertise.c (rev 0)
+++ trunk/mod_cluster/test/native/Advertise.c 2009-01-29 14:45:07 UTC (rev 2244)
@@ -0,0 +1,63 @@
+/*
+ * Advertise (test for multicast)
+ *
+ * Copyright(c) 2009 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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 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 in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ */
+
+#include "apr.h"
+#include "apr_network_io.h"
+#include "apr_strings.h"
+
+int main(int argc, char **argv)
+{
+ apr_pool_t *pool;
+ apr_status_t rv;
+ apr_sockaddr_t *ma_mgroup_sa;
+ apr_socket_t *ma_mgroup_socket;
+
+ apr_initialize();
+ atexit(apr_terminate);
+
+ apr_pool_create(&pool, NULL);
+
+ rv = apr_sockaddr_info_get(&ma_mgroup_sa, "224.0.1.105", APR_INET,
23364, APR_UNSPEC, pool);
+ if (rv != APR_SUCCESS) {
+ printf("apr_sockaddr_info_get failed %d\n", rv);
+ return 1;
+ }
+
+ rv = apr_socket_create(&ma_mgroup_socket, ma_mgroup_sa->family, SOCK_DGRAM,
APR_PROTO_UDP, pool);
+ if (rv != APR_SUCCESS) {
+ printf("apr_socket_create failed %d\n", rv);
+ return 1;
+ }
+ rv = apr_mcast_join(ma_mgroup_socket, ma_mgroup_sa, NULL, NULL);
+ if (rv != APR_SUCCESS) {
+ printf("apr_mcast_join failed %d\n", rv);
+ return 1;
+ }
+
+
+
+ return 0;
+}
Added: trunk/mod_cluster/test/native/Makefile
===================================================================
--- trunk/mod_cluster/test/native/Makefile (rev 0)
+++ trunk/mod_cluster/test/native/Makefile 2009-01-29 14:45:07 UTC (rev 2244)
@@ -0,0 +1,5 @@
+APACHE_BASE = /home/jfclere/APACHE-2.2.9
+
+Advertise: Advertise.c
+ cc -c -I$(APACHE_BASE)/include Advertise.c
+ cc -o Advertise Advertise.o -L$(APACHE_BASE)/lib -lapr-1