From c34b4aa9b8af7b4a0c98e7a6760fdb5f7370074a Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 28 Nov 2000 17:07:44 +0000 Subject: * Removed smart pointers (S.Sire) * Changed UchInetAddress::StrRepr and added GetHostname and GetNoHostname --- comm/Address.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'comm/Address.h') diff --git a/comm/Address.h b/comm/Address.h index 70df60b..d0e083d 100644 --- a/comm/Address.h +++ b/comm/Address.h @@ -3,7 +3,7 @@ * * by Michel Beaudouin-Lafon * - * Copyright 1990-1993 + * Copyright 1990-1997 * Laboratoire de Recherche en Informatique (LRI) * * Addresses @@ -16,8 +16,9 @@ #define Address_H_ #include "cplus_bugs.h" -#include "global.h" -#include "ccu/SmartPointer.h" +#include "ccu/bool.h" +#include "ccu/word.h" +#include "ccu/String.h" #include #include @@ -43,14 +44,13 @@ typedef struct sockaddr SockAddr; /* this union is useful for adresses returned by system calls */ typedef union gen_addr GEN_ADDR; - -class UchAddress : public CcuSmartData { +class UchAddress { protected: bool Valid; public: UchAddress (); - ~UchAddress (); +virtual ~UchAddress (); bool IsValid () const { return Valid; } virtual int Family () = 0; // AF_UNSPEC, AF_UNIX, AF_INET @@ -61,12 +61,14 @@ virtual char* StrRepr (char* buf) = 0; static UchAddress* Decode (GEN_ADDR*, int); }; -PointerClass (pUchAddress, UchAddress) - class UchInetAddress : public UchAddress { protected: + CcuString HostName; + bool HasHostName; struct sockaddr_in Addr; + const char* GetNoHostName (); + public: UchInetAddress (); UchInetAddress (lword, sword); // hostid, port# @@ -78,7 +80,8 @@ public: SockAddr* GetSockAddr (); inline sword Port () { return Addr.sin_port; } inline lword Host () { return Addr.sin_addr.s_addr; } - char* StrRepr (char* buf); + char* StrRepr (char* buf = 0); + const char* GetHostName (); static lword LoopBack (); }; @@ -92,7 +95,6 @@ static lword LoopBack (); #define BROADCAST ((lword) INADDR_BROADCAST) - #ifdef UNIX_SOCK class UchUnixAddress : public UchAddress { @@ -114,4 +116,3 @@ public: #endif /* Address_H_ */ - -- cgit v1.1