Example #1
0
   void getIPAddress(UIPAddress& cAddr)
      {
#  ifdef ENABLE_IPV6
      if (addr.psaGeneric.sa_family == AF_INET6) cAddr.setAddress(&(addr.psaIP6Addr.sin6_addr), true);
      else
#  endif
                                                 cAddr.setAddress(&(addr.psaIP4Addr.sin_addr), false);
      }
Example #2
0
static void PrintIPAddress(const char* pcInformationString, UIPAddress& cAddr)
{
   U_TRACE(5, "::PrintIPAddress(%S,%p)", pcInformationString, &cAddr)

   printf("%s\n", pcInformationString);
   printf(" - Name    : %s\n", (const char*) cAddr.getAddressString());
   printf(" - Family  : %s\n", (cAddr.getAddressFamily() == AF_INET6)?"IPv6":
                 ((cAddr.getAddressFamily() == AF_INET)?"IPv4":"Unknown"));
   printf(" - Address : %s\n", cAddr.getAddressString());
}
Example #3
0
   void setIPAddress(UIPAddress& cAddr)
      {
      U_TRACE(0, "SocketAddress::setIPAddress(%p)", &cAddr)

      addr.psaGeneric.sa_family = cAddr.getAddressFamily();

#  ifdef ENABLE_IPV6
      if (addr.psaGeneric.sa_family == AF_INET6)
         U_MEMCPY(&(addr.psaIP6Addr.sin6_addr), cAddr.get_in_addr(), cAddr.getInAddrLength());
      else
#  endif
         U_MEMCPY(&(addr.psaIP4Addr.sin_addr),  cAddr.get_in_addr(), cAddr.getInAddrLength());
      }