summaryrefslogtreecommitdiffstats
path: root/config/src/apps/configproxy-cmd/proxycmd.h
blob: a0ef02edaaecdb39cd810cf2cca37e41ec7d9c88 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/fnet/frt/frt.h>

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

class ProxyCmd
{
private:
    FRT_Supervisor *_supervisor;
    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();
};