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 | 0cb7aee | 2013-07-16 16:18:06 -0700 | [diff] [blame] | 20 | ndn_ = 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 | * |
| 25 | * @param ndn Not a shared_ptr because we assume that it will remain valid during the life of this Transport object. |
| 26 | */ |
Jeff Thompson | 0cb7aee | 2013-07-16 16:18:06 -0700 | [diff] [blame] | 27 | virtual void connect(NDN &ndn); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 28 | |
| 29 | virtual void send(unsigned char *data, unsigned int dataLength); |
| 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 | 0cb7aee | 2013-07-16 16:18:06 -0700 | [diff] [blame] | 35 | NDN *ndn_; |
Jeff Thompson | b002f90 | 2013-07-16 18:07:18 -0700 | [diff] [blame] | 36 | // TODO: This belongs in the socket listener. |
| 37 | ndn_BinaryXMLElementReader elementReader_; |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } |
| 41 | |
| 42 | #endif |