1818#include " Firewall_dp.h"
1919
2020Firewall::Firewall (const std::string name, const FirewallJsonObject &conf)
21- : TransparentCube(conf.getBase(), {firewall_code}, {firewall_code}) {
21+ : TransparentCube(conf.getBase(), {firewall_code}, {firewall_code}), FirewallBase(name) {
2222 logger ()->set_pattern (" [%Y-%m-%d %H:%M:%S.%e] [Firewall] [%n] [%l] %v" );
2323 logger ()->info (" Creating Firewall instance" );
2424
@@ -95,50 +95,6 @@ Firewall::~Firewall() {
9595 TransparentCube::dismount ();
9696}
9797
98- void Firewall::update (const FirewallJsonObject &conf) {
99- // This method updates all the object/parameter in Firewall object specified
100- // in the conf JsonObject.
101- TransparentCube::set_conf (conf.getBase ());
102-
103- if (conf.chainIsSet ()) {
104- for (auto &i : conf.getChain ()) {
105- auto name = i.getName ();
106- auto m = getChain (name);
107- m->update (i);
108- }
109- }
110-
111- if (conf.acceptEstablishedIsSet ()) {
112- setAcceptEstablished (conf.getAcceptEstablished ());
113- }
114-
115- if (conf.conntrackIsSet ()) {
116- setConntrack (conf.getConntrack ());
117- }
118-
119- if (conf.interactiveIsSet ()) {
120- setInteractive (conf.getInteractive ());
121- }
122- }
123-
124- FirewallJsonObject Firewall::toJsonObject () {
125- FirewallJsonObject conf;
126- conf.setBase (TransparentCube::to_json ());
127-
128- // Remove comments when you implement all sub-methods
129- for (auto &i : getChainList ()) {
130- conf.addChain (i->toJsonObject ());
131- }
132-
133- conf.setConntrack (getConntrack ());
134-
135- conf.setAcceptEstablished (getAcceptEstablished ());
136-
137- conf.setInteractive (getInteractive ());
138-
139- return conf;
140- }
141-
14298void Firewall::packet_in (polycube::service::Sense sense,
14399 polycube::service::PacketInMetadata &md,
144100 const std::vector<uint8_t > &packet) {
@@ -361,24 +317,10 @@ void Firewall::addChain(const ChainNameEnum &name,
361317 std::forward_as_tuple (*this , namedChain));
362318}
363319
364- void Firewall::addChainList (const std::vector<ChainJsonObject> &conf) {
365- for (auto &i : conf) {
366- ChainNameEnum name_ = i.getName ();
367- addChain (name_, i);
368- }
369- }
370-
371- void Firewall::replaceChain (const ChainNameEnum &name,
372- const ChainJsonObject &conf) {
373- delChain (name);
374- ChainNameEnum name_ = conf.getName ();
375- addChain (name_, conf);
376- }
377-
378320void Firewall::delChain (const ChainNameEnum &name) {
379321 throw std::runtime_error (" Method not supported." );
380322}
381323
382324void Firewall::delChainList () {
383325 throw std::runtime_error (" Method not supported." );
384- }
326+ }
0 commit comments