2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Roman Kubiak (r.kubiak@samsung.com)
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
21 * @author Roman Kubiak (r.kubiak@samsung.com)
22 * @brief Manager class implementation for nether
25 #ifndef NETHER_MANAGER_H
26 #define NETHER_MANAGER_H
28 #include "nether_Types.h"
29 #include "nether_DummyBackend.h"
30 #include "nether_Netlink.h"
33 class NetherManager : public NetherVerdictListener, public NetherProcessedPacketListener
36 NetherManager(const NetherConfig &_netherConfig);
37 ~NetherManager() noexcept(true);
40 NetherConfig &getConfig();
41 static NetherPolicyBackend *getPolicyBackend(const NetherConfig &netherConfig, const bool primary = true);
42 bool verdictCast(const u_int32_t packetId, const NetherVerdict verdict, int mark);
43 void packetReceived(const NetherPacket &packet);
47 static bool isCommandAvailable(const std::string &command);
49 bool handleNetlinkpacket();
50 void setupSelectSockets(fd_set &watchedReadDescriptorsSet, fd_set &watchedWriteDescriptorsSet, struct timeval &timeoutSpecification);
51 std::unique_ptr <NetherPolicyBackend> netherPrimaryPolicyBackend;
52 std::unique_ptr <NetherPolicyBackend> netherBackupPolicyBackend;
53 std::unique_ptr <NetherPolicyBackend> netherFallbackPolicyBackend;
54 std::unique_ptr <NetherNetlink> netherNetlink;
55 NetherConfig netherConfig;
56 int netlinkDescriptor;
57 int backendDescriptor;