softwarecontainer  0.18.0-739e8d7 2017-05-04
networkgatewayparser.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 "softwarecontainer-common.h"
23 #include "iptableentry.h"
24 #include "jsonparser.h"
25 
26 namespace softwarecontainer {
27 
29 {
30  LOG_DECLARE_CLASS_CONTEXT("NETP", "Network Gateway Parser");
31 public :
40  bool parseNetworkGatewayConfiguration(const json_t *element, IPTableEntry &e);
41 
42 private :
48  bool parseRule(const json_t *element, std::vector<IPTableEntry::Rule> &rules);
49 
55  bool parsePort(const json_t *element, IPTableEntry::portFilter &ports);
56 
60  bool isProtocolValid(std::string protocol);
61 
67  bool parseProtocol(const json_t *element, std::vector<std::string> &proto);
68 
73  IPTableEntry::Target parseTarget(const std::string &str);
74 
75 };
76 
77 } // namespace softwarecontainer
Target
Targets for Rules.
Definition: iptableentry.h:51
bool parseNetworkGatewayConfiguration(const json_t *element, IPTableEntry &e)
Parses NetworkGateway configuration into IPTableEntry.
container for port filtering options.
Definition: iptableentry.h:37
Developers guide to adding a config item:
A rules entry for the treatment of packets.
Definition: iptableentry.h:29