diff options
-rw-r--r-- | comm/Address.cc | 3 | ||||
-rw-r--r-- | comm/InetAddress.cc | 17 | ||||
-rw-r--r-- | comm/InetAddress.h | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/comm/Address.cc b/comm/Address.cc index 01bc037..e0e4f4b 100644 --- a/comm/Address.cc +++ b/comm/Address.cc @@ -132,7 +132,8 @@ IvlAddress :: Decode (GEN_ADDR* addr, int alen) return new IvlIrdaAddress (addr->sir.sir_name); #endif case AF_INET : - return new IvlInetAddress (addr->si.sin_addr.s_addr, addr->si.sin_port); + return new IvlInetAddress (ntohl (addr->si.sin_addr.s_addr), + ntohs (addr->si.sin_port)); default : return 0; diff --git a/comm/InetAddress.cc b/comm/InetAddress.cc index ffb374e..7b3e5aa 100644 --- a/comm/InetAddress.cc +++ b/comm/InetAddress.cc @@ -9,7 +9,7 @@ * INET Addresses * * $Id$ - * $CurLog$ + * $CurLog$< * Created from Address.cc */ @@ -87,7 +87,7 @@ IvlInetAddress :: IvlInetAddress (lword host, sword port) { Addr.sin_family = AF_INET; Addr.sin_port = htons (port); - Addr.sin_addr.s_addr = host; + Addr.sin_addr.s_addr = htonl (host); Valid = true; } @@ -157,23 +157,24 @@ IvlInetAddress :: LoopBack () return loopback = * ((lword *) host->h_addr); } -#ifdef DOC -// Ca c'est les super fake declarations pour avoir la DOC -// merci au LRI... /*? Return the host number of the address. ?*/ lword IvlInetAddress :: Host () -{} +{ + return ntohl (Addr.sin_addr.s_addr); +} /*? Return the port number of the address. ?*/ sword IvlInetAddress :: Port () -{} -#endif /* DOC */ +{ + return ntohs (Addr.sin_port); +} + /*? Return a const string representing the hostname part of the address if any diff --git a/comm/InetAddress.h b/comm/InetAddress.h index eec1490..9a9f842 100644 --- a/comm/InetAddress.h +++ b/comm/InetAddress.h @@ -37,8 +37,8 @@ public: int Family (); int Length (); SockAddr* GetSockAddr (); -inline sword Port () { return Addr.sin_port; } -inline lword Host () { return Addr.sin_addr.s_addr; } + sword Port (); + lword Host (); char* StrRepr (char* buf = 0); const char* GetHostName (); |