Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
Jeff Thompson | 95a71b1 | 2013-07-31 10:49:50 -0700 | [diff] [blame] | 6 | #ifndef NDN_UDPTRANSPORT_HPP |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame^] | 7 | #define NDN_UDPTRANSPORT_HPP |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 8 | |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 9 | #include "../c/transport/udp-transport.h" |
| 10 | #include "../c/encoding/binary-xml-element-reader.h" |
| 11 | #include "transport.hpp" |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 12 | |
| 13 | namespace ndn { |
| 14 | |
| 15 | class UdpTransport : public Transport { |
| 16 | public: |
| 17 | UdpTransport() |
| 18 | { |
| 19 | ndn_UdpTransport_init(&transport_); |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 20 | face_ = 0; |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 21 | } |
| 22 | |
| 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 | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 26 | */ |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 27 | virtual void connect(Face &face); |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 28 | |
Jeff Thompson | 60eaae3 | 2013-07-30 15:46:19 -0700 | [diff] [blame] | 29 | virtual void send(const unsigned char *data, unsigned int dataLength); |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 30 | |
| 31 | virtual void tempReceive(); |
| 32 | |
Jeff Thompson | 5796388 | 2013-08-05 16:01:25 -0700 | [diff] [blame] | 33 | virtual void close(); |
| 34 | |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 35 | private: |
| 36 | struct ndn_UdpTransport transport_; |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 37 | Face *face_; |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 38 | // TODO: This belongs in the socket listener. |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 39 | ndn_BinaryXmlElementReader elementReader_; |
Jeff Thompson | bc53c52 | 2013-07-17 17:11:48 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | } |
| 43 | |
| 44 | #endif |