Change send to use const unsigned char *
diff --git a/ndn-cpp/transport/TcpTransport.cpp b/ndn-cpp/transport/TcpTransport.cpp
index 1f575b9..69a9869 100644
--- a/ndn-cpp/transport/TcpTransport.cpp
+++ b/ndn-cpp/transport/TcpTransport.cpp
@@ -28,7 +28,7 @@
ndn_ = &ndn;
}
-void TcpTransport::send(unsigned char *data, unsigned int dataLength)
+void TcpTransport::send(const unsigned char *data, unsigned int dataLength)
{
ndn_Error error;
if (error = ndn_TcpTransport_send(&transport_, data, dataLength))
diff --git a/ndn-cpp/transport/TcpTransport.hpp b/ndn-cpp/transport/TcpTransport.hpp
index 8b714e8..fc57e54 100644
--- a/ndn-cpp/transport/TcpTransport.hpp
+++ b/ndn-cpp/transport/TcpTransport.hpp
@@ -26,7 +26,7 @@
*/
virtual void connect(NDN &ndn);
- virtual void send(unsigned char *data, unsigned int dataLength);
+ virtual void send(const unsigned char *data, unsigned int dataLength);
virtual void tempReceive();
diff --git a/ndn-cpp/transport/Transport.hpp b/ndn-cpp/transport/Transport.hpp
index 70f7dbc..4a55573 100644
--- a/ndn-cpp/transport/Transport.hpp
+++ b/ndn-cpp/transport/Transport.hpp
@@ -6,6 +6,8 @@
#ifndef NDN_TRANSPORT_HPP
#define NDN_TRANSPORT_HPP
+#include <vector>
+
namespace ndn {
class NDN;
@@ -17,7 +19,12 @@
*/
virtual void connect(NDN &ndn);
- virtual void send(unsigned char *data, unsigned int dataLength);
+ virtual void send(const unsigned char *data, unsigned int dataLength);
+
+ void send(const std::vector<unsigned char> &data)
+ {
+ send(&data[0], data.size());
+ }
};
}