summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-11-07 16:18:50 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-11-21 12:56:28 +0200
commitc9ec3b818df3dceb78c0535b6e962291d21a1619 (patch)
treef4c5edfef33d0e22399cabf04c62310178975317 /src/common
parent2afe4187586ff3b482874a52fa7e4e83b9a0eb16 (diff)
Support multi dest and src addresses in pretest
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/common')
-rwxr-xr-xsrc/common/Network/Packet/MacAddress.h11
-rwxr-xr-xsrc/common/basic_utils.cpp7
-rwxr-xr-xsrc/common/basic_utils.h1
3 files changed, 16 insertions, 3 deletions
diff --git a/src/common/Network/Packet/MacAddress.h b/src/common/Network/Packet/MacAddress.h
index 7e872fd6..2bc25333 100755
--- a/src/common/Network/Packet/MacAddress.h
+++ b/src/common/Network/Packet/MacAddress.h
@@ -29,7 +29,7 @@ public:
MacAddress()
{
- set(0xca, 0xfe, 0xde, 0xad, 0xbe, 0xef);
+ set(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
};
MacAddress(uint8_t a0,
@@ -81,12 +81,17 @@ public:
data[5]=val;
}
+ bool isDefaultAddress() const
+ {
+ static MacAddress defaultMac;
+ return (*this == defaultMac);
+ }
bool isInvalidAddress() const
{
static MacAddress allZeros(0,0,0,0,0,0);
- static MacAddress cafeDeadBeef;
- return (*this == allZeros || *this == cafeDeadBeef);
+ static MacAddress defaultMac;
+ return (*this == allZeros || *this == defaultMac);
}
void setIdentifierAsBogusAddr(uint32_t identifier)
{
diff --git a/src/common/basic_utils.cpp b/src/common/basic_utils.cpp
index f169c29f..04e7aaba 100755
--- a/src/common/basic_utils.cpp
+++ b/src/common/basic_utils.cpp
@@ -174,6 +174,13 @@ void TestDump(void){
utl_DumpBuffer2(stdout,buffer,31,1,4,SHOW_BUFFER_ADDR_EN |SHOW_BUFFER_CHAR);
}
+std::string
+utl_macaddr_to_str(const uint8_t *mac) {
+ std::string tmp;
+ utl_macaddr_to_str(mac, tmp);
+ return tmp;
+}
+
void utl_macaddr_to_str(const uint8_t *macaddr, std::string &output) {
for (int i = 0; i < 6; i++) {
diff --git a/src/common/basic_utils.h b/src/common/basic_utils.h
index f6250a2b..1079ecfc 100755
--- a/src/common/basic_utils.h
+++ b/src/common/basic_utils.h
@@ -85,6 +85,7 @@ inline void utl_swap(T& a, T& b) {
bool utl_is_file_exists (const std::string& name) ;
void utl_macaddr_to_str(const uint8_t *macaddr, std::string &output);
+std::string utl_macaddr_to_str(const uint8_t *macaddr);
std::string utl_generate_random_str(unsigned int &seed, int len);