softwarecontainer  0.18.0-739e8d7 2017-05-04
softwarecontainerconfig.cpp
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 #include <string>
21 
22 #include "config/softwarecontainerconfig.h"
23 
24 namespace softwarecontainer {
25 
26 SoftwareContainerConfig::SoftwareContainerConfig(
27 #ifdef ENABLE_NETWORKGATEWAY
28  const bool shouldCreateBridge,
29  const std::string &bridgeDevice,
30  const std::string &bridgeIPAddress,
31  const std::string &bridgeNetmask,
32  int bridgeNetmaskBitLength,
33  const std::string &bridgeNetAddr,
34 #endif // ENABLE_NETWORKGATEWAY
35  const std::string &containerConfigPath,
36  const std::string &sharedMountsDir,
37  unsigned int containerShutdownTimeout) :
38 #ifdef ENABLE_NETWORKGATEWAY
39  m_shouldCreateBridge(shouldCreateBridge),
40  m_bridgeDevice(bridgeDevice),
41  m_bridgeIPAddress(bridgeIPAddress),
42  m_bridgeNetmask(bridgeNetmask),
43  m_bridgeNetmaskBitLength(bridgeNetmaskBitLength),
44  m_bridgeNetAddr(bridgeNetAddr),
45 #endif
46  m_containerConfigPath(containerConfigPath),
47  m_sharedMountsDir(sharedMountsDir),
48  m_containerShutdownTimeout(containerShutdownTimeout)
49 {
50 }
51 
52 void SoftwareContainerConfig::setEnableWriteBuffer(bool enabledFlag)
53 {
54  m_writeBufferEnabled = enabledFlag;
55 }
56 
57 void SoftwareContainerConfig::setEnableTemporaryFileSystemWriteBuffers(bool enabled)
58 {
59  m_temporaryFileSystemWriteBufferEnableds = enabled;
60 }
61 
62 void SoftwareContainerConfig::setTemporaryFileSystemSize(unsigned int size)
63 {
64  m_temporaryFileSystemSize = size;
65 }
66 
67 std::string SoftwareContainerConfig::containerConfigPath() const
68 {
69  return m_containerConfigPath;
70 }
71 
72 std::string SoftwareContainerConfig::sharedMountsDir() const
73 {
74  return m_sharedMountsDir;
75 }
76 
77 unsigned int SoftwareContainerConfig::containerShutdownTimeout() const
78 {
79  return m_containerShutdownTimeout;
80 }
81 
82 bool SoftwareContainerConfig::writeBufferEnabled() const
83 {
84  return m_writeBufferEnabled;
85 }
86 
87 bool SoftwareContainerConfig::temporaryFileSystemWriteBufferEnableds() const
88 {
89  return m_temporaryFileSystemWriteBufferEnableds;
90 }
91 
92 unsigned int SoftwareContainerConfig::temporaryFileSystemSize() const
93 {
94  return m_temporaryFileSystemSize;
95 }
96 
97 #ifdef ENABLE_NETWORKGATEWAY
98 
99 bool SoftwareContainerConfig::shouldCreateBridge() const
100 {
101  return m_shouldCreateBridge;
102 }
103 
104 std::string SoftwareContainerConfig::bridgeDevice() const
105 {
106  return m_bridgeDevice;
107 }
108 
109 std::string SoftwareContainerConfig::bridgeIPAddress() const
110 {
111  return m_bridgeIPAddress;
112 }
113 
114 std::string SoftwareContainerConfig::bridgeNetmask() const
115 {
116  return m_bridgeNetmask;
117 }
118 
119 int SoftwareContainerConfig::bridgeNetmaskBitLength() const
120 {
121  return m_bridgeNetmaskBitLength;
122 }
123 
124 std::string SoftwareContainerConfig::bridgeNetAddr() const
125 {
126  return m_bridgeNetAddr;
127 }
128 
129 #endif // ENABLE_NETWORKGATEWAY
130 
131 
132 } // namespace softwarecontainer
Developers guide to adding a config item: