summaryrefslogtreecommitdiff
path: root/src/protocol/input.h
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-06-07 01:40:32 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-12-02 04:05:15 +0300
commit3aed59276c2b7275603f6da18377b77718948667 (patch)
tree86816d82ab02b6e4761175d599f5749490706792 /src/protocol/input.h
parentd86ca1e596b094cba101e0e3e6c8cdb71f8116e9 (diff)
wipp17
Diffstat (limited to 'src/protocol/input.h')
-rw-r--r--src/protocol/input.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/protocol/input.h b/src/protocol/input.h
new file mode 100644
index 0000000..1791f9a
--- /dev/null
+++ b/src/protocol/input.h
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+#ifndef INVERTER_TOOLS_PROTOCOL_COMMON_COMMANDS_H
+#define INVERTER_TOOLS_PROTOCOL_COMMON_COMMANDS_H
+
+#include <string>
+#include <vector>
+
+#define GET_ARGS(__len__) protocol::get_args((protocol::CommandInput*)input, arguments, (__len__))
+
+namespace protocol {
+
+#ifdef INVERTERCTL
+struct CommandInput {
+ int argc;
+ char **argv;
+};
+#endif
+
+#ifdef INVERTERD
+struct CommandInput {
+ std::vector<std::string>* argv;
+};
+#endif
+
+void get_args(CommandInput* input, std::vector<std::string>& arguments, size_t count);
+void validate_date_args(const std::string* ys, const std::string* ms, const std::string* ds);
+void validate_time_args(const std::string* hs, const std::string* ms, const std::string* ss);
+
+}
+
+#endif //INVERTER_TOOLS_PROTOCOL_COMMON_COMMANDS_H