blob: 0aaa2f4c51f63d584cb1a08d5926f4cfe8dc76d6 [file] [log] [blame]
Jeff Thompsonbc53c522013-07-17 17:11:48 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
Jeff Thompson95a71b12013-07-31 10:49:50 -07006#ifndef NDN_UDPTRANSPORT_HPP
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07007#define NDN_UDPTRANSPORT_HPP
Jeff Thompsonbc53c522013-07-17 17:11:48 -07008
Jeff Thompson53412192013-08-06 13:35:50 -07009#include "../c/transport/udp-transport.h"
10#include "../c/encoding/binary-xml-element-reader.h"
11#include "transport.hpp"
Jeff Thompsonbc53c522013-07-17 17:11:48 -070012
13namespace ndn {
14
15class UdpTransport : public Transport {
16public:
17 UdpTransport()
18 {
19 ndn_UdpTransport_init(&transport_);
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070020 face_ = 0;
Jeff Thompsonbc53c522013-07-17 17:11:48 -070021 }
22
23 /**
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 Thompsonbc53c522013-07-17 17:11:48 -070026 */
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070027 virtual void connect(Face &face);
Jeff Thompsonbc53c522013-07-17 17:11:48 -070028
Jeff Thompson60eaae32013-07-30 15:46:19 -070029 virtual void send(const unsigned char *data, unsigned int dataLength);
Jeff Thompsonbc53c522013-07-17 17:11:48 -070030
31 virtual void tempReceive();
32
Jeff Thompson57963882013-08-05 16:01:25 -070033 virtual void close();
34
Jeff Thompsonbc53c522013-07-17 17:11:48 -070035private:
36 struct ndn_UdpTransport transport_;
Jeff Thompsonb9e3c8e2013-08-02 11:42:51 -070037 Face *face_;
Jeff Thompsonbc53c522013-07-17 17:11:48 -070038 // TODO: This belongs in the socket listener.
Jeff Thompsonf0fea002013-07-30 17:22:42 -070039 ndn_BinaryXmlElementReader elementReader_;
Jeff Thompsonbc53c522013-07-17 17:11:48 -070040};
41
42}
43
44#endif