inbandbytestreammanager.h
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 "jid.h"
00019
00020 namespace gloox
00021 {
00022
00023 class InBandBytestreamHandler;
00024 class InBandBytestream;
00025 class ClientBase;
00026
00179 class GLOOX_API InBandBytestreamManager : public IqHandler
00180 {
00181 public:
00188 GLOOX_DEPRECATED_CTOR InBandBytestreamManager( ClientBase *parent );
00189
00193 virtual ~InBandBytestreamManager();
00194
00208 bool requestInBandBytestream( const JID& to, InBandBytestreamHandler *ibbh,
00209 const std::string& sid = "" );
00210
00215 void setBlockSize( int blockSize ) { m_blockSize = blockSize; }
00216
00221 int blockSize() const { return m_blockSize; }
00222
00229 bool dispose( InBandBytestream *ibb );
00230
00240 void acceptInBandBytestream( InBandBytestream *ibb );
00241
00251 void rejectInBandBytestream( InBandBytestream *ibb );
00252
00261 void registerInBandBytestreamHandler( InBandBytestreamHandler *ibbh, bool sync = true );
00262
00266 void removeInBandBytestreamHandler();
00267
00268
00269 virtual bool handleIq( Stanza *stanza );
00270
00271
00272 virtual bool handleIqID( Stanza *stanza, int context );
00273
00274 private:
00275 void acceptInBandBytestream( InBandBytestream *ibb, const JID& from, const std::string& id );
00276 void rejectInBandBytestream( InBandBytestream *ibb, const JID& from, const std::string& id );
00277
00278 enum IBBActionType
00279 {
00280 IBBOpenStream,
00281 IBBCloseStream
00282 };
00283
00284 typedef std::map<std::string, InBandBytestream*> IBBMap;
00285 IBBMap m_ibbMap;
00286
00287 struct TrackItem
00288 {
00289 std::string sid;
00290 InBandBytestreamHandler *ibbh;
00291 };
00292 typedef std::map<std::string, TrackItem> TrackMap;
00293 TrackMap m_trackMap;
00294
00295 struct AsyncIBBItem
00296 {
00297 InBandBytestream *ibb;
00298 JID from;
00299 std::string id;
00300 };
00301 typedef std::map<std::string, AsyncIBBItem> AsyncTrackMap;
00302 AsyncTrackMap m_asyncTrackMap;
00303
00304 ClientBase *m_parent;
00305 InBandBytestreamHandler *m_inbandBytestreamHandler;
00306 bool m_syncInbandBytestreams;
00307 int m_blockSize;
00308
00309 };
00310
00311 }
00312
00313 #endif // INBANDBYTESTREAMMANAGER_H__