inbandbytestream.h

00001 /*
00002   Copyright (c) 2006 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef INBANDBYTESTREAM_H__
00015 #define INBANDBYTESTREAM_H__
00016 
00017 #include "messagefilter.h"
00018 #include "iqhandler.h"
00019 #include "gloox.h"
00020 #include "inbandbytestreammanager.h"
00021 
00022 namespace gloox
00023 {
00024 
00025   class ClientBase;
00026   class InBandBytestreamDataHandler;
00027 
00039   class GLOOX_API InBandBytestream : public MessageFilter
00040   {
00041     friend class InBandBytestreamManager;
00042 
00043     public:
00047       virtual ~InBandBytestream();
00048 
00053       bool isOpen() const { return m_open; };
00054 
00065       bool sendBlock( const std::string& data );
00066 
00071       const std::string& sid() const { return m_sid; };
00072 
00077       int blockSize() const { return (int)m_blockSize; };
00078 
00085       void registerInBandBytestreamDataHandler( InBandBytestreamDataHandler *ibbdh );
00086 
00090       void removeInBandBytestreamDataHandler();
00091 
00092       // reimplemented from MessageFilter
00093       virtual void decorate( Tag *tag );
00094 
00095       // reimplemented from MessageFilter
00096       virtual void filter( Stanza *stanza );
00097 
00098     private:
00099       InBandBytestream( MessageSession *session, ClientBase *clientbase );
00100       void setBlockSize( int blockSize ) { m_blockSize = blockSize; };
00101       void close();  // locally
00102       void closed(); // by remote entity
00103       void setSid( const std::string& sid ) { m_sid = sid; };
00104 
00105       ClientBase *m_clientbase;
00106       InBandBytestreamManager *m_manager;
00107       InBandBytestreamDataHandler *m_inbandBytestreamDataHandler;
00108       std::string m_sid;
00109       std::string::size_type m_blockSize;
00110       int m_sequence;
00111       int m_lastChunkReceived;
00112       bool m_open;
00113 
00114   };
00115 
00116 }
00117 
00118 #endif // INBANDBYTESTREAM_H__

Generated on Tue May 1 14:20:20 2007 for gloox by  doxygen 1.5.1