-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdocker.h
62 lines (48 loc) · 1.48 KB
/
cdocker.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef CDOCKER_H
#define CDOCKER_H
#include <string>
#include <map>
#include <vector>
extern "C" {
#include <unistd.h>
}
#include "cdockercontainer.h"
class NamespaceFile {
public:
int nstype;
std::string name;
int fd;
public:
NamespaceFile(int nstype, std::string name) : nstype(0), fd(-1) {
this->nstype = nstype;
this->name = name;
}
void setfd(int iFd) {
this->fd = iFd;
}
void closefd() const {
if (this->fd != -1)
close(this->fd);
}
};
class CDocker
{
public:
std::string dockerPath;
std::string dockerConfig;
std::map<std::string, CDockerContainer> dockerContainers;
std::map<std::string, CDockerContainer> activeContainers;
size_t maxConfigFileSize;
// secondary search
std::string path_activeContainers = "/tmp/docker-config/active-containers.json";
public:
CDocker();
void loadConfigDirectory();
void loadConfigV2(const char *configFile);
private:
void setNSByHostname(const std::string &hostname, int phpVersionInt);
public:
int run(const std::string& hostname, int selectedVersion, std::vector<std::string> args);
void loadActiveContainers();
};
#endif // CDOCKER_H