aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/apps/vespa-configproxy-cmd/proxycmd.h
blob: 3c09e32949457eefa5afad5292037776a3a4456d (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <vector>
#include <memory>

class FRT_Target;
class FRT_RPCRequest;
class FRT_Values;

namespace fnet::frt { class StandaloneFRT; }

struct Flags {
    vespalib::string method;
    std::vector<vespalib::string> args;
    vespalib::string targethost;
    int portnumber;
    Flags(const Flags &);
    Flags & operator=(const Flags &);
    Flags();
    ~Flags();
};

class ProxyCmd
{
private:
    std::unique_ptr<fnet::frt::StandaloneFRT> _server;
    FRT_Target     *_target;
    FRT_RPCRequest *_req;
    Flags           _flags;

    void initRPC();
    void invokeRPC();
    void finiRPC();
    void printArray(FRT_Values *rvals);
    vespalib::string makeSpec();
    void autoPrint();
public:
    ProxyCmd(const Flags& flags);
    virtual ~ProxyCmd();
    int action();
};