You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2011/05/26 02:20:31 UTC

svn commit: r1127742 - in /trafficserver/traffic/trunk: ./ iocore/cluster/ iocore/hostdb/ iocore/net/ lib/ts/ mgmt/preparse/ proxy/ proxy/api/ts/ proxy/http/

Author: amc
Date: Thu May 26 00:20:30 2011
New Revision: 1127742

URL: http://svn.apache.org/viewvc?rev=1127742&view=rev
Log:
TS-679: Make Plugin API IPv6 compatible

Modified:
    trafficserver/traffic/trunk/CHANGES
    trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc
    trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
    trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
    trafficserver/traffic/trunk/iocore/net/P_NetVConnection.h
    trafficserver/traffic/trunk/lib/ts/ink_inet.h
    trafficserver/traffic/trunk/mgmt/preparse/SocksParser.cc
    trafficserver/traffic/trunk/proxy/ConfigParse.h
    trafficserver/traffic/trunk/proxy/FetchSM.cc
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/InkAPITest.cc
    trafficserver/traffic/trunk/proxy/InkAPITestTool.cc
    trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
    trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc
    trafficserver/traffic/trunk/proxy/http/HttpSM.cc
    trafficserver/traffic/trunk/proxy/http/HttpTransact.h

Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Thu May 26 00:20:30 2011
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 
 Changes with Apache Traffic Server 2.1.9
+  *) [TS-679] The external API was changed to make it IPv6 compliant
+     (although it doesn't actually work with IPv6). Old API functions
+     were deprecated but not removed.
+
   *) [TS-797] Wrong delete used in stats processor.
 
   *) [TS-769] Fixed infinite loop when getting a 505 response from the

Modified: trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc (original)
+++ trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc Thu May 26 00:20:30 2011
@@ -1384,7 +1384,7 @@ ClusterHandler::dump_write_msg(int res)
   // Debug support for inter cluster message trace
   unsigned char x[4];
   memset(x, 0, sizeof(x));
-  *(uint32_t *) & x = (uint32_t) ((struct sockaddr_in *)&(net_vc->get_remote_addr()))->sin_addr.s_addr;
+  *(uint32_t *) & x = (uint32_t) ((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
 
   fprintf(stderr,
           "[W] %hhu.%hhu.%hhu.%hhu SeqNo=%u, Cnt=%d, CntlCnt=%d Todo=%d, Res=%d\n",
@@ -1403,7 +1403,7 @@ ClusterHandler::dump_read_msg()
   // Debug support for inter cluster message trace
   unsigned char x[4];
   memset(x, 0, sizeof(x));
-  *(uint32_t *) & x = (uint32_t) ((struct sockaddr_in *)&(net_vc->get_remote_addr()))->sin_addr.s_addr;
+  *(uint32_t *) & x = (uint32_t) ((struct sockaddr_in *)(net_vc->get_remote_addr()))->sin_addr.s_addr;
 
   fprintf(stderr, "[R] %hhu.%hhu.%hhu.%hhu  SeqNo=%u, Cnt=%d, CntlCnt=%d\n",
           x[0], x[1], x[2], x[3], read.sequence_number, read.msg.count, read.msg.control_bytes);

Modified: trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h Thu May 26 00:20:30 2011
@@ -267,6 +267,8 @@ struct HostDBInfo
 
   uint64_t md5_high;
 
+  sockaddr_in6 ip6;
+
   bool failed() {
     return !ip();
   }

Modified: trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h Thu May 26 00:20:30 2011
@@ -369,7 +369,7 @@ public:
   virtual ink_hrtime get_inactivity_timeout() = 0;
 
   /** Returns local sockaddr storage. */
-  const struct sockaddr_storage &get_local_addr();
+  sockaddr_storage const* get_local_addr();
 
   /** Returns local ip. */
   unsigned int get_local_ip();
@@ -378,7 +378,7 @@ public:
   int get_local_port();
 
   /** Returns remote sockaddr storage. */
-  const struct sockaddr_storage &get_remote_addr();
+  sockaddr_storage const* get_remote_addr();
 
   /** Returns remote ip. */
   unsigned int get_remote_ip();

Modified: trafficserver/traffic/trunk/iocore/net/P_NetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/P_NetVConnection.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/P_NetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/P_NetVConnection.h Thu May 26 00:20:30 2011
@@ -23,22 +23,22 @@
 
 #include "I_NetVConnection.h"
 
-TS_INLINE const struct sockaddr_storage &
+TS_INLINE sockaddr_storage const*
 NetVConnection::get_remote_addr()
 {
   if (!got_remote_addr) {
     set_remote_addr();
     got_remote_addr = 1;
   }
-  return remote_addr;
+  return &remote_addr;
 }
 
 TS_INLINE unsigned int
 NetVConnection::get_remote_ip()
 {
-  switch (get_remote_addr().ss_family) {
+  switch (get_remote_addr()->ss_family) {
   case AF_INET:
-    return (unsigned int)((struct sockaddr_in *)&(get_remote_addr()))->sin_addr.s_addr;
+    return (unsigned int)((struct sockaddr_in *)(get_remote_addr()))->sin_addr.s_addr;
   default:
     return 0;
   }
@@ -48,42 +48,42 @@ NetVConnection::get_remote_ip()
 TS_INLINE int
 NetVConnection::get_remote_port()
 {
-  switch (get_remote_addr().ss_family) {
+  switch (get_remote_addr()->ss_family) {
   case AF_INET:
-    return ntohs(((struct sockaddr_in *)&(get_remote_addr()))->sin_port);
+    return ntohs(((struct sockaddr_in *)(get_remote_addr()))->sin_port);
   case AF_INET6:
-    return ntohs(((struct sockaddr_in6 *)&(get_remote_addr()))->sin6_port);
+    return ntohs(((struct sockaddr_in6 *)(get_remote_addr()))->sin6_port);
   default:
     return 0;
   }
 }
 
-TS_INLINE const struct sockaddr_storage &
+TS_INLINE sockaddr_storage const*
 NetVConnection::get_local_addr()
 {
   if (!got_local_addr) {
     set_local_addr();
     switch (local_addr.ss_family) {
     case AF_INET:
-      if (((struct sockaddr_in *)&(local_addr))->sin_addr.s_addr || ((struct sockaddr_in *)&(local_addr))->sin_port) {
+      if (((struct sockaddr_in *)(&local_addr))->sin_addr.s_addr || ((struct sockaddr_in *)&(local_addr))->sin_port) {
         got_local_addr = 1;
       }
       break;
     case AF_INET6:
-      if (((struct sockaddr_in6 *)&(local_addr))->sin6_addr.s6_addr || ((struct sockaddr_in6 *)&(local_addr))->sin6_port) {
+      if (((struct sockaddr_in6 *)(&local_addr))->sin6_addr.s6_addr || ((struct sockaddr_in6 *)(&local_addr))->sin6_port) {
         got_local_addr = 1;
       }
     }
   }
-  return local_addr;
+  return &local_addr;
 }
 
 TS_INLINE unsigned int
 NetVConnection::get_local_ip()
 {
-  switch (get_local_addr().ss_family) {
+  switch (get_local_addr()->ss_family) {
   case AF_INET:
-    return (unsigned int)((struct sockaddr_in *)&(get_local_addr()))->sin_addr.s_addr;
+    return (unsigned int)((struct sockaddr_in *)(get_local_addr()))->sin_addr.s_addr;
   default:
     return 0;
   }
@@ -92,11 +92,11 @@ NetVConnection::get_local_ip()
 TS_INLINE int
 NetVConnection::get_local_port()
 {
-  switch (get_local_addr().ss_family) {
+  switch (get_local_addr()->ss_family) {
   case AF_INET:
-    return ntohs(((struct sockaddr_in *)&(get_local_addr()))->sin_port);
+    return ntohs(((struct sockaddr_in *)(get_local_addr()))->sin_port);
   case AF_INET6:
-    return ntohs(((struct sockaddr_in6 *)&(get_local_addr()))->sin6_port);
+    return ntohs(((struct sockaddr_in6 *)(get_local_addr()))->sin6_port);
   default:
     return 0;
   }

Modified: trafficserver/traffic/trunk/lib/ts/ink_inet.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_inet.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_inet.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_inet.h Thu May 26 00:20:30 2011
@@ -91,4 +91,182 @@ inkcoreapi uint32_t ink_inet_addr(const 
 const char *ink_inet_ntop(const struct sockaddr *addr, char *dst, size_t size);
 uint16_t ink_inet_port(const struct sockaddr *addr);
 
+/// Reset an address to invalid.
+/// Convenience overload.
+/// @note Useful for marking a member as not yet set.
+inline void ink_inet_invalidate(sockaddr_storage* addr) {
+  addr->ss_family = AF_UNSPEC;
+}
+
+/// Set to all zero.
+inline void ink_inet_init(sockaddr_storage* addr) {
+  memset(addr, 0, sizeof(addr));
+  ink_inet_invalidate(addr);
+}
+
+/// @return @a a cast to @c sockaddr_storage*.
+inline sockaddr_storage* ink_inet_ss_cast(sockaddr* a) {
+  return static_cast<sockaddr_storage*>(static_cast<void*>(a));
+}
+/// @return @a a cast to @c sockaddr_storage const*.
+inline sockaddr_storage const* ink_inet_ss_cast(sockaddr const* a) {
+  return static_cast<sockaddr_storage const*>(static_cast<void const*>(a));
+}
+/// @return @a a cast to @c sockaddr_storage const*.
+inline sockaddr_storage* ink_inet_ss_cast(sockaddr_in6* a) {
+  return reinterpret_cast<sockaddr_storage*>(a);
+}
+/// @return @a a cast to @c sockaddr_storage const*.
+inline sockaddr_storage const* ink_inet_ss_cast(sockaddr_in6 const* a) {
+  return reinterpret_cast<sockaddr_storage const*>(a);
+}
+/// @return @a a cast to @c sockaddr*.
+inline sockaddr* ink_inet_sa_cast(sockaddr_storage* a) {
+  return reinterpret_cast<sockaddr*>(a);
+}
+/// @return @a a cast to sockaddr const*.
+inline sockaddr const* ink_inet_sa_cast(sockaddr_storage const* a) {
+  return reinterpret_cast<sockaddr const*>(a);
+}
+/// @return @a a cast to sockaddr const*.
+inline sockaddr const* ink_inet_sa_cast(sockaddr_in6 const* a) {
+  return reinterpret_cast<sockaddr const*>(a);
+}
+
+/// Test for IPv4 protocol.
+/// @return @c true if the address is IPv4, @c false otherwise.
+inline bool ink_inet_is_ip4(sockaddr_storage const* addr) {
+  return AF_INET == addr->ss_family;
+}
+/// Test for IPv4 protocol.
+/// @return @c true if the address is IPv4, @c false otherwise.
+inline bool ink_inet_is_ip4(sockaddr const* addr) {
+  return AF_INET == addr->sa_family;
+}
+/// Test for IPv6 protocol.
+/// Convenience overload.
+/// @return @c true if the address is IPv6, @c false otherwise.
+inline bool ink_inet_is_ip6(sockaddr_storage const* addr) {
+  return AF_INET6 == addr->ss_family;
+}
+
+/// IPv4 cast.
+/// @return @a a cast to a @c sockaddr_in*
+inline sockaddr_in* ink_inet_ip4_cast(
+  sockaddr_storage* a ///< Address structure.
+) {
+  return static_cast<sockaddr_in*>(static_cast<void*>(a));
+}
+/// IPv4 cast.
+/// @return @a a cast to a @c sockaddr_in*
+inline sockaddr_in const* ink_inet_ip4_cast(
+  sockaddr_storage const* a ///< Address structure.
+) {
+  return static_cast<sockaddr_in const*>(static_cast<void const*>(a));
+}
+/// IPv4 cast.
+/// @return @a a cast to a @c sockaddr_in*
+inline sockaddr_in const* ink_inet_ip4_cast(
+  sockaddr const* a ///< Address structure.
+) {
+  return reinterpret_cast<sockaddr_in const*>(a);
+}
+/// IPv6 cast.
+/// @return @a a cast to a @c sockaddr_in6*
+inline sockaddr_in6* ink_inet_ip6_cast(sockaddr_storage* a) {
+  return static_cast<sockaddr_in6*>(static_cast<void*>(a));
+}
+/// IPv6 cast.
+/// @return @a a cast to a @c sockaddr_in6*
+inline sockaddr_in6 const* ink_inet_ip6_cast(sockaddr_storage const* a) {
+  return static_cast<sockaddr_in6 const*>(static_cast<void const*>(a));
+}
+
+/** Get a reference to the port in an address.
+    @note Because this is direct access, the port value is in network order.
+    @see ink_inet_get_port for host order copy.
+    @return A reference to the port value in an IPv4 or IPv6 address.
+    @internal This is primarily for internal use but it might be handy for
+    clients so it is exposed.
+*/
+inline uint16_t& ink_inet_port_cast(sockaddr_storage* ss) {
+  static uint16_t dummy = 0;
+  return AF_INET == ss->ss_family
+    ? ink_inet_ip4_cast(ss)->sin_port
+    : AF_INET6 == ss->ss_family
+      ? ink_inet_ip6_cast(ss)->sin6_port
+      : (dummy = 0)
+    ;
+}
+/** Get a reference to the port in an address.
+    @note Because this is direct access, the port value is in network order.
+    @see ink_inet_get_port for host order copy.
+    @return A reference to the port value in an IPv4 or IPv6 address.
+    @internal This is primarily for internal use but it might be handy for
+    clients so it is exposed.
+*/
+inline uint16_t const& ink_inet_port_cast(sockaddr_storage const* ss) {
+    return ink_inet_port_cast(const_cast<sockaddr_storage*>(ss));
+}
+/** Get a reference to the port in an address.
+    @note Because this is direct access, the port value is in network order.
+    @see ink_inet_get_port for host order copy.
+    @return A reference to the port value in an IPv4 or IPv6 address.
+    @internal This is primarily for internal use but it might be handy for
+    clients so it is exposed.
+*/
+inline uint16_t const& ink_inet_port_cast(sockaddr const* sa) {
+    return ink_inet_port_cast(ink_inet_ss_cast(sa));
+}
+
+/** Access the IPv4 address.
+
+    If @a addr is not IPv4 the results are indeterminate.
+    
+    @note This is direct access to the address so it will be in
+    network order.
+
+    @return A reference to the IPv4 address in @a addr.
+*/
+inline in_addr_t& ink_inet_ip4_addr_cast(sockaddr_storage* addr) {
+    return ink_inet_ip4_cast(addr)->sin_addr.s_addr;
+}
+/** Access the IPv4 address.
+
+    If @a addr is not IPv4 the results are indeterminate.
+    
+    @note This is direct access to the address so it will be in
+    network order.
+
+    @return A reference to the IPv4 address in @a addr.
+*/
+inline in_addr_t const& ink_inet_ip4_addr_cast(sockaddr_storage const* addr) {
+    return ink_inet_ip4_cast(addr)->sin_addr.s_addr;
+}
+/** Access the IPv4 address.
+
+    If @a addr is not IPv4 the results are indeterminate.
+    
+    @note This is direct access to the address so it will be in
+    network order.
+
+    @return A reference to the IPv4 address in @a addr.
+*/
+inline in_addr_t const& ink_inet_ip4_addr_cast(sockaddr const* addr) {
+    return ink_inet_ip4_cast(addr)->sin_addr.s_addr;
+}
+
+/// Write IPv4 data to a @c sockaddr_storage.
+inline void ink_inet_ip4_set(
+  sockaddr_storage* ss, ///< Destination storage.
+  in_addr_t ip4, ///< address, IPv4 network order.
+  uint16_t port = 0 ///< port, network order.
+) {
+  sockaddr_in* sin = ink_inet_ip4_cast(ss);
+  memset(sin, 0, sizeof(*sin));
+  sin->sin_family = AF_INET;
+  memcpy(&(sin->sin_addr), &ip4, sizeof(ip4));
+  sin->sin_port = port;
+}
+
 #endif // _ink_inet.h

Modified: trafficserver/traffic/trunk/mgmt/preparse/SocksParser.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/preparse/SocksParser.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/preparse/SocksParser.cc (original)
+++ trafficserver/traffic/trunk/mgmt/preparse/SocksParser.cc Thu May 26 00:20:30 2011
@@ -23,16 +23,3 @@
 
 #include "ink_unused.h"    /* MAGIC_EDITING_TAG */
 #include "IPRange.h"
-
-char *
-SocksParser(int fd)
-{
-  IPRange ip_range;
-  return ip_range.read_table_from_file(fd, "no_socks");
-}
-
-char *
-SocksParser(FILE * fp)
-{
-  return (SocksParser(fileno(fp)));
-}

Modified: trafficserver/traffic/trunk/proxy/ConfigParse.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ConfigParse.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ConfigParse.h (original)
+++ trafficserver/traffic/trunk/proxy/ConfigParse.h Thu May 26 00:20:30 2011
@@ -33,8 +33,8 @@
 
 char *parseStorageFile(FILE * fp);
 char *parseStorageFile(int fd);
-char *SocksParser(FILE * fp);
-char *SocksParser(int fd);
+//char *SocksParser(FILE * fp);
+//char *SocksParser(int fd);
 char *parseRemapFile(FILE * fp);
 char *parseRemapFile(int fd);
 

Modified: trafficserver/traffic/trunk/proxy/FetchSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/FetchSM.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/FetchSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/FetchSM.cc Thu May 26 00:20:30 2011
@@ -52,7 +52,9 @@ void
 FetchSM::httpConnect()
 {
   Debug(DEBUG_TAG, "[%s] calling httpconnect write", __FUNCTION__);
-  http_vc = TSHttpConnect(_ip, _port);
+  sockaddr_storage addr;
+  ink_inet_ip4_set(&addr, _ip, _port);
+  http_vc = TSHttpConnect(ink_inet_sa_cast(&addr));
 
   PluginVC *vc = (PluginVC *) http_vc;
 

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Thu May 26 00:20:30 2011
@@ -5077,13 +5077,13 @@ TSHttpTxnTransformRespGet(TSHttpTxn txnp
   return TS_ERROR;
 }
 
-const struct sockaddr_storage *
-TSHttpTxnClientSockAddrGet(TSHttpTxn txnp)
+sockaddr const*
+TSHttpTxnClientAddrGet(TSHttpTxn txnp)
 {
   sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
 
   HttpSM *sm = (HttpSM*) txnp;
-  return &sm->t_state.client_info.addr;
+  return ink_inet_sa_cast(&sm->t_state.client_info.addr);
 }
 
 unsigned int
@@ -5095,6 +5095,21 @@ TSHttpTxnClientIPGet(TSHttpTxn txnp)
   return sm->t_state.client_info.ip;
 }
 
+sockaddr const*
+TSHttpTxnIncomingAddrGet(TSHttpTxn txnp) {
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+ 
+  TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp);
+  HttpClientSession *cs = (HttpClientSession *) ssnp;
+
+  if (cs == NULL) return 0;
+
+  NetVConnection *vc = cs->get_netvc();
+  if (vc == NULL) return 0;
+
+  return ink_inet_sa_cast(vc->get_local_addr());
+}
+
 int
 TSHttpTxnClientIncomingPortGet(TSHttpTxn txnp)
 {
@@ -5104,6 +5119,15 @@ TSHttpTxnClientIncomingPortGet(TSHttpTxn
   return sm->t_state.client_info.port;
 }
 
+sockaddr const*
+TSHttpTxnServerAddrGet(TSHttpTxn txnp)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+
+  HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
+  return ink_inet_sa_cast(&sm->t_state.server_info.addr);
+}
+
 unsigned int
 TSHttpTxnServerIPGet(TSHttpTxn txnp)
 {
@@ -5141,7 +5165,27 @@ TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp,
   return TS_ERROR;
 }
 
-unsigned int
+sockaddr const*
+TSHttpTxnNextHopAddrGet(TSHttpTxn txnp)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+
+  HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
+
+    /**
+     * Return zero if the server structure is not yet constructed.
+     */
+  if (sm->t_state.current.server == NULL)
+    return 0;
+  // IPv6 - is this set elsewhere? Can't be sure.
+//  ink_inet_ip4_set(&sm->t_state.current.server->addr,
+//    sm->t_state.current.server->ip,
+//    sm->t_state.current.server->port
+//  );
+  return ink_inet_sa_cast(&sm->t_state.current.server->addr);
+}
+
+in_addr_t
 TSHttpTxnNextHopIPGet(TSHttpTxn txnp)
 {
   sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
@@ -5755,15 +5799,20 @@ TSHttpAltInfoQualitySet(TSHttpAltInfo in
 extern HttpAccept *plugin_http_accept;
 
 TSVConn
-TSHttpConnect(unsigned int log_ip, int log_port)
+TSHttpConnect(sockaddr const* addr)
 {
-  sdk_assert(log_ip > 0);
-  sdk_assert(log_port > 0);
+  sdk_assert(addr);
+
+  in_addr_t ip = ink_inet_ip4_addr_cast(addr);
+  uint16_t port = ink_inet_port_cast(addr);
+
+  sdk_assert(ip);
+  sdk_assert(port);
 
   if (plugin_http_accept) {
     PluginVCCore *new_pvc = PluginVCCore::alloc();
 
-    new_pvc->set_active_addr(log_ip, log_port);
+    new_pvc->set_active_addr(ip, port);
     new_pvc->set_accept_cont(plugin_http_accept);
 
     PluginVC *return_vc = new_pvc->connect();
@@ -6058,13 +6107,21 @@ TSVConnActiveTimeoutCancel(TSVConn connp
   vc->cancel_active_timeout();
 }
 
+sockaddr const*
+TSNetVConnRemoteAddrGet(TSVConn connp) {
+  sdk_assert(sdk_sanity_check_iocore_structure(connp) == TS_SUCCESS);
+  NetVConnection* vc = reinterpret_cast<NetVConnection*>(connp);
+  return ink_inet_sa_cast(vc->get_remote_addr());
+}
+
+
 // TODO: IPv6 ...
 unsigned int
 TSNetVConnRemoteIPGet(TSVConn connp)
 {
   sdk_assert(sdk_sanity_check_iocore_structure(connp) == TS_SUCCESS);
 
-  NetVConnection *vc = (NetVConnection *) connp;
+  NetVConnection* vc = reinterpret_cast<NetVConnection*>(connp);
   return vc->get_remote_ip();
 }
 
@@ -6073,15 +6130,19 @@ TSNetVConnRemotePortGet(TSVConn connp)
 {
   sdk_assert(sdk_sanity_check_iocore_structure(connp) == TS_SUCCESS);
 
-  NetVConnection *vc = (NetVConnection *) connp;
+  NetVConnection* vc = reinterpret_cast<NetVConnection*>(connp);
   return vc->get_remote_port();
 }
 
 TSAction
-TSNetConnect(TSCont contp, unsigned int ip, int port)
+TSNetConnect(TSCont contp, sockaddr const* addr)
 {
   sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
-  sdk_assert(ip > 0 && port > 0);
+  sdk_assert(addr);
+  sdk_assert(ink_inet_is_ip4(addr));
+  in_addr_t ip = ink_inet_ip4_addr_cast(addr);
+  uint16_t port = ink_inet_port_cast(addr);
+  sdk_assert(ip != 0 && port != 0);
 
   FORCE_PLUGIN_MUTEX(contp);
 
@@ -6121,8 +6182,17 @@ TSHostLookup(TSCont contp, char *hostnam
   return (TSAction)hostDBProcessor.getbyname_re(i, hostname, namelen);
 }
 
-unsigned int
-TSHostLookupResultIPGet(TSHostLookupResult lookup_result)
+sockaddr const*
+TSHostLookupResultAddrGet(TSHostLookupResult lookup_result)
+{
+  sdk_assert(sdk_sanity_check_hostlookup_structure(lookup_result) == TS_SUCCESS);
+  HostDBInfo* di = reinterpret_cast<HostDBInfo*>(lookup_result);
+  ink_inet_ip4_set(ink_inet_ss_cast(&di->ip6), di->ip());
+  return ink_inet_sa_cast(&di->ip6);
+}
+
+in_addr_t
+TSHostLookupResultIpGet(TSHostLookupResult lookup_result)
 {
   sdk_assert(sdk_sanity_check_hostlookup_structure(lookup_result) == TS_SUCCESS);
   return ((HostDBInfo *)lookup_result)->ip();
@@ -7024,8 +7094,10 @@ TSFetchPages(TSFetchUrlParams_t *params)
 
   while (myparams != NULL) {
     FetchSM *fetch_sm =  FetchSMAllocator.alloc();
+    in_addr_t ip = ink_inet_ip4_addr_cast(&myparams->ip);
+    uint16_t port = ink_inet_port_cast(&myparams->ip);
 
-    fetch_sm->init((Continuation*)myparams->contp, myparams->options,myparams->events, myparams->request, myparams->request_len, myparams->ip, myparams->port);
+    fetch_sm->init((Continuation*)myparams->contp, myparams->options,myparams->events, myparams->request, myparams->request_len, ip, port);
     fetch_sm->httpConnect();
     myparams= myparams->next;
   }

Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Thu May 26 00:20:30 2011
@@ -46,7 +46,7 @@
 
 #define UTDBG_TAG "sdk_ut"
 
-#define LOCAL_IP 0x7f000001     // 127.0.0.1
+static in_addr_t const LOCAL_IP = INADDR_LOOPBACK;//  0x7f000001    // 127.0.0.1
 
 /******************************************************************************/
 
@@ -284,10 +284,11 @@ client_handler(TSCont contp, TSEvent eve
     SDK_RPRINT(SDK_NetVConn_test, "TSNetAccept", "TestCase1", TC_PASS, "ok");
     SDK_RPRINT(SDK_NetVConn_test, "TSNetConnect", "TestCase1", TC_PASS, "ok");
 
-    unsigned int input_server_ip = 0;
+    in_addr_t input_server_ip = 0;
     int input_server_port = 0;
-    input_server_ip = TSNetVConnRemoteIPGet((TSVConn)data);
-    input_server_port = TSNetVConnRemotePortGet((TSVConn) data);
+    sockaddr const* addr = TSNetVConnRemoteAddrGet(static_cast<TSVConn>(data));
+    input_server_ip = ink_inet_ip4_addr_cast(addr);
+    input_server_port = ink_inet_port_cast(addr);
 
     if (input_server_ip != htonl(LOCAL_IP)) {
       SDK_RPRINT(SDK_NetVConn_test, "TSNetVConnRemoteIPGet", "TestCase1", TC_FAIL, "server ip is incorrect");
@@ -333,8 +334,9 @@ REGRESSION_TEST(SDK_API_TSNetVConn) (Reg
 
   TSNetAccept(server_cont, server_port, -1, 0);
 
-  unsigned int server_ip = IP(127, 0, 0, 1);
-  TSNetConnect(client_cont, server_ip, server_port);
+  sockaddr_storage addr;
+  ink_inet_ip4_set(&addr, INADDR_LOOPBACK, server_port);
+  TSNetConnect(client_cont, ink_inet_sa_cast(&addr));
 }
 
 /* TSCache, TSVConn, TSVIO */
@@ -2157,18 +2159,19 @@ static int
 checkHttpTxnClientIPGet(SocketTest * test, void *data)
 {
 
-  int ip;
+  sockaddr const* ptr;
+  in_addr_t ip;
   TSHttpTxn txnp = (TSHttpTxn) data;
-  int actual_ip = LOCAL_IP;     /* 127.0.0.1 is expected because the client is on the same machine */
+  in_addr_t actual_ip = LOCAL_IP;     /* 127.0.0.1 is expected because the client is on the same machine */
 
-  ip = TSHttpTxnClientIPGet(txnp);
-  if (ip == 0) {
+  ptr = TSHttpTxnClientAddrGet(txnp);
+  if (ptr == 0 || (ip = ink_inet_ip4_addr_cast(ptr)) == 0) {
     test->test_client_ip_get = false;
-    SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_FAIL, "TSHttpTxnClientIPGet returns 0");
+    SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_FAIL, "TSHttpTxnClientIPGet returns 0 %s", ptr ? "address" : "pointer");
     return TS_EVENT_CONTINUE;
   }
 
-  if (ntohl(ip) == (uint32_t) actual_ip) {
+  if (ntohl(ip) == actual_ip) {
     test->test_client_ip_get = true;
     SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_PASS, "ok");
   } else {
@@ -2184,17 +2187,18 @@ static int
 checkHttpTxnNextHopIPGet(SocketTest * test, void *data)
 {
   TSHttpTxn txnp = (TSHttpTxn) data;
-  int actual_ip = LOCAL_IP;     /* 127.0.0.1 is expected because the client is on the same machine */
-  int nexthopip;
+  in_addr_t actual_ip = LOCAL_IP;     /* 127.0.0.1 is expected because the client is on the same machine */
+  sockaddr const* ptr;
+  in_addr_t nexthopip;
 
-  nexthopip = TSHttpTxnNextHopIPGet(txnp);
-  if (nexthopip == 0) {
+  ptr = TSHttpTxnNextHopAddrGet(txnp);
+  if (ptr == 0 || (nexthopip = ink_inet_ip4_addr_cast(ptr)) == 0) {
     test->test_next_hop_ip_get = false;
-    SDK_RPRINT(test->regtest, "TSHttpTxnNextHopIPGet", "TestCase1", TC_FAIL, "TSHttpTxnNextHopIPGet returns 0");
+    SDK_RPRINT(test->regtest, "TSHttpTxnNextHopIPGet", "TestCase1", TC_FAIL, "TSHttpTxnNextHopIPGet returns 0 %s", ptr ? "address" : "pointer" );
     return TS_EVENT_CONTINUE;
   }
 
-  if (ntohl(nexthopip) == (uint32_t) actual_ip) {
+  if (ntohl(nexthopip) == actual_ip) {
     test->test_next_hop_ip_get = true;
     SDK_RPRINT(test->regtest, "TSHttpTxnNextHopIPGet", "TestCase1", TC_PASS, "ok");
   } else {
@@ -2211,15 +2215,15 @@ checkHttpTxnNextHopIPGet(SocketTest * te
 static int
 checkHttpTxnServerIPGet(SocketTest * test, void *data)
 {
-
-  int ip;
+  sockaddr const* ptr;
+  in_addr_t ip;
   TSHttpTxn txnp = (TSHttpTxn) data;
-  int actual_ip = ntohl(LOCAL_IP);      /* 127.0.0.1 is expected because the client is on the same machine */
+  in_addr_t actual_ip = ntohl(LOCAL_IP);      /* 127.0.0.1 is expected because the client is on the same machine */
 
-  ip = TSHttpTxnServerIPGet(txnp);
-  if (ip == 0) {
+  ptr = TSHttpTxnServerAddrGet(txnp);
+  if (0 == ptr || 0 == (ip = ink_inet_ip4_addr_cast(ptr))) {
     test->test_server_ip_get = false;
-    SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_FAIL, "TSHttpTxnServerIPGet returns 0");
+    SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_FAIL, "TSHttpTxnServerIPGet returns 0 %s", ptr ? "address" : "pointer");
     return TS_EVENT_CONTINUE;
   }
 
@@ -2240,17 +2244,18 @@ checkHttpTxnServerIPGet(SocketTest * tes
 static int
 checkHttpTxnClientIncomingPortGet(SocketTest * test, void *data)
 {
-
-  int port = -1;
+  uint16_t port;
   TSMgmtInt port_from_config_file = -1;
   TSHttpTxn txnp = (TSHttpTxn) data;
+  sockaddr const* ptr = TSHttpTxnIncomingAddrGet(txnp);
 
-  if ((port = TSHttpTxnClientIncomingPortGet(txnp)) < 0) {
-    SDK_RPRINT(test->regtest, "TSHttpTxnClientIncomingPortGet", "TestCase1", TC_FAIL,
-               "TSHttpTxnClientIncomingPortGet returns TS_ERROR");
+  if (0 == ptr) {
+    SDK_RPRINT(test->regtest, "TSHttpTxnIncomingPortGet", "TestCase1", TC_FAIL,
+               "TSHttpTxnClientIncomingPortGet returns 0 pointer");
     test->test_client_incoming_port_get = false;
     return TS_EVENT_CONTINUE;
   }
+  port = ink_inet_port_cast(ptr);
 
   if (TSMgmtIntGet("proxy.config.http.server_port", &port_from_config_file) != TS_SUCCESS) {
     port_from_config_file = 8080;
@@ -2258,7 +2263,7 @@ checkHttpTxnClientIncomingPortGet(Socket
 
   TSDebug(UTDBG_TAG, "TS HTTP port = %x, Txn incoming client port %x", (int) port_from_config_file, port);
 
-  if (port == (int) port_from_config_file) {
+  if (port == static_cast<uint16_t>(port_from_config_file)) {
     SDK_RPRINT(test->regtest, "TSHttpTxnClientIncomingPortGet", "TestCase1", TC_PASS, "ok");
     test->test_client_incoming_port_get = true;
   } else {
@@ -2274,22 +2279,24 @@ static int
 checkHttpTxnClientRemotePortGet(SocketTest * test, void *data)
 {
 
-  int port = -1;
-  int browser_port = -1;
+  uint16_t port;
+  uint16_t browser_port;
   TSHttpTxn txnp = (TSHttpTxn) data;
+  sockaddr const* ptr = TSHttpTxnIncomingAddrGet(txnp);
 
   browser_port = test->browser->local_port;
 
-  if (TSHttpTxnClientRemotePortGet(txnp, &port) != TS_SUCCESS) {
-    SDK_RPRINT(test->regtest, "TSHttpTxnClientRemotePortGet", "TestCase1", TC_FAIL,
-               "TSHttpTxnClientRemotePortGet doesn't return TS_SUCCESS");
+  if (0 == ptr) {
+    SDK_RPRINT(test->regtest, "TSHttpTxnClientIncomingAddrGet", "TestCase2", TC_FAIL,
+               "TSHttpTxnIncomingAddrGet returned 0 pointer.");
     test->test_client_remote_port_get = false;
     return TS_EVENT_CONTINUE;
   }
 
+  port = ink_inet_port_cast(ptr);
   TSDebug(UTDBG_TAG, "Browser port = %x, Txn remote port = %x", browser_port, port);
 
-  if ((int)ntohs(port) == browser_port) {
+  if (ntohs(port) == browser_port) {
     SDK_RPRINT(test->regtest, "TSHttpTxnClientRemotePortGet", "TestCase1", TC_PASS, "ok");
     test->test_client_remote_port_get = true;
   } else {
@@ -7421,7 +7428,9 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_TSHttp
   /* Now send a request to the OS via TS using TSHttpConnect */
 
   /* ip and log do not matter as it is used for logging only */
-  data->vc = TSHttpConnect(1, 1);
+  sockaddr_storage addr;
+  ink_inet_ip4_set(&addr, 1, 1);
+  data->vc = TSHttpConnect(ink_inet_sa_cast(&addr));
   synclient_txn_send_request_to_vc(data->browser, data->request, data->vc);
 
   /* Wait until transaction is done */
@@ -7459,7 +7468,9 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_TSHttp
   /* Now send a request to the OS via TS using TSHttpConnect */
 
   /* ip and log do not matter as it is used for logging only */
-  data->vc = TSHttpConnect(2, 2);
+  sockaddr_storage addr;
+  ink_inet_ip4_set(&addr, 2, 2);
+  data->vc = TSHttpConnect(ink_inet_sa_cast(&addr));
 
   synclient_txn_send_request_to_vc(data->browser, data->request, data->vc);
 

Modified: trafficserver/traffic/trunk/proxy/InkAPITestTool.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITestTool.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITestTool.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITestTool.cc Thu May 26 00:20:30 2011
@@ -493,6 +493,7 @@ static int
 synclient_txn_send_request(ClientTxn * txn, char *request)
 {
   TSCont cont;
+  sockaddr_storage addr;
 
   TSAssert(txn->magic == MAGIC_ALIVE);
   txn->request = xstrdup(request);
@@ -500,7 +501,9 @@ synclient_txn_send_request(ClientTxn * t
 
   cont = TSContCreate(synclient_txn_main_handler, TSMutexCreate());
   TSContDataSet(cont, txn);
-  TSNetConnect(cont, txn->connect_ip, txn->connect_port);
+  
+  ink_inet_ip4_set(&addr, txn->connect_ip, txn->connect_port);
+  TSNetConnect(cont, ink_inet_sa_cast(&addr));
   return 1;
 }
 

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Thu May 26 00:20:30 2011
@@ -613,7 +613,7 @@ extern "C"
   {
     const char* request;
     int request_len;
-    unsigned int ip;
+    sockaddr_storage ip;
     int port;
     TSCont contp;
     TSFetchEvent events;
@@ -2085,31 +2085,82 @@ extern "C"
 
   tsapi TSReturnCode TSHttpTxnTransformRespGet(TSHttpTxn txnp, TSMBuffer* bufp, TSMLoc* offset);
 
-  /**
+  /** Get client address for transaction @a txnp.
       Retrieves the socket address of the remote client that has
-      connected to Traffic Server for the current transaction. The
+      connected to Traffic Server for transaction @a txnp. The
       return structure is the generic socket address storage in
       order to be address-family agnostic. The user of this function
       can then go on to do the approriate thing with the type
       specified in the ss_family field of the structure whether
       that be for IPv4, IPv6, or any other address family.
 
-      @sa socket.h for description of struct sockaddr_storage
-
-      @param txnp HTTP transaction of the connection.
-      @return generic socket address storage.
+      @return Client address for connection to client in transaction @a txnp.
 
    */
-  tsapi const struct sockaddr_storage* INKHttpTxnClientSockAddrGet(TSHttpTxn txnp);
+  tsapi struct sockaddr const* TSHttpTxnClientAddrGet(
+    TSHttpTxn txnp ///< Transaction.
+  );
+  /** Get the incoming address.
+   
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+      
+      @return Local address of the client connection for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnIncomingAddrGet(
+    TSHttpTxn txnp ///< Transaction.
+  );
+  /** Get the origin server address.
+   * 
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+      
+      @return The address of the origin server for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnServerAddrGet(
+    TSHttpTxn txnp ///< Transaction.
+  );
+  /** Set the origin server address.
+
+      This must be invoked before the origin server address is looked up.
+      If called no lookup is done, the address @a addr is used instead.
+      
+      @return @c TS_SUCCESS if the origin server address is set, @c TS_ERROR otherwise.
+  */
+  tsapi TSReturnCode TSHttpTxnServerAddrSet(
+    TSHttpTxn txnp, ///< Transaction
+    struct sockaddr const* addr ///< Address for origin server.
+  );
+
+  /** Get the next hop address.
+   * 
+      @note The pointer is valid only for the current callback. Clients
+      that need to keep the value across callbacks must maintain their
+      own storage.
+      
+      @return The address of the next hop for transaction @a txnp.
+  */
+  tsapi struct sockaddr const* TSHttpTxnNextHopAddrGet(
+    TSHttpTxn txnp ///< Transaction.
+  );
 
-  tsapi unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp);
   tsapi TSReturnCode TSHttpTxnClientFdGet(TSHttpTxn txnp, int* fdp);
-  tsapi TSReturnCode TSHttpTxnClientRemotePortGet(TSHttpTxn txnp, int* portp);
-  tsapi int TSHttpTxnClientIncomingPortGet(TSHttpTxn txnp);
-  tsapi unsigned int TSHttpTxnServerIPGet(TSHttpTxn txnp);
-  tsapi unsigned int TSHttpTxnNextHopIPGet(TSHttpTxn txnp);
-  tsapi int TSHttpTxnNextHopPortGet(TSHttpTxn txnp);
-  tsapi TSReturnCode TSHttpTxnOutgoingAttrSet(TSHttpTxn txnp, const struct sockaddr *addr, socklen_t addrlen);
+  tsapi TSReturnCode TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, struct sockaddr const* addr);
+  
+  /// @deprecated Use TSHttpTxnClientAddrGet
+  tsapi TS_DEPRECATED unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp);
+  /// @deprecated Use TSHttpTxnClientAddrGet
+  tsapi TS_DEPRECATED TSReturnCode TSHttpTxnClientRemotePortGet(TSHttpTxn txnp, int* portp);
+  /// @deprecated Use TSHttpTxnIncomingAddrGet
+  tsapi TS_DEPRECATED int TSHttpTxnClientIncomingPortGet(TSHttpTxn txnp);
+  /// @deprecated Use TSHttpTxnServerAddrGet
+  tsapi TS_DEPRECATED unsigned int TSHttpTxnServerIPGet(TSHttpTxn txnp);
+  /// @deprecated Use TSHttpTxnNextHopAddrGet
+  tsapi TS_DEPRECATED unsigned int TSHttpTxnNextHopIPGet(TSHttpTxn txnp);
+  /// @deprecated Use TSHttpTxnNextHopAddrGet
+  tsapi TS_DEPRECATED int TSHttpTxnNextHopPortGet(TSHttpTxn txnp);
 
   tsapi void TSHttpTxnErrorBodySet(TSHttpTxn txnp, char* buf, int buflength, char* mimetype);
 
@@ -2265,10 +2316,10 @@ extern "C"
       @param log_port port (in network byte order) that connection will
         be logged as coming from.
       @param vc will be set to point to the new TSVConn on success.
-
+      
    */
-  tsapi TSVConn TSHttpConnect(unsigned int log_ip, int log_port);
-  tsapi void TSFetchUrl(const char* request,int request_len, unsigned int ip, int port , TSCont contp, TSFetchWakeUpOptions callback_options,TSFetchEvent event);
+  tsapi TSVConn TSHttpConnect(struct sockaddr const* addr);
+  tsapi void TSFetchUrl(const char* request,int request_len, struct sockaddr const* addr, TSCont contp, TSFetchWakeUpOptions callback_options,TSFetchEvent event);
   tsapi void TSFetchPages(TSFetchUrlParams_t* params);
 
   /* Check if HTTP State machine is internal or not */
@@ -2312,6 +2363,8 @@ extern "C"
   /**
       Returns the IP address of the remote host with which Traffic Server
       is connected through the vconnection vc.
+      
+      @deprecated Use TSNetVConnRemoteAddrGet
 
       @param vc representing a connection that your plugin has opened
         between Traffic Server and a (remote) host.
@@ -2319,9 +2372,12 @@ extern "C"
         network byte order. Note: this value is 32-bit, for IPv4.
 
    */
-  tsapi unsigned int TSNetVConnRemoteIPGet(TSVConn vc);
+  tsapi TS_DEPRECATED unsigned int TSNetVConnRemoteIPGet(TSVConn vc);
+  
+  tsapi struct sockaddr const* TSNetVConnRemoteAddrGet(TSVConn vc);
 
-  tsapi int TSNetVConnRemotePortGet(TSVConn vc);
+  /// @deprecated Use TSNetVConnRemoteAddrGet
+  tsapi TS_DEPRECATED int TSNetVConnRemotePortGet(TSVConn vc);
 
   /**
       Opens a network connection to the host specified by ip on the port
@@ -2340,23 +2396,25 @@ extern "C"
       your plugin needs to look for an TS_EVENT_VCONN_WRITE_READY to
       be sure that the connection is successfully opened.
 
-      @param contp continuation that is called back when the attempted
-        net connection either succeeds or fails.
-      @param ip of the host to connect to, in network byte order.
-      @param port of the host to connect to, in host byte order.
       @return something allows you to check if the connection is complete,
         or cancel the attempt to connect.
 
    */
-  tsapi TSAction TSNetConnect(TSCont contp, unsigned int ip, int port);
+  tsapi TSAction TSNetConnect(
+    TSCont contp, ///< continuation that is called back when the attempted net connection either succeeds or fails.
+    struct sockaddr const* to ///< Address to which to connect.
+  );
 
   tsapi TSAction TSNetAccept(TSCont contp, int port, int domain, int accept_threads);
 
   /* --------------------------------------------------------------------------
      DNS Lookups */
   tsapi TSAction TSHostLookup(TSCont contp, char* hostname, int namelen);
-  tsapi unsigned int TSHostLookupResultIPGet(TSHostLookupResult lookup_result);
-  tsapi void TSOSIpSet(TSHttpTxn txnp, unsigned int ip);
+  /// @deprecated Use TSHostLookupResultAddrGet
+  tsapi TS_DEPRECATED unsigned int TSHostLookupResultIPGet(TSHostLookupResult lookup_result);
+  tsapi struct sockaddr const* TSHostLookupResultAddrGet(TSHostLookupResult lookup_result);
+  /// @deprecated Use TSHttpTxnServerAddrSet
+  tsapi TS_DEPRECATED void TSOSIpSet(TSHttpTxn txnp, unsigned int ip);
   // TODO: Eventually, we might want something like this as well, but it requires
   // support for building the HostDBInfo struct:
   // tsapi void TSHostLookupResultSet(TSHttpTxn txnp, TSHostLookupResult result);

Modified: trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpClientSession.cc Thu May 26 00:20:30 2011
@@ -201,7 +201,7 @@ HttpClientSession::new_connection(NetVCo
   // check what type of socket address we just accepted
   // by looking at the address family value of sockaddr_storage
   // and logging to stat system
-  switch(new_vc->get_remote_addr().ss_family) {
+  switch(new_vc->get_remote_addr()->ss_family) {
     case AF_INET:
       HTTP_INCREMENT_DYN_STAT(http_total_client_connections_ipv4_stat);
     break;

Modified: trafficserver/traffic/trunk/proxy/http/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSM.cc?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSM.cc Thu May 26 00:20:30 2011
@@ -604,7 +604,7 @@ HttpSM::attach_client_session(HttpClient
   t_state.client_info.is_transparent = netvc->get_is_transparent();
   t_state.backdoor_request = client_vc->backdoor_connect;
   memset(&(t_state.client_info.addr), 0, sizeof(t_state.client_info.addr));
-  t_state.client_info.addr = client_vc->get_netvc()->get_remote_addr();
+  t_state.client_info.addr = *client_vc->get_netvc()->get_remote_addr();
   t_state.client_info.port_attribute = (HttpPortTypes) netvc->attributes;
 
   HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat);

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.h?rev=1127742&r1=1127741&r2=1127742&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.h Thu May 26 00:20:30 2011
@@ -783,8 +783,8 @@ public:
     // (big-endian) 32-bit number.  Each of the dotted
     // components is a byte, so:
     // 0x25364758 = 0x25.0x36.0x47.0x58 = 37.54.71.88 in decimal.
-    unsigned int ip;
-    struct sockaddr_storage addr;
+    in_addr_t ip;
+    sockaddr_storage addr;
 
     // port to connect to, except for client
     // connection where it is port on proxy
@@ -813,7 +813,8 @@ public:
         port_attribute(SERVER_PORT_DEFAULT),
         is_transparent(false)
     {
-      memset(&addr, 0, sizeof(addr));
+      ink_inet_init(&addr);
+//      memset(&addr, 0, sizeof(addr));
     }
   } ConnectionAttributes;