face: LinkService and Transport counters
refs #3177
Change-Id: Idc495c58c3103dae5f01a2b6ebbff47a2c4a5d2b
diff --git a/daemon/face/websocket-transport.hpp b/daemon/face/websocket-transport.hpp
index 91a99c1..08542c0 100644
--- a/daemon/face/websocket-transport.hpp
+++ b/daemon/face/websocket-transport.hpp
@@ -33,16 +33,39 @@
namespace nfd {
namespace face {
-/**
- * \brief A Transport that communicates on a WebSocket connection
+/** \brief counters provided by WebSocketTransport
+ * \note The type name 'WebSocketTransportCounters' is implementation detail.
+ * Use 'WebSocketTransport::Counters' in public API.
*/
-class WebSocketTransport DECL_FINAL : public Transport
+class WebSocketTransportCounters : public virtual Transport::Counters
{
public:
+ /** \brief count of outgoing Pings
+ */
+ PacketCounter nOutPings;
+
+ /** \brief count of incoming Pongs
+ */
+ PacketCounter nInPongs;
+};
+
+/** \brief A Transport that communicates on a WebSocket connection
+ */
+class WebSocketTransport DECL_FINAL : public Transport
+ , protected virtual WebSocketTransportCounters
+{
+public:
+ /** \brief counters provided by WebSocketTransport
+ */
+ typedef WebSocketTransportCounters Counters;
+
WebSocketTransport(websocketpp::connection_hdl hdl,
websocket::Server& server,
time::milliseconds pingInterval);
+ virtual const Counters&
+ getCounters() const DECL_OVERRIDE;
+
/** \brief Translates a message into a Block
* and delivers it to the link service
*/
@@ -82,6 +105,12 @@
scheduler::ScopedEventId m_pingEventId;
};
+inline const WebSocketTransport::Counters&
+WebSocketTransport::getCounters() const
+{
+ return *this;
+}
+
} // namespace face
} // namespace nfd