reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
NetNs.hxx
Go to the documentation of this file.
1#if !defined(RESIP_NETNS_HXX) && defined(USE_NETNS)
2#define RESIP_NETNS_HXX
3
4#include <vector>
5#include "rutil/HashMap.hxx"
7
8namespace resip
9{
10
11class NetNs
12{
23 public:
24
25 class Exception final : public BaseException
26 {
27 public:
28 Exception(const Data& message, const Data& fileName, int lineNumber) :
29 BaseException(message, fileName, lineNumber){}
30
31 const char* name() const noexcept override { return("NetNs::Exception"); }
32 };
33
34 virtual ~NetNs();
35
36 // @ brief sets the kernel netns for the current thread
37 static int setNs(const Data& netNs);
51 // @brief gets public netns namespace names
52 static int getPublicNetNs(std::vector<Data>& netNsNames);
66 // @brief Get the netns id for the given name in the netns dictonary.
67 static int getNetNsId(const Data& netNsName, bool shouldAdd = false);
81 // @brief construct netns device name to open for name
82 static void makeNetNsDeviceName(const Data& netNs, Data& deviceName);
92 // @brief Opens the file for the named netns
93 static int openNetNs(const Data& netNs);
103 // @brief Checks if the named netns exists
104 static bool netNsExists(const Data& netNs);
115 // @brief Find the netns name for the given netns dictionary id
116 static const Data& getNetNsName(int netNsId);
124 private:
125 // Currently this is just a container for static methods. So
126 // no reason to actually construct one of these.
127 NetNs();
128
129 NetNs(const NetNs& );
130 NetNs& operator=(const NetNs&);
131
132 static void initDictionary();
133
134 static HashMap<int, Data> sIdDictionaryToNetNs;
135 static HashMap<Data, int> sNetNsDictionaryToId;
136};
137
138}
139
140#endif
141
142/* ====================================================================
143 *
144 * Copyright (c) Daniel Petrie, SIPez LLC. All rights reserved.
145 *
146 * Redistribution and use in source and binary forms, with or without
147 * modification, are permitted provided that the following conditions
148 * are met:
149 *
150 * 1. Redistributions of source code must retain the above copyright
151 * notice, this list of conditions and the following disclaimer.
152 *
153 * 2. Redistributions in binary form must reproduce the above copyright
154 * notice, this list of conditions and the following disclaimer in
155 * the documentation and/or other materials provided with the
156 * distribution.
157 *
158 * 3. Neither the name of the author(s) nor the names of any contributors
159 * may be used to endorse or promote products derived from this software
160 * without specific prior written permission.
161 *
162 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
163 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
165 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
166 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
167 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
168 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
169 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
170 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
171 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
172 * SUCH DAMAGE.
173 *
174 * vi: set shiftwidth=3 expandtab:
175 */
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66