Skip to content

Commit

Permalink
tune
Browse files Browse the repository at this point in the history
  • Loading branch information
tigercosmos committed Jun 19, 2024
1 parent 2bb033a commit 1f3ef6b
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ IndentPPDirectives: AfterHash
IndentWidth: 4
AllowShortBlocksOnASingleLine: Never
PointerAlignment: Left
AccessModifierOffset: -1
AccessModifierOffset: -4
AlignTrailingComments: true
AllowShortEnumsOnASingleLine: false
BreakStringLiterals: true
AlignArrayOfStructures: Left
BreakArrays: true
SpacesBeforeTrailingComments: 2
IndentAccessModifiers: false
...
24 changes: 12 additions & 12 deletions Common++/header/IpAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace pcpp
*/
class IPv4Address
{
public:
public:
/**
* A default constructor that creates an instance of the class with the zero-initialized address
*/
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace pcpp
static const IPv4Address MulticastRangeLowerBound;
static const IPv4Address MulticastRangeUpperBound;

private:
private:
std::array<uint8_t, 4> m_Bytes = {0};
}; // class IPv4Address

Expand All @@ -198,7 +198,7 @@ namespace pcpp
*/
class IPv6Address
{
public:
public:
/**
* A default constructor that creates an instance of the class with the zero-initialized address.
*/
Expand Down Expand Up @@ -348,7 +348,7 @@ namespace pcpp
*/
static const IPv6Address MulticastRangeLowerBound;

private:
private:
std::array<uint8_t, 16> m_Bytes = {0};
}; // class IPv6Address

Expand All @@ -358,7 +358,7 @@ namespace pcpp
*/
class IPAddress
{
public:
public:
/**
* An enum representing the address type: IPv4 or IPv6
*/
Expand Down Expand Up @@ -512,7 +512,7 @@ namespace pcpp
return !(*this == rhs);
}

private:
private:
uint8_t m_Type;
IPv4Address m_IPv4;
IPv6Address m_IPv6;
Expand Down Expand Up @@ -559,7 +559,7 @@ namespace pcpp
*/
class IPv4Network
{
public:
public:
/**
* A constructor that creates an instance of the class out of an address and a full prefix length,
* essentially making a network of consisting of only 1 address.
Expand Down Expand Up @@ -662,7 +662,7 @@ namespace pcpp
*/
std::string toString() const;

private:
private:
uint32_t m_NetworkPrefix;
uint32_t m_Mask;

Expand All @@ -677,7 +677,7 @@ namespace pcpp
*/
class IPv6Network
{
public:
public:
/**
* A constructor that creates an instance of the class out of an address and a full prefix length,
* essentially making a network of consisting of only 1 address.
Expand Down Expand Up @@ -780,7 +780,7 @@ namespace pcpp
*/
std::string toString() const;

private:
private:
uint8_t m_NetworkPrefix[16];
uint8_t m_Mask[16];

Expand All @@ -795,7 +795,7 @@ namespace pcpp
*/
class IPNetwork
{
public:
public:
/**
* A constructor that creates an instance of the class out of an IP address and a full prefix length,
* essentially making a network of consisting of only 1 address.
Expand Down Expand Up @@ -1086,7 +1086,7 @@ namespace pcpp
return (m_IPv4Network != nullptr ? m_IPv4Network->toString() : m_IPv6Network->toString());
}

private:
private:
std::unique_ptr<IPv4Network> m_IPv4Network;
std::unique_ptr<IPv6Network> m_IPv6Network;
};
Expand Down
6 changes: 3 additions & 3 deletions Common++/header/LRUList.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <unordered_map>
#include <list>
#include <unordered_map>

#if __cplusplus > 199711L || _MSC_VER >= 1800
# include <utility>
Expand All @@ -25,7 +25,7 @@ namespace pcpp
*/
template <typename T> class LRUList
{
public:
public:
typedef typename std::list<T>::iterator ListIterator;
typedef typename std::unordered_map<T, ListIterator>::iterator MapIterator;

Expand Down Expand Up @@ -130,7 +130,7 @@ namespace pcpp
return m_CacheItemsMap.size();
}

private:
private:
std::list<T> m_CacheItemsList;
std::unordered_map<T, ListIterator> m_CacheItemsMap;
size_t m_MaxSize;
Expand Down
4 changes: 2 additions & 2 deletions Common++/header/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace pcpp
*/
class Logger
{
public:
public:
/**
* An enum representing the log level. Currently 3 log levels are supported: Error, Info and Debug. Info is the
* default log level
Expand Down Expand Up @@ -283,7 +283,7 @@ namespace pcpp
return instance;
}

private:
private:
bool m_LogsEnabled;
Logger::LogLevel m_LogModulesArray[NumOfLogModules];
LogPrinter m_LogPrinter;
Expand Down
4 changes: 2 additions & 2 deletions Common++/header/MacAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace pcpp
*/
class MacAddress
{
public:
public:
/**
* Default constructor for this class.
* Initializes the address as 00:00:00:00:00:00.
Expand Down Expand Up @@ -169,7 +169,7 @@ namespace pcpp
*/
static MacAddress Zero;

private:
private:
uint8_t m_Address[6] = {0};
};
} // namespace pcpp
Expand Down
4 changes: 2 additions & 2 deletions Common++/header/OUILookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace pcpp
*/
class OUILookup
{
private:
private:
/**
* MAC addresses with mask values. For example for a MAC address "XX:XX:XX:XX:X0:00/36" the first element will
* be 36, and the second element will be unsigned integer equivalent of "XX:XX:XX:XX:X0:00" and vendor name.
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace pcpp

template <typename T> int64_t internalParser(T& jsonData);

public:
public:
/**
* Initialise internal OUI database from a JSON file
* @param[in] path Path to OUI database. The database itself is located at
Expand Down
4 changes: 2 additions & 2 deletions Common++/header/PointerVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace pcpp
*/
template <typename T> class PointerVector
{
public:
public:
/**
* Iterator object that is used for iterating all elements in the vector
*/
Expand Down Expand Up @@ -216,7 +216,7 @@ namespace pcpp
return m_Vector.at(index);
}

private:
private:
std::vector<T*> m_Vector;
};

Expand Down
8 changes: 4 additions & 4 deletions Common++/header/SystemUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ namespace pcpp
*/
class AppName
{
private:
private:
static std::string m_AppName;

public:
public:
/**
* Static init method which should be called once at the beginning of the main method.
* @param[in] argc The argc param from main()
Expand Down Expand Up @@ -356,7 +356,7 @@ namespace pcpp
*/
class ApplicationEventHandler
{
public:
public:
/**
* @typedef EventHandlerCallback
* The callback to be invoked when the event occurs
Expand All @@ -383,7 +383,7 @@ namespace pcpp
*/
void onApplicationInterrupted(EventHandlerCallback handler, void* cookie);

private:
private:
EventHandlerCallback m_ApplicationInterruptedHandler;
void* m_ApplicationInterruptedCookie;

Expand Down
4 changes: 2 additions & 2 deletions Common++/header/TablePrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace pcpp
*/
class TablePrinter
{
public:
public:
/**
* C'tor - get column names and column widths
* @param[in] columnNames A vector of strings containing column names
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace pcpp
*/
void closeTable();

private:
private:
std::vector<std::string> m_ColumnNames;
std::vector<int> m_ColumnWidths;
bool m_FirstRow;
Expand Down

0 comments on commit 1f3ef6b

Please sign in to comment.