Skip to content

Commit 7e5502d

Browse files
committed
pcn-firewall: use default methods in /base when possible
this avoids code duplication and files to become too big Signed-off-by: Matteo Bertrone <m.bertrone@gmail.com>
1 parent e75d2d8 commit 7e5502d

6 files changed

Lines changed: 0 additions & 33 deletions

File tree

src/services/pcn-firewall/src/Chain.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,6 @@ void Chain::update(const ChainJsonObject &conf) {
5252
}
5353
}
5454

55-
ChainJsonObject Chain::toJsonObject() {
56-
ChainJsonObject conf;
57-
58-
conf.setDefault(getDefault());
59-
60-
for (auto &i : getStatsList()) {
61-
conf.addChainStats(i->toJsonObject());
62-
}
63-
64-
conf.setName(getName());
65-
for (auto &i : getRuleList()) {
66-
conf.addChainRule(i->toJsonObject());
67-
}
68-
69-
return conf;
70-
}
71-
7255
ActionEnum Chain::getDefault() {
7356
// This method retrieves the default value.
7457
return this->defaultAction;
@@ -200,10 +183,6 @@ ChainApplyRulesOutputJsonObject Chain::applyRules() {
200183
return result;
201184
}
202185

203-
std::shared_ptr<spdlog::logger> Chain::logger() {
204-
return parent_.logger();
205-
}
206-
207186
uint32_t Chain::getNrRules() {
208187
return rules_.size();
209188
}

src/services/pcn-firewall/src/Chain.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class Chain : public ChainBase {
4040
Chain(Firewall &parent, const ChainJsonObject &conf);
4141
virtual ~Chain();
4242

43-
std::shared_ptr<spdlog::logger> logger();
4443
void update(const ChainJsonObject &conf) override;
45-
ChainJsonObject toJsonObject() override;
4644

4745
/// <summary>
4846
/// Default action if no rule matches in the ingress chain. Default is DROP.

src/services/pcn-firewall/src/ChainRule.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,3 @@ uint32_t ChainRule::getId() {
194194
// This method retrieves the id value.
195195
return id;
196196
}
197-
198-
std::shared_ptr<spdlog::logger> ChainRule::logger() {
199-
return parent_.logger();
200-
}

src/services/pcn-firewall/src/ChainRule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class ChainRule : public ChainRuleBase {
3232
ChainRule(Chain &parent, const ChainRuleJsonObject &conf);
3333
virtual ~ChainRule();
3434

35-
std::shared_ptr<spdlog::logger> logger();
3635
void update(const ChainRuleJsonObject &conf) override;
3736
ChainRuleJsonObject toJsonObject() override;
3837

src/services/pcn-firewall/src/ChainStats.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,3 @@ uint16_t ChainStats::getSport() {
229229
uint32_t ChainStats::getId() {
230230
return counter.getId();
231231
}
232-
233-
std::shared_ptr<spdlog::logger> ChainStats::logger() {
234-
return parent_.logger();
235-
}

src/services/pcn-firewall/src/ChainStats.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ChainStats : public ChainStatsBase {
3030
ChainStats(Chain &parent, const ChainStatsJsonObject &conf);
3131
virtual ~ChainStats();
3232

33-
std::shared_ptr<spdlog::logger> logger();
3433
void update(const ChainStatsJsonObject &conf) override;
3534
ChainStatsJsonObject toJsonObject() override;
3635

0 commit comments

Comments
 (0)