From 7caee026d7e303d18afb3a23bd05f44d83f176ab Mon Sep 17 00:00:00 2001 From: sc Date: Mon, 4 Dec 2000 13:20:06 +0000 Subject: First implementation of the OBEX protocol (mainly for IrDA) --- comm/ObexStream.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 comm/ObexStream.h (limited to 'comm/ObexStream.h') 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 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_ */ -- cgit v1.1