aboutsummaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/check-completion-handler.h
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-05-27 13:52:08 +0000
committerArne Juul <arnej@verizonmedia.com>2021-05-31 10:52:42 +0000
commitb741e5ffdfceb532c1166e778a072de8d4d1e6ea (patch)
treecb31e40859b6174a4bb4dba6f56db8e0392d263b /configd/src/apps/sentinel/check-completion-handler.h
parent781cb0770f50a5fd00bae0ecc0c5d323132ab166 (diff)
prepare for "check connectivity" api
* Cmd now has more generic "name" property and optional "portNumber" * add CmdType CHECK_CONNECTIVITY * add a simple one-shot PeerCheck utility * add CheckCompletionHandler that handles a Cmd with type CHECK_CONNECTIVITY * dummy in handleCmd for now
Diffstat (limited to 'configd/src/apps/sentinel/check-completion-handler.h')
-rw-r--r--configd/src/apps/sentinel/check-completion-handler.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/configd/src/apps/sentinel/check-completion-handler.h b/configd/src/apps/sentinel/check-completion-handler.h
new file mode 100644
index 00000000000..ae43799dd54
--- /dev/null
+++ b/configd/src/apps/sentinel/check-completion-handler.h
@@ -0,0 +1,27 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "status-callback.h"
+#include "peer-check.h"
+#include "cmdq.h"
+
+namespace config::sentinel {
+
+/**
+ * Handles a checkConnectivity request by making an outgoing
+ * ping request. When the ping finishes, fills an answer
+ * into the parent request and deletes itself.
+ **/
+class CheckCompletionHandler : public StatusCallback {
+public:
+ static void create(Cmd::UP request, FRT_Supervisor &orb);
+ virtual ~CheckCompletionHandler();
+ void returnStatus(bool ok) override;
+private:
+ CheckCompletionHandler(Cmd::UP request, FRT_Supervisor &orb);
+ Cmd::UP _parentRequest;
+ std::unique_ptr<PeerCheck> _peerCheck;
+};
+
+}