summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.h13
-rw-r--r--ace/SOCK.cpp24
-rw-r--r--ace/SOCK.h6
-rw-r--r--ace/SOCK_Acceptor.cpp45
-rw-r--r--ace/SOCK_Acceptor.h29
-rw-r--r--ace/SOCK_Connector.cpp12
-rw-r--r--ace/SOCK_Connector.h8
-rw-r--r--ace/SOCK_Dgram.cpp17
-rw-r--r--ace/SOCK_Dgram.h6
-rw-r--r--ace/SOCK_Dgram_Mcast.cpp10
-rw-r--r--ace/SOCK_Dgram_Mcast.h15
11 files changed, 156 insertions, 29 deletions
diff --git a/ace/OS.h b/ace/OS.h
index 26ccd0d102c..1315fb96c1a 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -4007,6 +4007,18 @@ struct sigaction
# define ACE_LACKS_IP_ADD_MEMBERSHIP
# endif /* IP_ADD_MEMBERSHIP */
+# if !defined (IP_DEFAULT_MULTICAST_TTL)
+# define IP_DEFAULT_MULTICAST_TTL 0
+# endif /* IP_DEFAULT_MULTICAST_TTL */
+
+# if !defined (IP_DEFAULT_MULTICAST_LOOP)
+# define IP_DEFAULT_MULTICAST_LOOP 0
+# endif /* IP_DEFAULT_MULTICAST_LOOP */
+
+# if !defined (IP_MAX_MEMBERSHIPS)
+# define IP_MAX_MEMBERSHIPS 0
+# endif /* IP_MAX_MEMBERSHIP */
+
# if !defined (SIOCGIFBRDADDR)
# define SIOCGIFBRDADDR 0
# endif /* SIOCGIFBRDADDR */
@@ -4783,7 +4795,6 @@ private:
int error_;
};
-
#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
#if defined (ACE_HAS_WINSOCK2_GQOS)
typedef SERVICETYPE ACE_SERVICE_TYPE;
diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp
index 33810aec98f..67a10d44d64 100644
--- a/ace/SOCK.cpp
+++ b/ace/SOCK.cpp
@@ -85,8 +85,8 @@ ACE_SOCK::open (int type,
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
- else if (protocol_family != PF_UNIX &&
- reuse_addr
+ else if (protocol_family != PF_UNIX
+ && reuse_addr
&& this->set_option (SOL_SOCKET,
SO_REUSEADDR,
&one,
@@ -122,7 +122,8 @@ ACE_SOCK::open (int type,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags)
+ u_long flags,
+ int reuse_addr)
{
ACE_TRACE ("ACE_SOCK::open");
@@ -133,8 +134,19 @@ ACE_SOCK::open (int type,
g,
flags));
+ int one = 1;
+
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
+ else if (reuse_addr
+ && this->set_option (SOL_SOCKET,
+ SO_REUSEADDR,
+ &one,
+ sizeof one) == -1)
+ {
+ this->close ();
+ return -1;
+ }
return 0;
}
@@ -143,7 +155,8 @@ ACE_SOCK::ACE_SOCK (int type,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags)
+ u_long flags,
+ int reuse_addr)
{
// ACE_TRACE ("ACE_SOCK::ACE_SOCK");
if (this->open (type,
@@ -151,7 +164,8 @@ ACE_SOCK::ACE_SOCK (int type,
protocol,
protocolinfo,
g,
- flags) == -1)
+ flags,
+ reuse_addr) == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p\n"),
ASYS_TEXT ("ACE_SOCK::ACE_SOCK")));
diff --git a/ace/SOCK.h b/ace/SOCK.h
index 488ca2194f7..6918bf12ff3 100644
--- a/ace/SOCK.h
+++ b/ace/SOCK.h
@@ -82,7 +82,8 @@ public:
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags);
+ u_long flags,
+ int reuse_addr);
// Wrapper around the QoS-enabled <WSASocket> function.
protected:
@@ -98,7 +99,8 @@ protected:
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags);
+ u_long flags,
+ int reuse_addr);
// Constructor with arguments to call the QoS-enabled <WSASocket>
// function.
diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp
index 5fef35a56f1..96726920173 100644
--- a/ace/SOCK_Acceptor.cpp
+++ b/ace/SOCK_Acceptor.cpp
@@ -219,6 +219,51 @@ ACE_SOCK_Acceptor::dump (void) const
ACE_TRACE ("ACE_SOCK_Acceptor::dump");
}
+int
+ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
+ int reuse_addr,
+ int protocol_family,
+ int backlog,
+ int protocol)
+{
+ ACE_TRACE ("ACE_SOCK_Acceptor::open");
+ ACE_UNUSED_ARG (local_sap);
+ ACE_UNUSED_ARG (protocolinfo);
+ ACE_UNUSED_ARG (g);
+ ACE_UNUSED_ARG (flags);
+ ACE_UNUSED_ARG (reuse_addr);
+ ACE_UNUSED_ARG (protocol_family);
+ ACE_UNUSED_ARG (backlog);
+ ACE_UNUSED_ARG (protocol);
+ ACE_NOTSUP_RETURN (-1);
+}
+
+ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
+ int reuse_addr,
+ int protocol_family,
+ int backlog,
+ int protocol)
+{
+ ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor");
+ if (this->open (local_sap,
+ protocolinfo,
+ g,
+ flags,
+ reuse_addr,
+ protocol_family,
+ backlog,
+ protocol) == -1)
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_SOCK_Acceptor")));
+}
+
// General purpose routine for performing server ACE_SOCK creation.
int
diff --git a/ace/SOCK_Acceptor.h b/ace/SOCK_Acceptor.h
index 18cd3005431..e86ba1e8522 100644
--- a/ace/SOCK_Acceptor.h
+++ b/ace/SOCK_Acceptor.h
@@ -46,14 +46,37 @@ public:
int protocol_family = PF_INET,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
- // Initiate a passive mode socket.
+ // Initialize a passive-mode BSD-style acceptor socket (no QoS).
+
+ ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
+ int reuse_addr,
+ int protocol_family,
+ int backlog = ACE_DEFAULT_BACKLOG,
+ int protocol = 0);
+ // Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
+ // on success and -1 on failure.
int open (const ACE_Addr &local_sap,
int reuse_addr = 0,
int protocol_family = PF_INET,
int backlog = ACE_DEFAULT_BACKLOG,
int protocol = 0);
- // Initiate a passive mode socket.
+ // Initialize a passive-mode BSD-style acceptor socket (no QoS).
+ // Returns 0 on success and -1 on failure.
+
+ int open (const ACE_Addr &local_sap,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
+ int reuse_addr,
+ int protocol_family,
+ int backlog = ACE_DEFAULT_BACKLOG,
+ int protocol = 0);
+ // Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
+ // on success and -1 on failure.
~ACE_SOCK_Acceptor (void);
// Default dtor.
@@ -74,7 +97,7 @@ public:
ACE_Time_Value *timeout = 0,
int restart = 1,
int reset_new_handle = 0) const;
- // Accept a new <ACE_SOCK_Stream> connection using the RVSP QoS
+ // Accept a new <ACE_SOCK_Stream> connection using the QoS
// information in <qos_params>. A <timeout> of 0 means block
// forever, a <timeout> of {0, 0} means poll. <restart> == 1 means
// "restart if interrupted," i.e., if errno == EINTR.
diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp
index 6dae7c1701c..f7334dcec0e 100644
--- a/ace/SOCK_Connector.cpp
+++ b/ace/SOCK_Connector.cpp
@@ -132,8 +132,10 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
ACE_QoS_Params qos_params,
ACE_Time_Value *timeout,
const ACE_Addr &local_sap,
+ ACE_Protocol_Info */* protocolinfo */,
+ ACE_SOCK_GROUP /* g */,
+ u_long /* flags */,
int reuse_addr,
- int /* flags */,
int /* perms */,
int protocol_family,
int protocol)
@@ -236,8 +238,10 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
ACE_QoS_Params qos_params,
ACE_Time_Value *timeout,
const ACE_Addr &local_sap,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
int reuse_addr,
- int flags,
int perms,
int protocol_family,
int protocol)
@@ -249,8 +253,10 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream,
qos_params,
timeout,
local_sap,
- reuse_addr,
+ protocolinfo,
+ g,
flags,
+ reuse_addr,
perms,
protocol_family,
protocol) == -1
diff --git a/ace/SOCK_Connector.h b/ace/SOCK_Connector.h
index aa43554fc33..6d4387239b6 100644
--- a/ace/SOCK_Connector.h
+++ b/ace/SOCK_Connector.h
@@ -72,8 +72,10 @@ public:
ACE_QoS_Params qos_params,
ACE_Time_Value *timeout = 0,
const ACE_Addr &local_sap = ACE_Addr::sap_any,
+ ACE_Protocol_Info *protocolinfo = 0,
+ ACE_SOCK_GROUP g = 0,
+ u_long flags = 0,
int reuse_addr = 0,
- int flags = 0,
int perms = 0,
int protocol_family = PF_INET,
int protocol = 0);
@@ -121,8 +123,10 @@ public:
ACE_QoS_Params qos_params,
ACE_Time_Value *timeout = 0,
const ACE_Addr &local_sap = ACE_Addr::sap_any,
+ ACE_Protocol_Info *protocolinfo = 0,
+ ACE_SOCK_GROUP g = 0,
+ u_long flags = 0,
int reuse_addr = 0,
- int flags = 0,
int perms = 0,
int protocol_family = PF_INET,
int protocol = 0);
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index 1e780337673..2c12b6eadd9 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -136,8 +136,17 @@ ACE_SOCK_Dgram::ACE_SOCK_Dgram (const ACE_Addr &local,
const ACE_QoS_Params &qos_params,
int protocol_family,
int protocol,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
int reuse_addr)
- : ACE_SOCK (SOCK_DGRAM, protocol_family, protocol, reuse_addr)
+ : ACE_SOCK (SOCK_DGRAM,
+ protocol_family,
+ protocol,
+ protocolinfo,
+ g,
+ flags,
+ reuse_addr)
{
ACE_UNUSED_ARG (qos_params);
ACE_UNUSED_ARG (local);
@@ -148,12 +157,18 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local,
const ACE_QoS_Params &qos_params,
int protocol_family,
int protocol,
+ ACE_Protocol_Info *protocolinfo,
+ ACE_SOCK_GROUP g,
+ u_long flags,
int reuse_addr)
{
ACE_UNUSED_ARG (local);
ACE_UNUSED_ARG (qos_params);
ACE_UNUSED_ARG (protocol_family);
ACE_UNUSED_ARG (protocol);
+ ACE_UNUSED_ARG (protocolinfo);
+ ACE_UNUSED_ARG (g);
+ ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (reuse_addr);
// Under construction...
diff --git a/ace/SOCK_Dgram.h b/ace/SOCK_Dgram.h
index 0573caadbc2..61d3f5af8b7 100644
--- a/ace/SOCK_Dgram.h
+++ b/ace/SOCK_Dgram.h
@@ -46,6 +46,9 @@ public:
const ACE_QoS_Params &qos_params,
int protocol_family = PF_INET,
int protocol = 0,
+ ACE_Protocol_Info *protocolinfo = 0,
+ ACE_SOCK_GROUP g = 0,
+ u_long flags = 0,
int reuse_addr = 0);
// This is a QoS-enabed method for initiating a socket dgram that
// will accept datagrams at the <local> address. The <qos_params>
@@ -62,6 +65,9 @@ public:
const ACE_QoS_Params &qos_params,
int protocol_family = PF_INET,
int protocol = 0,
+ ACE_Protocol_Info *protocolinfo = 0,
+ ACE_SOCK_GROUP g = 0,
+ u_long flags = 0,
int reuse_addr = 0);
// This is a QoS-enabed method for initiating a socket dgram that
// will accept datagrams at the <local> address. The <qos_params>
diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp
index be0f6596203..8aa988693af 100644
--- a/ace/SOCK_Dgram_Mcast.cpp
+++ b/ace/SOCK_Dgram_Mcast.cpp
@@ -181,7 +181,7 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
return 0;
}
-ACE_HANDLE
+int
ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
const ACE_QoS_Params &qos_params,
int reuse_addr,
@@ -207,8 +207,7 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
#endif /* ACE_WIN32 */
// Tell network device driver to read datagrams with a
// <mcast_request_if_> IP interface.
- else
- return ACE_OS::join_leaf (this->get_handle (),
+ else if (ACE_OS::join_leaf (this->get_handle (),
#if defined (_UNICOS)
ACE_reinterpret_cast (const sockaddr *,
&this->mcast_request_if_.imr_multiaddr),
@@ -218,7 +217,10 @@ ACE_SOCK_Dgram_Mcast::subscribe (const ACE_INET_Addr &mcast_addr,
&this->mcast_request_if_.imr_multiaddr.s_addr),
sizeof this->mcast_request_if_.imr_multiaddr.s_addr,
#endif /* ! _UNICOS */
- qos_params);
+ qos_params) == ACE_INVALID_HANDLE)
+ return -1;
+ else
+ return 0;
}
int
diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h
index b0ecf9e1327..b74db60e6da 100644
--- a/ace/SOCK_Dgram_Mcast.h
+++ b/ace/SOCK_Dgram_Mcast.h
@@ -66,12 +66,12 @@ public:
// these numbers in alphanumeric form and <subscribe> will convert
// them into numbers via <ACE_OS::atoi>.
- ACE_HANDLE subscribe (const ACE_INET_Addr &mcast_addr,
- const ACE_QoS_Params &qos_params,
- int reuse_addr = 1,
- const ASYS_TCHAR *net_if = 0,
- int protocol_family = PF_INET,
- int protocol = 0);
+ int subscribe (const ACE_INET_Addr &mcast_addr,
+ const ACE_QoS_Params &qos_params,
+ int reuse_addr = 1,
+ const ASYS_TCHAR *net_if = 0,
+ int protocol_family = PF_INET,
+ int protocol = 0);
// This is a QoS-enabled method for joining a multicast group, which
// passes <qos_params> via <ACE_OS::join_leaf>. The network
// interface device driver is instructed to accept datagrams with
@@ -82,8 +82,7 @@ public:
// The <net_if> interface is hardware specific, e.g., use "netstat
// -i" to find whether your interface is, such as "le0" or something
// else. If net_if == 0, <subscribe> uses the default mcast
- // interface. Returns: an <ACE_HANDLE> to the newly created
- // multipoint socket on success or ACE_INVALID_HANDLE on failure.
+ // interface. Returns: a 0 on success or -1 on failure.
//
// Note that some platforms, such as pSoS, support only number, not
// names, for network interfaces. For these platforms, just give