diff options
author | gthaker <gthaker@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-09-16 16:04:03 +0000 |
---|---|---|
committer | gthaker <gthaker@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-09-16 16:04:03 +0000 |
commit | 7be150577a7bc4dd42c1df247f66ef0d9fc48538 (patch) | |
tree | 453bbf5700850640b2d33d69989abc944f8b219a /ace/SOCK_SEQPACK_Association.cpp | |
parent | 8fe0aa167e19610fa51e0b740988cd95982c5093 (diff) | |
download | ATCD-7be150577a7bc4dd42c1df247f66ef0d9fc48538.tar.gz |
ChangeLogTag:Tue Sep 16 11:55:18 2003 Gautam H. Thaker <gthaker@atl.lmco.com>
Diffstat (limited to 'ace/SOCK_SEQPACK_Association.cpp')
-rw-r--r-- | ace/SOCK_SEQPACK_Association.cpp | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/ace/SOCK_SEQPACK_Association.cpp b/ace/SOCK_SEQPACK_Association.cpp index ab4b084218d..fcf3f0b9b7f 100644 --- a/ace/SOCK_SEQPACK_Association.cpp +++ b/ace/SOCK_SEQPACK_Association.cpp @@ -36,11 +36,12 @@ ACE_SOCK_SEQPACK_Association::close (void) return ACE_SOCK::close (); } -#if defined (ACE_HAS_LKSCTP) int ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const { ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_local_addrs"); + +#if defined (ACE_HAS_LKSCTP) /* The size of ACE_INET_Addr must be large enough to hold the number of local addresses on the machine. If the array is too small, the function @@ -52,17 +53,17 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz 1. a socket fd 2. a sctp association_id which will be ignored since we are using tcp sockets - 3. a pointer to a sockaddr_storage + 3. a pointer to sockaddr lksctp/draft will allocate memory and we are responsible for freeing it by calling sctp_freeladdrs(). */ sockaddr_in *si = 0; - sockaddr_storage *laddrs = 0; + sockaddr *laddrs = 0; int err = 0; size_t len = 0; - + err = sctp_getladdrs(this->get_handle(), 0, &laddrs); if (err > 0) { @@ -78,7 +79,7 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz for (size_t i = 0; i < len; i++) { - // first we cast the sockaddr_storage to sockaddr_in + // first we cast the sockaddr to sockaddr_in // since we only support ipv4 at this time. si = (sockaddr_in *) (&(laddrs[i])); @@ -99,16 +100,9 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz // make sure we free the struct using the system function sctp_freeladdrs(laddrs); - return 0; -} #else -int -ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &size) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_local_addrs"); - /* We will be calling ACE_OS::getsockname, which accepts (and potentially modifies) two reference parameters: @@ -169,17 +163,16 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz addrs[i].set_type(addr_structs[i].sin_family); addrs[i].set_size(sizeof(sockaddr_in)); } - +#endif /* ACE_HAS_LKSCTP */ return 0; } -#endif -#if defined (ACE_HAS_LKSCTP) int ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const { ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_remote_addrs"); +#if defined (ACE_HAS_LKSCTP) /* The size of ACE_INET_Addr must be large enough to hold the number of remotes addresses in the association. If the array is too small, the @@ -191,14 +184,14 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si 1. a socket fd 2. a sctp association_id which will be ignored since we are using tcp sockets - 3. a pointer to a sockaddr_storage + 3. a pointer to a sockaddr lksctp/draft will allocate memory and we are responsible for freeing it by calling sctp_freepaddrs(). */ sockaddr_in *si = 0; - sockaddr_storage *paddrs = 0; + sockaddr *paddrs = 0; int err = 0; size_t len = 0; @@ -217,7 +210,7 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si for (size_t i = 0; i < len; i++) { - // first we cast the sockaddr_storage to sockaddr_in + // first we cast the sockaddr to sockaddr_in // since we only support ipv4 at this time. si = (sockaddr_in *) (&(paddrs[i])); @@ -238,16 +231,9 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si // make sure we free the struct using the system function sctp_freepaddrs(paddrs); - return 0; -} #else -int -ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &size) const -{ - ACE_TRACE ("ACE_SOCK_SEQPACK_Association::get_remote_addrs"); - /* We will be calling ACE_OS::getpeername, which accepts (and potentially modifies) two reference parameters: @@ -308,10 +294,9 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si addrs[i].set_type(addr_structs[i].sin_family); addrs[i].set_size(sizeof(sockaddr_in)); } - +#endif /* ACE_HAS_LKSCTP */ return 0; } -#endif #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Auto_Array_Ptr<sockaddr_in>; |