apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1183693 - in /apr/apr/trunk: CHANGES include/apr_network_io.h network_io/os2/sockopt.c network_io/unix/sockopt.c network_io/win32/sockopt.c
Date Sat, 15 Oct 2011 20:51:41 GMT
Author: sf
Date: Sat Oct 15 20:51:40 2011
New Revision: 1183693

URL: http://svn.apache.org/viewvc?rev=1183693&view=rev
Log:
Add support for APR_SO_BROADCAST

PR: 46389
Submitted by: Armin Müller <mueller itestra com>

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/apr_network_io.h
    apr/apr/trunk/network_io/os2/sockopt.c
    apr/apr/trunk/network_io/unix/sockopt.c
    apr/apr/trunk/network_io/win32/sockopt.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1183693&r1=1183692&r2=1183693&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Sat Oct 15 20:51:40 2011
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) apr_socket_opt_set: Add support for APR_SO_BROADCAST. PR 46389.
+     [Armin Müller <mueller itestra com>]
+
   *) apr_memcache_server_create: Fix possible segfault. PR 51064.
      [Michajlo Matijkiw <michajlo_matijkiw comcast com>]
 

Modified: apr/apr/trunk/include/apr_network_io.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_network_io.h?rev=1183693&r1=1183692&r2=1183693&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_network_io.h (original)
+++ apr/apr/trunk/include/apr_network_io.h Sat Oct 15 20:51:40 2011
@@ -103,6 +103,8 @@ extern "C" {
                                     * until data is available.
                                     * @see apr_socket_accept_filter
                                     */
+#define APR_SO_BROADCAST     65536 /**< Allow broadcast
+                                    */
 
 /** @} */
 

Modified: apr/apr/trunk/network_io/os2/sockopt.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/os2/sockopt.c?rev=1183693&r1=1183692&r2=1183693&view=diff
==============================================================================
--- apr/apr/trunk/network_io/os2/sockopt.c (original)
+++ apr/apr/trunk/network_io/os2/sockopt.c Sat Oct 15 20:51:40 2011
@@ -58,6 +58,11 @@ APR_DECLARE(apr_status_t) apr_socket_opt
             return APR_FROM_OS_ERROR(sock_errno());
         }
     }
+    if (opt & APR_SO_BROADCAST) {
+        if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int))
== -1) {
+            return APR_FROM_OS_ERROR(sock_errno());
+        }
+    }
     if (opt & APR_SO_REUSEADDR) {
         if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int))
== -1) {
             return APR_FROM_OS_ERROR(sock_errno());

Modified: apr/apr/trunk/network_io/unix/sockopt.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sockopt.c?rev=1183693&r1=1183692&r2=1183693&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockopt.c (original)
+++ apr/apr/trunk/network_io/unix/sockopt.c Sat Oct 15 20:51:40 2011
@@ -141,6 +141,18 @@ apr_status_t apr_socket_opt_set(apr_sock
             apr_set_option(sock, APR_SO_DEBUG, on);
         }
         break;
+    case APR_SO_BROADCAST:
+#ifdef SO_BROADCAST
+        if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) {
+            if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one,
sizeof(int)) == -1) {
+                return errno;
+            }
+            apr_set_option(sock, APR_SO_BROADCAST, on);
+        }
+#else
+        return APR_ENOTIMPL;
+#endif
+        break;
     case APR_SO_REUSEADDR:
         if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) {
             if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one,
sizeof(int)) == -1) {

Modified: apr/apr/trunk/network_io/win32/sockopt.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/win32/sockopt.c?rev=1183693&r1=1183692&r2=1183693&view=diff
==============================================================================
--- apr/apr/trunk/network_io/win32/sockopt.c (original)
+++ apr/apr/trunk/network_io/win32/sockopt.c Sat Oct 15 20:51:40 2011
@@ -134,6 +134,15 @@ APR_DECLARE(apr_status_t) apr_socket_opt
             return apr_get_netos_error();
         }
         break;
+    case APR_SO_BROADCAST:
+        if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) {
+           if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, 
+                           (void *)&one, sizeof(int)) == -1) {
+                return apr_get_netos_error();
+            }
+            apr_set_option(sock, APR_SO_BROADCAST, on);
+        }
+        break;
     case APR_SO_REUSEADDR:
         if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) {
             if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, 



Mime
View raw message