/* * The Unix Channel * * by Michel Beaudouin-Lafon * * Copyright 1990-1993 * Laboratoire de Recherche en Informatique (LRI) * * Sockets * * $Id$ * $CurLog$ */ #ifndef Socket_H_ #define Socket_H_ #include "cplus_bugs.h" #include "Channel.h" #include "Address.h" extern char* StrReprBuf; #define SOCK_UNSPEC 0 // Virtual base class for sockets. // A socket is a channel and an address. // As a channel, it is immutable, and must be initialized once and for all at creation. // class UchSocket : public UchChannel { protected: pUchAddress BAddr; pUchAddress CAddr; int AddrFamily; bool Ready; /*?public?*/ UchSocket (UchAddress*, UchAddress*); ~UchSocket (); UchSocket (const UchSocket& s); public: virtual int SockType () = 0; inline int Family () { return AddrFamily; } inline void SetFamily (int f) { AddrFamily = f; } inline bool IsReady () const { return Ready; } void BindTo (UchAddress*); void ConnectTo (UchAddress*); inline UchAddress* BoundTo () { return BAddr; } inline UchAddress* ConnectedTo () { return CAddr; } bool Open (); int Bind (UchAddress* = 0); int Connect (UchAddress* = 0); int Accept (); bool Setup (); char* StrRepr (char* = StrReprBuf); }; #endif /* Socket_H_ */