summaryrefslogtreecommitdiff
path: root/comm/ObexStream.h
diff options
context:
space:
mode:
authorsc2000-12-04 13:20:06 +0000
committersc2000-12-04 13:20:06 +0000
commit7caee026d7e303d18afb3a23bd05f44d83f176ab (patch)
tree8a3987cef018b130121831835375d751fd9c5939 /comm/ObexStream.h
parent3ce8eb18e2859e9e1531f20bc477abe7151b11f4 (diff)
downloadivy-league-7caee026d7e303d18afb3a23bd05f44d83f176ab.zip
ivy-league-7caee026d7e303d18afb3a23bd05f44d83f176ab.tar.gz
ivy-league-7caee026d7e303d18afb3a23bd05f44d83f176ab.tar.bz2
ivy-league-7caee026d7e303d18afb3a23bd05f44d83f176ab.tar.xz
First implementation of the OBEX protocol (mainly for IrDA)
Diffstat (limited to 'comm/ObexStream.h')
-rw-r--r--comm/ObexStream.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/comm/ObexStream.h b/comm/ObexStream.h
new file mode 100644
index 0000000..6e83013
--- /dev/null
+++ b/comm/ObexStream.h
@@ -0,0 +1,97 @@
+/*
+ * Ivy League
+ *
+ * OBEX protocol
+ *
+ * Copyright 2000
+ * Centre d'Etudes de la Navigation Aerienne (CENA)
+ *
+ * by Stephane Chatty
+ *
+ * $Id$
+ *
+ */
+
+#ifndef ObexStream_H_
+#define ObexStream_H_
+
+#include "ivl/cplus_bugs.h"
+#include "Stream.h"
+class IvlAddress;
+#include "ivl/List.h"
+#include "Trigger.h"
+#include "Scheduler.h"
+#include "BufStream.h"
+#include "Event.h"
+
+
+class IvlObexStream : public IvlStream {
+public:
+ IvlTrigger NewAgents;
+
+ IvlObexStream (IvlAddress*, IvlBaseScheduler* = IvlScd);
+ ~IvlObexStream ();
+
+ IvlChannel* Copy () const;
+ void HandleRead ();
+};
+
+class IvlObexHeader;
+class IvlObexObject;
+
+class IvlObexAgent : public IvlBufStream {
+private:
+ IvlObexStream* MyLink;
+ void* CurObj;
+ IvlListOf<IvlObexHeader*> OutHeaders;
+
+ void HandleRead ();
+ void ParseConnect (sword, bool);
+ void ParseDisconnect (sword, bool);
+ void ParseAbort (sword, bool);
+ void ParsePut (sword, bool);
+ void ParseGet (sword, bool);
+ void ParseSetPath (sword, bool);
+ void ParseHeaders (sword, bool);
+ void SendResponse ();
+ void SendHeader (byte, byte, const char*);
+
+public:
+ IvlObexAgent (int, IvlObexStream*);
+ IvlObexAgent (IvlAddress*, IvlObexStream*);
+ ~IvlObexAgent ();
+ void SendObject (IvlObexObject&);
+};
+
+class IvlObexAgentEvent : public IvlEvent {
+public:
+static IvlEventType* ObexNewAgent, *ObexAgentBye;
+
+protected:
+ IvlObexAgent* Agent;
+
+public:
+ IvlObexAgentEvent (IvlObexAgent*, IvlEventType*);
+ ~IvlObexAgentEvent ();
+
+inline IvlObexAgent* GetAgent () const { return Agent;}
+};
+
+class IvlObexObject {
+friend class IvlObexAgent;
+protected:
+ IvlString Name;
+ IvlString Description;
+ IvlString Body; // should not be a text string, actually
+ lword Class;
+
+public:
+ IvlObexObject ();
+ ~IvlObexObject ();
+ void SetName (const char*);
+ void SetDescription (const char*);
+ void SetBody (const char*);
+ void SetClass (lword);
+};
+
+#endif /* ObexStream_H_ */