aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/core/connector.h
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-03-07 18:34:52 +0100
committerMauro Sardara <msardara@cisco.com>2019-03-08 09:33:21 +0000
commit6922da2298b07d797029da4d40368adf12546639 (patch)
tree12e9c21553c84d4740fe0bb1d5c88c263e50d714 /libtransport/src/hicn/transport/core/connector.h
parentb980b4384d610e64e4c8bdd749a6e8fb0ebd5117 (diff)
[HICN-85] Added state to connectors.
Change-Id: I26d1b37fec4a2482b97a80fa5648f243745908f7 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/connector.h')
-rw-r--r--libtransport/src/hicn/transport/core/connector.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/core/connector.h b/libtransport/src/hicn/transport/core/connector.h
index 529e97bf9..c790f2bfb 100644
--- a/libtransport/src/hicn/transport/core/connector.h
+++ b/libtransport/src/hicn/transport/core/connector.h
@@ -34,6 +34,13 @@ enum class ConnectorType : uint8_t {
};
class Connector {
+ protected:
+ enum class ConnectorState {
+ CLOSED,
+ CONNECTING,
+ CONNECTED,
+ };
+
public:
static constexpr std::size_t packet_size = 2048;
static constexpr std::size_t queue_size = 4096;
@@ -48,7 +55,7 @@ class Connector {
Connector(PacketReceivedCallback &&receive_callback,
OnReconnect &&reconnect_callback);
- virtual ~Connector() = default;
+ virtual ~Connector(){};
virtual void send(const Packet::MemBufPtr &packet) = 0;
@@ -59,7 +66,7 @@ class Connector {
virtual void enableBurst() = 0;
- virtual void state() = 0;
+ virtual ConnectorState state() { return state_; };
protected:
void increasePoolSize(std::size_t size = packet_pool_size);
@@ -93,6 +100,9 @@ class Connector {
// Connector events
PacketReceivedCallback receive_callback_;
OnReconnect on_reconnect_callback_;
+
+ // Connector state
+ ConnectorState state_;
};
} // end namespace core