summaryrefslogtreecommitdiff
path: root/src/protocol/input.h
blob: 1791f9a20bc2c9a452594d794af3a5d8dc5c2383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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