summaryrefslogtreecommitdiff
path: root/comm/OLD/TextServer.h
diff options
context:
space:
mode:
Diffstat (limited to 'comm/OLD/TextServer.h')
-rw-r--r--comm/OLD/TextServer.h93
1 files changed, 93 insertions, 0 deletions
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 <UchTextClient> 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_*/
+
+
+
+
+
+
+