softwarecontainer  0.18.0-739e8d7 2017-05-04
softwarecontainerconfig.h
1 /*
2  * Copyright (C) 2016-2017 Pelagicore AB
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
10  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
11  * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
12  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
13  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
14  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15  * SOFTWARE.
16  *
17  * For further information see LICENSE
18  */
19 
20 #pragma once
21 
22 #include <string>
23 
24 namespace softwarecontainer {
25 
42 {
43 public:
45 
47 #ifdef ENABLE_NETWORKGATEWAY
48  const bool shouldCreateBridge,
49  const std::string &bridgeDevice,
50  const std::string &bridgeIPAddress,
51  const std::string &bridgeNetmask,
52  const int bridgeNetmaskBitLength,
53  const std::string &bridgeNetAddr,
54 #endif // ENABLE_NETWORKGATEWAY
55  const std::string &containerConfigPath,
56  const std::string &sharedMountsDir,
57  unsigned int containerShutdownTimeout);
58 
60 
61  /*
62  * Setters for the values that are not part of the static configs
63  */
64  void setEnableWriteBuffer(bool enabledFlag);
65  void setEnableTemporaryFileSystemWriteBuffers(bool enabled);
66  void setTemporaryFileSystemSize(unsigned int size);
67 
68  /*
69  * Getters for values that are set on creation only, i.e. these originate from the
70  * static configs and should not be "re-set" after creation of this class.
71  */
72 #ifdef ENABLE_NETWORKGATEWAY
73  bool shouldCreateBridge() const;
74  std::string bridgeDevice() const;
75  std::string bridgeIPAddress() const;
76  std::string bridgeNetmask() const;
77  int bridgeNetmaskBitLength() const;
78  std::string bridgeNetAddr() const;
79 #endif // ENABLE_NETWORKGATEWAY
80 
81  std::string containerConfigPath() const;
82  std::string sharedMountsDir() const;
83  unsigned int containerShutdownTimeout() const;
84 
85  /*
86  * Getters for values that do not originate from the static configs and thus might be
87  * set after creation of this class, i.e. these can be set with setters
88  */
89  bool writeBufferEnabled() const;
90  bool temporaryFileSystemWriteBufferEnableds() const;
91  unsigned int temporaryFileSystemSize() const;
92 
93 private:
94 #ifdef ENABLE_NETWORKGATEWAY
95  bool m_shouldCreateBridge;
96  std::string m_bridgeDevice;
97  std::string m_bridgeIPAddress;
98  std::string m_bridgeNetmask;
99  int m_bridgeNetmaskBitLength;
100  std::string m_bridgeNetAddr;
101 #endif // ENABLE_NETWORKGATEWAY
102 
103  std::string m_containerConfigPath;
104  std::string m_sharedMountsDir;
105  unsigned int m_containerShutdownTimeout;
106 
107  bool m_writeBufferEnabled;
108  bool m_temporaryFileSystemWriteBufferEnableds;
109  unsigned int m_temporaryFileSystemSize;
110 };
111 
112 } // namespace softwarecontainer
Contains all values that should be passed to SoftwareContainer on creation.
Developers guide to adding a config item: