AsyncTcpClient.h

Go to the documentation of this file.
00001 
00036 #ifndef ASYNC_TCP_CLIENT_INCLUDED
00037 #define ASYNC_TCP_CLIENT_INCLUDED
00038 
00039 
00040 /****************************************************************************
00041  *
00042  * System Includes
00043  *
00044  ****************************************************************************/
00045 
00046 #include <sigc++/sigc++.h>
00047 #include <stdint.h>
00048 
00049 #include <string>
00050 
00051 
00052 /****************************************************************************
00053  *
00054  * Project Includes
00055  *
00056  ****************************************************************************/
00057 
00058 #include <AsyncTcpConnection.h>
00059 
00060 
00061 /****************************************************************************
00062  *
00063  * Local Includes
00064  *
00065  ****************************************************************************/
00066 
00067 
00068 
00069 /****************************************************************************
00070  *
00071  * Forward declarations
00072  *
00073  ****************************************************************************/
00074 
00075 
00076 
00077 /****************************************************************************
00078  *
00079  * Namespace
00080  *
00081  ****************************************************************************/
00082 
00083 namespace Async
00084 {
00085 
00086 /****************************************************************************
00087  *
00088  * Forward declarations of classes inside of the declared namespace
00089  *
00090  ****************************************************************************/
00091 
00092 class FdWatch;
00093 class DnsLookup;
00094 class IpAddress;
00095 
00096 
00097 /****************************************************************************
00098  *
00099  * Defines & typedefs
00100  *
00101  ****************************************************************************/
00102 
00103 
00104 
00105 /****************************************************************************
00106  *
00107  * Exported Global Variables
00108  *
00109  ****************************************************************************/
00110 
00111 
00112 
00113 /****************************************************************************
00114  *
00115  * Class definitions
00116  *
00117  ****************************************************************************/
00118 
00130 class TcpClient : public TcpConnection
00131 {
00132   public:
00143     TcpClient(const std::string& remote_host, uint16_t remote_port,
00144               size_t recv_buf_len = DEFAULT_RECV_BUF_LEN);
00145     
00149     ~TcpClient(void);
00150     
00159     void connect(void);
00160     
00168     void disconnect(void);
00169     
00173     SigC::Signal0<void>                   connected;
00174     
00175         
00176   protected:
00177     
00178   private:
00179     DnsLookup   *dns;
00180     std::string remote_host;
00181     uint16_t    remote_port;
00182     int         sock;
00183     FdWatch     *wr_watch;
00184     
00185     void dnsResultsReady(DnsLookup& dns_lookup);
00186     void connectToRemote(const IpAddress& ip_addr);
00187     void connectHandler(FdWatch *watch);
00188 
00189 };  /* class TcpClient */
00190 
00191 
00192 } /* namespace */
00193 
00194 #endif /* ASYNC_TCP_CLIENT_INCLUDED */
00195 
00196 
00197 
00198 /*
00199  * This file has not been truncated
00200  */
00201 
Generated by  doxygen 1.6.2-20100208