face: Extending Face interface to support ``put`` call
Also, this commit includes Face/Node/Transport enhancement in regard to
the error processing: io_service thread will be stopped and Node::Error
exception will be thrown)
Change-Id: Ibec2f75e7b7d2e9a221a857fdc63295dd7da16e0
diff --git a/include/ndn-cpp/transport/transport.hpp b/include/ndn-cpp/transport/transport.hpp
index 8bfa355..59af6d1 100644
--- a/include/ndn-cpp/transport/transport.hpp
+++ b/include/ndn-cpp/transport/transport.hpp
@@ -18,6 +18,7 @@
class Transport {
public:
typedef ptr_lib::function<void (const Block &wire)> ReceiveCallback;
+ typedef ptr_lib::function<void ()> ErrorCallback;
inline
Transport();
@@ -26,11 +27,14 @@
~Transport();
/**
- * Connect according to the info in ConnectionInfo, and processEvents() will use elementListener.
- * @param connectionInfo A reference to an object of a subclass of ConnectionInfo.
+ * Connect transport
+ *
+ * @throws If connection cannot be established
*/
inline virtual void
- connect(boost::asio::io_service &io_service, const ReceiveCallback &receiveCallback);
+ connect(boost::asio::io_service &io_service,
+ const ReceiveCallback &receiveCallback,
+ const ErrorCallback &errorCallback);
/**
* Close the connection.
@@ -57,6 +61,7 @@
boost::asio::io_service *ioService_;
bool isConnected_;
ReceiveCallback receiveCallback_;
+ ErrorCallback errorCallback_;
};
inline
@@ -72,10 +77,13 @@
}
inline void
-Transport::connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
+Transport::connect(boost::asio::io_service &ioService,
+ const ReceiveCallback &receiveCallback,
+ const ErrorCallback &errorCallback)
{
ioService_ = &ioService;
receiveCallback_ = receiveCallback;
+ errorCallback_ = errorCallback;
}
inline bool