14 #ifndef STREAMBASE_H__
15 #define STREAMBASE_H__
20 #include <gloox/connectiondatahandler.h>
21 #include <gloox/jid.h>
22 #include <gloox/gloox.h>
23 #include <gloox/mutex.h>
24 #include <gloox/parser.h>
25 #include <gloox/taghandler.h>
38 class AuthenticationHandler;
47 class GLOOXD_API
StreamBase :
public gloox::ConnectionDataHandler, gloox::TagHandler
60 const gloox::LogSink& logInstance );
85 gloox::ConnectionError recv(
int timeout = -1 );
91 void send( gloox::Tag* tag );
97 void send(
const std::string& xml );
103 void send(
const gloox::IQ& iq );
112 void disconnect( gloox::ConnectionError e,
113 gloox::StreamError se = gloox::StreamErrorUndefined,
114 const std::string& text = gloox::EmptyString );
132 const gloox::JID&
jid()
const {
return m_self; }
141 void setServer(
const std::string& server )
143 m_self.setServer( server );
151 void setUsername(
const std::string& username )
153 m_self.setUsername( username );
161 void setResource(
const std::string& resource )
163 m_self.setResource( resource );
186 gloox::ConnectionBase* conn = 0 );
192 void routeTag( gloox::Tag* tag );
200 const gloox::JID name()
const;
206 const std::string&
id()
const {
return m_id; }
214 void handleIncomingTag( gloox::Tag* tag );
223 void handleOutgoingTag( gloox::Tag* tag );
227 virtual void handleReceivedData(
const gloox::ConnectionBase* connection,
228 const std::string& data );
231 virtual void handleConnect(
const gloox::ConnectionBase* connection );
234 virtual void handleDisconnect(
const gloox::ConnectionBase* connection,
235 gloox::ConnectionError reason );
238 virtual void handleTag( gloox::Tag* tag );
241 void sendStreamFeatures(
const std::string& domain );
242 void handleStreamGreeting(
const gloox::Tag* tag );
243 bool handlesDomain(
const std::string& domain );
248 void stampTag( gloox::Tag* tag );
253 gloox::ConnectionBase* m_connection;
254 const gloox::LogSink& m_logInstance;
255 gloox::Parser m_parser;
260 gloox::StringList m_domains;
268 gloox::TagList m_incomingQueue;
269 gloox::TagList m_outgoingQueue;
270 gloox::util::Mutex m_incomingQueueMutex;
271 gloox::util::Mutex m_outgoingQueueMutex;
274 volatile bool m_threading;
283 #endif // STREAMBASE_H__