From e0b1bf56fae7f31706067564527156644a7a5fc2 Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 27 Jul 1993 13:54:59 +0000 Subject: Initial revision --- comm/OLD/TextServer.h | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 comm/OLD/TextServer.h (limited to 'comm/OLD/TextServer.h') diff --git a/comm/OLD/TextServer.h b/comm/OLD/TextServer.h new file mode 100644 index 0000000..ad64b2a --- /dev/null +++ b/comm/OLD/TextServer.h @@ -0,0 +1,93 @@ +/* + * The Unix Channel + * + * by Michel Beaudouin-Lafon + * + * Copyright 1990-1993 + * Laboratoire de Recherche en Informatique (LRI) + * + * Text-oriented servers + * + * $Id$ + * $CurLog$ + */ + +#ifndef TextServer_H_ +#define TextServer_H_ + +#include "TextStream.h" +#include "ccu/List.h" + +class UchTextClient; +class UchTextServer; +class UchBaseMultiplexer; + +/* a function that instantiates clients */ +typedef UchTextClient* (*fNEW_CLIENT) (UchTextServer*); + + +class UchTextServer : public UchStream { +friend class UchTextClient; +friend class UchTextServerTimer; + +protected: + UchTextServerTimer* Timer; // periodic registration with port server + bool ok; // true if initialized +#ifndef CPLUS_BUG19 + CcuListOf Clients; // Clients created by this server +#else + CcuList Clients; // Clients created by this server +#endif + const char* service; // name of service in portserv + fNEW_CLIENT newClient; // function that creates the client + + void Remove (UchTextClient*); // called from UchTextClient + void HandleRead (); + +public: + UchTextServer (const char*, fNEW_CLIENT); + ~UchTextServer (); + bool Ok () const { return ok; } + bool Init (UchBaseMultiplexer&); // initialize the communication stuff + void Quit (); // close the server and its connections + UchTextClient* CreateClient (int); +}; + +PointerClass (pUchTextServer, UchTextServer) + +class UchTextClient : public UchTextStream { +friend class UchTextServer; + +protected: + pUchTextServer MyServer; // who created me + bool sendToOut; // whether to use alternate output + pUchChannel out; // alternate output + + UchTextClient (UchTextServer*); // called by UchTextServer::HandleRead + ~UchTextClient (); // called by UchMultiplexer::Remove +virtual void Starting (); // called by UchTextServer +virtual void Closing (bool); // called by UchTextServer +virtual void Quitting (); // called by UchTextServer + void DoSend (); + + cmd_res Execute (const UchTextLine&) = 0; + +public: + void Close (); // 'close' request + void Quit (); // 'quit' request + + void SetOutput (UchChannel*); + void ResetOutput (); + UchChannel* GetOutput () { if (sendToOut) return out; else return this; } +}; + + + +#endif /*TextServer_H_*/ + + + + + + + -- cgit v1.1