blob: de2b7e5dff91a2e12bf4f07cddf395231570f87d [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_TRANSPORT_HPP
7#define NDN_TRANSPORT_HPP
8
Jeff Thompsonb605b5d2013-07-30 15:12:56 -07009#include <vector>
10
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070011namespace ndn {
Jeff Thompson0cb7aee2013-07-16 16:18:06 -070012
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070013class Face;
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070014class Transport {
15public:
Jeff Thompson2ed62fb2013-07-16 18:10:30 -070016 /**
17 *
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070018 * @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 -070019 */
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070020 virtual void connect(Face &face);
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070021
Jeff Thompsonb605b5d2013-07-30 15:12:56 -070022 virtual void send(const unsigned char *data, unsigned int dataLength);
23
24 void send(const std::vector<unsigned char> &data)
25 {
26 send(&data[0], data.size());
27 }
Jeff Thompson57963882013-08-05 16:01:25 -070028
29 /**
Jeff Thompson7098dd62013-08-06 14:42:02 -070030 * Make one pass to receive any data waiting on the connection.
31 * @deprecated
32 */
33 virtual void tempReceive() = 0;
34
35 /**
Jeff Thompson57963882013-08-05 16:01:25 -070036 * Close the connection. This base class implementation does nothing, but your derived class can override.
37 */
38 virtual void close();
Jeff Thompsonfcf347d2013-07-15 11:30:44 -070039};
40
41}
42
43#endif