summaryrefslogtreecommitdiff
path: root/comm/MsgStream.h
diff options
context:
space:
mode:
authorchatty1993-04-07 11:50:31 +0000
committerchatty1993-04-07 11:50:31 +0000
commitba066c34dde204aa192d03a23a81356374d93731 (patch)
tree39391f6235d2cf8a59a0634ac5ea430cdd21f5d4 /comm/MsgStream.h
parent05ab076e1c2a9ca16472f9a6b47b8d22914b3783 (diff)
downloadivy-league-ba066c34dde204aa192d03a23a81356374d93731.zip
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.gz
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.bz2
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.xz
Initial revision
Diffstat (limited to 'comm/MsgStream.h')
-rw-r--r--comm/MsgStream.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/comm/MsgStream.h b/comm/MsgStream.h
new file mode 100644
index 0000000..c2b8e1f
--- /dev/null
+++ b/comm/MsgStream.h
@@ -0,0 +1,70 @@
+/*
+ * The Unix Channel
+ *
+ * by Michel Beaudouin-Lafon
+ *
+ * Copyright 1990-1993
+ * Laboratoire de Recherche en Informatique (LRI)
+ *
+ * UchMessage streams
+ *
+ * $Id$
+ * $CurLog$
+ */
+
+#ifndef MsgStream_H_
+#define MsgStream_H_
+
+#include "Stream.h"
+#include "ccu/SmartPointer.h"
+#include "MsgBuffer.h"
+class UchMessage;
+
+class UchMsgStream : public UchStream {
+private:
+
+protected:
+ UchMsgBuffer InBuffer;
+ int InSize;
+ UchMsgBuffer OutBuffer;
+ int OutSize;
+enum STATE { WAITING, GOT_TYPE, GOT_LENGTH, DONE};
+enum TYPE { MSG = 1, ASK, ANS, SYNC, ASYNC, OK };
+ STATE State;
+ bool BufferedMessages;
+ UchMsgBuffer Buffered;
+ bool WaitingForAnswer;
+ bool WaitingReply;
+ int InLength;
+ byte InType;
+ bool Sync;
+
+ void ProcessInput (UchMsgBuffer&, bool);
+ int ReadInput ();
+public:
+ UchMsgStream ();
+ UchMsgStream (const UchMsgStream&);
+ UchMsgStream (UchAddress*, UchAddress*);
+ ~UchMsgStream ();
+
+ void InputBuffer (int min, int grow, int max);
+ void OutputBuffer (int min, int grow, int max);
+inline void FlushSize (int n) { OutSize = n; }
+ UchChannel* Copy () const;
+ void HandleRead ();
+ void HandleWrite ();
+ bool HandleSelect ();
+inline bool GetSyncMode () { return Sync; }
+inline void SetSyncMode (bool s) { Sync = s; Flush (); }
+virtual bool NewMessage (UchMsgBuffer&, bool);
+virtual void* ConvertAnswer (UchMsgBuffer&);
+virtual void Delete ();
+ void Send (UchMessage&, bool = FALSE);
+ void* Ask (UchMessage&);
+ void Reply (UchMessage&);
+ void Flush ();
+ void Send (UchMsgBuffer&, bool = FALSE);
+};
+
+#endif /* MsgStream_H_ */
+