Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #ifndef NDN_TCPTRANSPORT_HPP |
| 7 | #define NDN_TCPTRANSPORT_HPP |
| 8 | |
| 9 | #include "../c/transport/TcpTransport.h" |
Jeff Thompson | b002f90 | 2013-07-16 18:07:18 -0700 | [diff] [blame] | 10 | #include "../c/encoding/BinaryXMLElementReader.h" |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 11 | #include "Transport.hpp" |
| 12 | |
| 13 | namespace ndn { |
| 14 | |
| 15 | class TcpTransport : public Transport { |
| 16 | public: |
| 17 | TcpTransport() |
| 18 | { |
| 19 | ndn_TcpTransport_init(&transport_); |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 20 | face_ = 0; |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 21 | } |
| 22 | |
Jeff Thompson | 2ed62fb | 2013-07-16 18:10:30 -0700 | [diff] [blame] | 23 | /** |
| 24 | * |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 25 | * @param face Not a shared_ptr because we assume that it will remain valid during the life of this Transport object. |
Jeff Thompson | 2ed62fb | 2013-07-16 18:10:30 -0700 | [diff] [blame] | 26 | */ |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 27 | virtual void connect(Face &face); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 28 | |
Jeff Thompson | b605b5d | 2013-07-30 15:12:56 -0700 | [diff] [blame] | 29 | virtual void send(const unsigned char *data, unsigned int dataLength); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 0cb7aee | 2013-07-16 16:18:06 -0700 | [diff] [blame] | 31 | virtual void tempReceive(); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 32 | |
| 33 | private: |
| 34 | struct ndn_TcpTransport transport_; |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 35 | Face *face_; |
Jeff Thompson | b002f90 | 2013-07-16 18:07:18 -0700 | [diff] [blame] | 36 | // TODO: This belongs in the socket listener. |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 37 | ndn_BinaryXmlElementReader elementReader_; |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } |
| 41 | |
| 42 | #endif |