Skip to content

Commit

Permalink
Polish code
Browse files Browse the repository at this point in the history
Signed-off-by: Ze Gan <[email protected]>
  • Loading branch information
Pterosaur committed Nov 19, 2020
1 parent ba7ae2c commit c21d2c9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
3 changes: 2 additions & 1 deletion vslib/inc/MACsecEgressFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace saivs
class MACsecEgressFilter : public MACsecFilter
{
public:
MACsecEgressFilter(_In_ const std::string &macsecInterfaceName);
MACsecEgressFilter(
_In_ const std::string &macsecInterfaceName);

virtual ~MACsecEgressFilter() = default;

Expand Down
11 changes: 7 additions & 4 deletions vslib/inc/MACsecFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@

namespace saivs
{
class MACsecFilter : public TrafficFilter
class MACsecFilter :
public TrafficFilter
{
public:
MACsecFilter(
_In_ const std::string &macsec_interface_name);
_In_ const std::string &macsecInterfaceName);

virtual ~MACsecFilter() = default;

virtual FilterStatus execute(
_Inout_ void *buffer,
_Inout_ ssize_t &length) override;

void enable_macsec_device(bool enable);
void enable_macsec_device(
_In_ bool enable);

void set_macsec_fd(int macsecfd);
void set_macsec_fd(
_In_ int macsecfd);

protected:
virtual FilterStatus forward(
Expand Down
6 changes: 4 additions & 2 deletions vslib/inc/MACsecIngressFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

namespace saivs
{
class MACsecIngressFilter : public MACsecFilter
class MACsecIngressFilter :
public MACsecFilter
{
public:
MACsecIngressFilter(_In_ const std::string &macsec_interface_name);
MACsecIngressFilter(
_In_ const std::string &macsecInterfaceName);

virtual ~MACsecIngressFilter() = default;

Expand Down
3 changes: 2 additions & 1 deletion vslib/src/MACsecEgressFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

using namespace saivs;

MACsecEgressFilter::MACsecEgressFilter(_In_ const std::string &macsecInterfaceName):
MACsecEgressFilter::MACsecEgressFilter(
_In_ const std::string &macsecInterfaceName):
MACsecFilter(macsecInterfaceName)
{
SWSS_LOG_ENTER();
Expand Down
14 changes: 10 additions & 4 deletions vslib/src/MACsecFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,29 @@ using namespace saivs;
#define EAPOL_ETHER_TYPE (0x888e)

MACsecFilter::MACsecFilter(
_In_ const std::string &macsec_interface_name):
_In_ const std::string &macsecInterfaceName):
m_macsec_device_enable(false),
m_macsecfd(0),
m_macsec_interface_name(macsec_interface_name)
m_macsec_interface_name(macsecInterfaceName)
{
SWSS_LOG_ENTER();

// empty intentionally
}

void MACsecFilter::enable_macsec_device(bool enable)
void MACsecFilter::enable_macsec_device(
_In_ bool enable)
{
SWSS_LOG_ENTER();

m_macsec_device_enable = enable;
}

void MACsecFilter::set_macsec_fd(int macsecfd)
void MACsecFilter::set_macsec_fd(
_In_ int macsecfd)
{
SWSS_LOG_ENTER();

m_macsecfd = macsecfd;
}

Expand Down
4 changes: 2 additions & 2 deletions vslib/src/MACsecIngressFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using namespace saivs;

MACsecIngressFilter::MACsecIngressFilter(
_In_ const std::string &macsec_interface_name) :
MACsecFilter(macsec_interface_name)
_In_ const std::string &macsecInterfaceName) :
MACsecFilter(macsecInterfaceName)
{
SWSS_LOG_ENTER();

Expand Down
5 changes: 1 addition & 4 deletions vslib/src/TrafficFilterPipes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ TrafficFilter::FilterStatus TrafficFilterPipes::execute(

if (filter)
{
ret = filter->execute(
buffer,
length);
ret = filter->execute(buffer, length);

if (ret == TrafficFilter::CONTINUE)
{
Expand All @@ -69,7 +67,6 @@ TrafficFilter::FilterStatus TrafficFilterPipes::execute(
{
itr = m_filters.erase(itr);
}

}

return ret;
Expand Down

0 comments on commit c21d2c9

Please sign in to comment.