Skip to content

Commit

Permalink
change delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
egecetin committed Aug 3, 2022
1 parent 96ffdfc commit 19da223
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Binary file modified 3rdParty/OUILookup/PCPP_OUIDatabase.dat
Binary file not shown.
15 changes: 8 additions & 7 deletions 3rdParty/OUILookup/createHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@

Lines = inFile.readlines()
count = 0
delimiter = '\0'

# Short MAC addresses
outFile.write("PCPP_SHORT_MACS\n")
outFile.write("PCPP_SHORT_MACS" + delimiter)

alreadyWritten = False
buffer = []
for line in Lines:
try:
if buffer != []:
if alreadyWritten:
outFile.write("\n")
outFile.write(delimiter)
outFile.write(buffer)
alreadyWritten = True
count += 1
Expand All @@ -36,13 +37,13 @@
continue

if buffer != []:
outFile.write("\n")
outFile.write(delimiter)
outFile.write(buffer)
count += 1
outFile.write("\n")
outFile.write(delimiter)

# Long MAC addresses (with mask)
outFile.write("PCPP_LONG_MACS\n")
outFile.write("PCPP_LONG_MACS" + delimiter)

outLines = []
maskValues = []
Expand Down Expand Up @@ -90,9 +91,9 @@

ctrIndx = 0
for mask in maskValues:
outFile.write("MASK " + mask + "\n")
outFile.write("MASK " + mask + delimiter)
for value in outLines[ctrIndx]:
outFile.write(value + "\n")
outFile.write(value + delimiter)
count += 1
ctrIndx += 1

Expand Down
3 changes: 2 additions & 1 deletion Common++/src/OUILookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace pcpp
{

#define DELIMITER '\0'
#define PCPP_SHORT_MACS 0
#define PCPP_LONG_MACS 1

Expand All @@ -31,7 +32,7 @@ int OUILookup::initOUIDatabase(const std::string &path)
// Read file
int condition = -1;
uint16_t maskValue = 0;
for (std::string line; std::getline(dataFile, line);)
for (std::string line; std::getline(dataFile, line, DELIMITER);)
{
if (!line.compare("PCPP_SHORT_MACS"))
{
Expand Down

0 comments on commit 19da223

Please sign in to comment.