summaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/command-connection.h
blob: 355ee4e72b10c1b200dd2c89b9f274077d928788 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "line-splitter.h"

namespace config {
namespace sentinel {

class CommandConnection {
private:
    int _fd;
    LineSplitter _lines;

    // Unused constructors/assignment operator:
    CommandConnection();
    CommandConnection(const CommandConnection&);
    CommandConnection& operator =(const CommandConnection&);

public:
    explicit CommandConnection(int fd);
    ~CommandConnection();
    bool isFinished() const;
    char *getCommand();
    int printf(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
    void finish();
    int fd() const { return _fd; }
};

} // end namespace sentinel
} // end namespace config