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_TRANSPORT_HPP |
| 7 | #define NDN_TRANSPORT_HPP |
| 8 | |
Jeff Thompson | b605b5d | 2013-07-30 15:12:56 -0700 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 11 | namespace ndn { |
Jeff Thompson | 0cb7aee | 2013-07-16 16:18:06 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 13 | class Face; |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 14 | class Transport { |
| 15 | public: |
Jeff Thompson | 2ed62fb | 2013-07-16 18:10:30 -0700 | [diff] [blame] | 16 | /** |
| 17 | * |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 18 | * @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] | 19 | */ |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 20 | virtual void connect(Face &face); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 21 | |
Jeff Thompson | b605b5d | 2013-07-30 15:12:56 -0700 | [diff] [blame] | 22 | 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 Thompson | 5796388 | 2013-08-05 16:01:25 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Close the connection. This base class implementation does nothing, but your derived class can override. |
| 31 | */ |
| 32 | virtual void close(); |
Jeff Thompson | fcf347d | 2013-07-15 11:30:44 -0700 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | } |
| 36 | |
| 37 | #endif |