3 #include "ParaRingBuffer.h" 5 #include <boost/bind.hpp> 6 #include <boost/asio.hpp> 7 #include <boost/thread.hpp> 11 #include <connectionbase.h> 16 using namespace gloox;
17 using boost::asio::ip::tcp;
40 CNPLTCPConnection( boost::asio::io_service& io_service,
const LogSink& logInstance,
const std::string& server,
int port = -1 );
50 CNPLTCPConnection( boost::asio::io_service& io_service, ConnectionDataHandler *cdh,
const LogSink& logInstance,
51 const std::string& server,
int port = -1 );
59 virtual bool send(
const std::string& data );
62 virtual ConnectionError receive();
65 virtual void disconnect();
68 virtual void cleanup();
71 virtual void getStatistics(
long int &totalIn,
long int &totalOut );
75 virtual ConnectionError recv(
int timeout = -1 );
78 virtual ConnectionError connect();
81 virtual ConnectionBase* newInstance()
const;
84 void NotifyDisconnect(ConnectionError
error);
87 bool HasNotification();
91 int HandleNotification();
94 void Reset(
const std::string& server,
int port );
100 void handle_resolve(
const boost::system::error_code& err, tcp::resolver::iterator endpoint_iterator);
101 void handle_connect(
const boost::system::error_code& error, tcp::resolver::iterator endpoint_iterator);
102 void handle_read(
const boost::system::error_code& error, std::size_t bytes_transferred);
103 void handle_write(
const boost::system::error_code& error);
104 void handle_disconnect();
108 void init(
const std::string& server,
int port );
110 const LogSink& m_logInstance;
115 long int m_totalBytesIn;
116 long int m_totalBytesOut;
117 std::string m_strPort;
119 tcp::socket m_socket;
120 tcp::resolver m_resolver;
different physics engine has different winding order.
Definition: EventBinding.h:32
boost::asio::io_service * m_pIOService
dispatcher IO service object for the connection socket.
Definition: NPL_TCPConnection.h:122
RingBuffer_Type m_queueInput
the input message queue.
Definition: NPL_TCPConnection.h:135
boost::asio is used for NPL jabber client's tcp connections.
Definition: NPL_TCPConnection.h:25
RingBuffer_Type m_queueOutput
the output message queue.
Definition: NPL_TCPConnection.h:132
ConnectionError m_nDisconnectError
disconnection error message.
Definition: NPL_TCPConnection.h:127
bool m_bNotifyDisconnect
true to notify disconnection
Definition: NPL_TCPConnection.h:125
cross platform mutex
Definition: mutex.h:95