blob: da8b103b843a1795b0a5531b8a9a6be385fe87b5 [file] [log] [blame]
Jeff Thompsonfcf347d2013-07-15 11:30:44 -07001/**
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 Thompsonb002f902013-07-16 18:07:18 -070010#include "../c/encoding/BinaryXMLElementReader.h"
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070011#include "Transport.hpp"
12
13namespace ndn {
14
15class TcpTransport : public Transport {
16public:
17 TcpTransport()
18 {
19 ndn_TcpTransport_init(&transport_);
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070020 face_ = 0;
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070021 }
22
Jeff Thompson2ed62fb2013-07-16 18:10:30 -070023 /**
24 *
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070025 * @param face Not a shared_ptr because we assume that it will remain valid during the life of this Transport object.
Jeff Thompson2ed62fb2013-07-16 18:10:30 -070026 */
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070027 virtual void connect(Face &face);
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070028
Jeff Thompsonb605b5d2013-07-30 15:12:56 -070029 virtual void send(const unsigned char *data, unsigned int dataLength);
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070030
Jeff Thompson0cb7aee2013-07-16 16:18:06 -070031 virtual void tempReceive();
Jeff Thompson57963882013-08-05 16:01:25 -070032
33 virtual void close();
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070034
35private:
36 struct ndn_TcpTransport transport_;
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070037 Face *face_;
Jeff Thompsonb002f902013-07-16 18:07:18 -070038 // TODO: This belongs in the socket listener.
Jeff Thompsonf0fea002013-07-30 17:22:42 -070039 ndn_BinaryXmlElementReader elementReader_;
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070040};
41
42}
43
44#endif