/* * The Unix Channel * * by Michel Beaudouin-Lafon * * Copyright 1990-1997 * Laboratoire de Recherche en Informatique (LRI) * * Addresses * * $Id$ * $CurLog$ * Removed smart pointers (S.Sire) * Changed IvlInetAddress::StrRepr and added GetHostname and GetNoHostname */ #ifndef Address_H_ #define Address_H_ #include "cplus_bugs.h" #include "ivl/bool.h" #include "ivl/word.h" #include "ivl/String.h" #include #include typedef struct sockaddr SockAddr; /***** all this is necessary for function Decode only. This should be investigated */ #include #ifdef UNIX_SOCK #include #ifndef AF_UNIX #define AF_UNIX AF_UNSPEC #endif #endif #ifdef IRDA_SOCK #include #endif union gen_addr { struct sockaddr sa; // default #ifdef UNIX_SOCK struct sockaddr_un su; // unix #endif #ifdef IRDA_SOCK struct sockaddr_irda sir; // irda #endif struct sockaddr_in si; // inet }; /***** end of part that is necessary for Decode only */ typedef union gen_addr GEN_ADDR; /* useful for adresses returned by system calls */ class IvlAddress { protected: bool Valid; public: IvlAddress (); virtual ~IvlAddress (); bool IsValid () const { return Valid; } virtual int Family () = 0; // AF_UNSPEC, AF_UNIX, AF_INET virtual int Length () = 0; virtual SockAddr* GetSockAddr () = 0; virtual char* StrRepr (char* buf) = 0; static IvlAddress* Decode (GEN_ADDR*, int); }; #endif /* Address_H_ */