From 4a8e1c0e43f7c70d84d1f0b850e66a32c00a47b8 Mon Sep 17 00:00:00 2001 From: sc Date: Wed, 29 Nov 2000 12:46:27 +0000 Subject: Chose a consistent convention for INET addresses: they are stored in objects in 'network' representation, and manipulated outside object in 'host' representation. The corresponding calls to hton{sl} and ntoh{sl} have been added --- comm/InetAddress.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'comm/InetAddress.cc') 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 -- cgit v1.1