#include <connectionbosh.h>
Inherits ConnectionBase, ConnectionDataHandler, and TagHandler.
Inheritance diagram for ConnectionBOSH:

Public Types | |
| enum | ConnMode { ModeLegacyHTTP, ModePersistentHTTP, ModePipelining } |
Public Member Functions | |
| ConnectionBOSH (ConnectionBase *connection, const LogSink &logInstance, const std::string &boshHost, const std::string &xmppServer, int xmppPort=5222) | |
| ConnectionBOSH (ConnectionDataHandler *cdh, ConnectionBase *connection, const LogSink &logInstance, const std::string &boshHost, const std::string &xmppServer, int xmppPort=5222) | |
| virtual | ~ConnectionBOSH () |
| void | setServer (const std::string &xmppHost, unsigned short xmppPort=5222) |
| void | setPath (const std::string &path) |
| void | setMode (ConnMode mode) |
| virtual ConnectionError | connect () |
| virtual ConnectionError | recv (int timeout=-1) |
| virtual bool | send (const std::string &data) |
| virtual ConnectionError | receive () |
| virtual void | disconnect () |
| virtual void | cleanup () |
| virtual void | getStatistics (long int &totalIn, long int &totalOut) |
| virtual void | handleReceivedData (const ConnectionBase *connection, const std::string &data) |
| virtual void | handleConnect (const ConnectionBase *connection) |
| virtual void | handleDisconnect (const ConnectionBase *connection, ConnectionError reason) |
| virtual ConnectionBase * | newInstance () const |
| virtual void | handleTag (Tag *tag) |
Usage:
Client *c = new Client( ... ); c->setConnectionImpl( new ConnectionBOSH( c, new ConnectionTCPClient( c->logInstance(), httpServer, httpPort ), c->logInstance(), boshHost, xmpphost, xmppPort ) );
Make sure to pass the BOSH connection manager's host/port to the transport connection (ConnectionTCPClient in this case), and the XMPP server's host and port to the BOSH connection. You must also pass to BOSH the address of the BOSH server you are dealing with, this is used in the HTTP Host header.
In the case of using ConnectionBOSH through a HTTP proxy, supply httpServer and httpPort as those of the proxy. In all cases, boshHost should be set to the hostname (not IP address) of the server running the BOSH connection manager.
The reason why ConnectionBOSH doesn't manage its own ConnectionTCPClient is that it allows it to be used with other transports (like chained SOCKS5/HTTP proxies, or ConnectionTLS for HTTPS).
Jakob Schroeter <js@camaya.net>
Definition at line 64 of file connectionbosh.h.
|
|
The supported connection modes. Usually auto-detected.
Definition at line 110 of file connectionbosh.h. |
|
||||||||||||||||||||||||
|
Constructs a new ConnectionBOSH object.
Definition at line 31 of file connectionbosh.cpp. |
|
||||||||||||||||||||||||||||
|
Constructs a new ConnectionBOSH object.
Definition at line 44 of file connectionbosh.cpp. |
|
|
Virtual destructor Definition at line 76 of file connectionbosh.cpp. |
|
|
This function is called after a disconnect to clean up internal state. It is also called by ConnectionBase's destructor. Reimplemented from ConnectionBase. Definition at line 343 of file connectionbosh.cpp. |
|
|
Used to initiate the connection.
Implements ConnectionBase. Definition at line 103 of file connectionbosh.cpp. |
|
|
Disconnects an established connection. NOOP if no active connection exists. Implements ConnectionBase. Definition at line 121 of file connectionbosh.cpp. |
|
||||||||||||
|
Returns current connection statistics.
Implements ConnectionBase. Definition at line 351 of file connectionbosh.cpp. |
|
|
This function is called when e.g. the raw TCP connection was established.
Implements ConnectionDataHandler. Definition at line 406 of file connectionbosh.cpp. |
|
||||||||||||
|
This connection is called when e.g. the raw TCP connection was closed.
Implements ConnectionDataHandler. Definition at line 433 of file connectionbosh.cpp. |
|
||||||||||||
|
This function is called for received from the underlying transport.
Implements ConnectionDataHandler. Definition at line 357 of file connectionbosh.cpp. |
|
|
This function is called when a registered XML element arrives. As with every handler in gloox, the Tag is going to be deleted after this function returned. If you need a copy afterwards, create it using Tag::clone().
Implements TagHandler. Definition at line 458 of file connectionbosh.cpp. |
|
|
This function returns a new instance of the current ConnectionBase-derived object. The idea is to be able to 'clone' ConnectionBase-derived objects without knowing of what type they are exactly.
Implements ConnectionBase. Definition at line 82 of file connectionbosh.cpp. |
|
|
Use this function to put the connection into 'receive mode', i.e. this function returns only when the connection is terminated.
Implements ConnectionBase. Definition at line 335 of file connectionbosh.cpp. |
|
|
Use this periodically to receive data from the socket.
Implements ConnectionBase. Definition at line 161 of file connectionbosh.cpp. |
|
|
Use this function to send a string of data over the wire. The function returns only after all data has been sent.
Implements ConnectionBase. Definition at line 183 of file connectionbosh.cpp. |
|
|
Sets the connection mode
Definition at line 139 of file connectionbosh.h. |
|
|
Sets the path on the connection manager to request
Definition at line 130 of file connectionbosh.h. |
|
||||||||||||
|
Sets the XMPP server to proxy to.
Definition at line 122 of file connectionbosh.h. |
1.4.1