00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef INBANDBYTESTREAMMANAGER_H__
00015 #define INBANDBYTESTREAMMANAGER_H__
00016
00017 #include "iqhandler.h"
00018 #include "disco.h"
00019 #include "jid.h"
00020
00021 namespace gloox
00022 {
00023
00024 class InBandBytestreamHandler;
00025 class InBandBytestream;
00026
00177 class GLOOX_API InBandBytestreamManager : public IqHandler
00178 {
00179 public:
00185 InBandBytestreamManager( ClientBase *parent, Disco *disco );
00186
00190 virtual ~InBandBytestreamManager();
00191
00204 bool requestInBandBytestream( const JID& to, InBandBytestreamHandler *ibbh );
00205
00210 void setBlockSize( int blockSize ) { m_blockSize = blockSize; };
00211
00216 int blockSize() const { return m_blockSize; };
00217
00224 bool dispose( InBandBytestream *ibb );
00225
00235 void acceptInBandBytestream( InBandBytestream *ibb );
00236
00246 void rejectInBandBytestream( InBandBytestream *ibb );
00247
00256 void registerInBandBytestreamHandler( InBandBytestreamHandler *ibbh, bool sync = true );
00257
00261 void removeInBandBytestreamHandler();
00262
00263
00264 virtual bool handleIq( Stanza *stanza );
00265
00266
00267 virtual bool handleIqID( Stanza *stanza, int context );
00268
00269 private:
00270 void acceptInBandBytestream( InBandBytestream *ibb, const JID& from, const std::string& id );
00271 void rejectInBandBytestream( InBandBytestream *ibb, const JID& from, const std::string& id );
00272
00273 enum IBBActionType
00274 {
00275 IBBOpenStream,
00276 IBBCloseStream
00277 };
00278
00279 typedef std::map<std::string, InBandBytestream*> IBBMap;
00280 IBBMap m_ibbMap;
00281
00282 struct TrackItem
00283 {
00284 std::string sid;
00285 InBandBytestreamHandler *ibbh;
00286 };
00287 typedef std::map<std::string, TrackItem> TrackMap;
00288 TrackMap m_trackMap;
00289
00290 struct AsyncIBBItem
00291 {
00292 InBandBytestream *ibb;
00293 JID from;
00294 std::string id;
00295 };
00296 typedef std::map<std::string, AsyncIBBItem> AsyncTrackMap;
00297 AsyncTrackMap m_asyncTrackMap;
00298
00299 ClientBase *m_parent;
00300 InBandBytestreamHandler *m_inbandBytestreamHandler;
00301 bool m_syncInbandBytestreams;
00302 int m_blockSize;
00303
00304 };
00305
00306 }
00307
00308 #endif // INBANDBYTESTREAMMANAGER_H__