_ZN4pcpp6Logger11getInstanceEv:
  367|  1.25k|		{
  368|  1.25k|			static Logger instance;
  369|  1.25k|			return instance;
  370|  1.25k|		}
_ZN4pcpp6Logger12suppressLogsEv:
  319|    410|		{
  320|    410|			m_LogsEnabled = false;
  321|    410|		}
_ZN4pcpp9LogSourceC2ENS_9LogModuleEPKcS3_i:
  137|    410|		    : file(file), function(function), line(line), logModule(logModule)
  138|    410|		{}
_ZN4pcpp8internal10LogContext4initENS_8LogLevelERKNS_9LogSourceE:
  187|    410|			{
  188|    410|				m_Source = source;
  189|    410|				m_Level = level;
  190|    410|				m_Stream.clear();
  191|    410|				m_Stream.str({});
  192|    410|			}
_ZNK4pcpp6Logger9shouldLogENS_8LogLevelENS_9LogModuleE:
  287|    840|		{
  288|    840|			return level != LogLevel::Off && m_LogModulesArray[module] >= level;
  ------------------
  |  Branch (288:11): [True: 840, False: 0]
  |  Branch (288:37): [True: 410, False: 430]
  ------------------
  289|    840|		}
_ZN4pcpp8internal10LogContextlsINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEERS1_RKT_:
  198|    248|			{
  199|    248|				m_Stream << value;
  200|    248|				return *this;
  201|    248|			}
_ZN4pcpp8internal10LogContextlsIA2_cEERS1_RKT_:
  198|     96|			{
  199|     96|				m_Stream << value;
  200|     96|				return *this;
  201|     96|			}
_ZN4pcpp8internal10LogContextlsIjEERS1_RKT_:
  198|     49|			{
  199|     49|				m_Stream << value;
  200|     49|				return *this;
  201|     49|			}
_ZN4pcpp8internal10LogContextlsIA31_cEERS1_RKT_:
  198|    111|			{
  199|    111|				m_Stream << value;
  200|    111|				return *this;
  201|    111|			}
_ZN4pcpp8internal10LogContextlsIA27_cEERS1_RKT_:
  198|      2|			{
  199|      2|				m_Stream << value;
  200|      2|				return *this;
  201|      2|			}
_ZN4pcpp8internal10LogContextlsIA49_cEERS1_RKT_:
  198|     51|			{
  199|     51|				m_Stream << value;
  200|     51|				return *this;
  201|     51|			}
_ZN4pcpp8internal10LogContextlsIA33_cEERS1_RKT_:
  198|     43|			{
  199|     43|				m_Stream << value;
  200|     43|				return *this;
  201|     43|			}
_ZN4pcpp8internal10LogContextlsIA59_cEERS1_RKT_:
  198|    152|			{
  199|    152|				m_Stream << value;
  200|    152|				return *this;
  201|    152|			}
_ZN4pcpp8internal10LogContextlsIA36_cEERS1_RKT_:
  198|      2|			{
  199|      2|				m_Stream << value;
  200|      2|				return *this;
  201|      2|			}
_ZN4pcpp8internal10LogContextlsIcEERS1_RKT_:
  198|    152|			{
  199|    152|				m_Stream << value;
  200|    152|				return *this;
  201|    152|			}
_ZN4pcpp8internal10LogContextlsIA15_cEERS1_RKT_:
  198|     49|			{
  199|     49|				m_Stream << value;
  200|     49|				return *this;
  201|     49|			}
_ZN4pcpp8internal10LogContextlsIA14_cEERS1_RKT_:
  198|     49|			{
  199|     49|				m_Stream << value;
  200|     49|				return *this;
  201|     49|			}
_ZN4pcpp9LogSourceC2Ev:
  124|      2|		constexpr LogSource() = default;
_ZN4pcpp8internal10LogContextC2Ev:
  175|      2|			LogContext() = default;

_ZN4pcpp10MacAddressC2Ehhhhhh:
   73|      4|		    : m_Address{ firstOctet, secondOctet, thirdOctet, fourthOctet, fifthOctet, sixthOctet }
   74|      4|		{}

_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EED2Ev:
   57|      1|			{
   58|      1|				clear();
   59|      1|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE5clearEv:
  175|      1|			{
  176|      1|				std::unique_lock<std::mutex> lock(m_Mutex);
  177|      3|				while (!m_Pool.empty())
  ------------------
  |  Branch (177:12): [True: 2, False: 1]
  ------------------
  178|      2|				{
  179|      2|					delete m_Pool.top();
  180|      2|					m_Pool.pop();
  181|      2|				}
  182|      1|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE11preallocateEm:
  158|      1|			{
  159|      1|				std::unique_lock<std::mutex> lock(m_Mutex);
  160|       |
  161|      1|				if (m_MaxPoolSize < count)
  ------------------
  |  Branch (161:9): [True: 0, False: 1]
  ------------------
  162|      0|				{
  163|      0|					throw std::invalid_argument("Preallocated objects cannot exceed the maximum pool size");
  164|      0|				}
  165|       |
  166|       |				// If the pool is already larger than the requested count, we don't need to do anything.
  167|      3|				for (std::size_t i = m_Pool.size(); i < count; i++)
  ------------------
  |  Branch (167:41): [True: 2, False: 1]
  ------------------
  168|      2|				{
  169|      2|					m_Pool.push(new T());
  170|      2|				}
  171|      1|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EEC2Emm:
   36|      1|			    : m_MaxPoolSize(maxPoolSize)
   37|      1|			{
   38|      1|				if (initialSize > maxPoolSize)
  ------------------
  |  Branch (38:9): [True: 0, False: 1]
  ------------------
   39|      0|				{
   40|      0|					throw std::invalid_argument("Preallocated objects cannot exceed the maximum pool size");
   41|      0|				}
   42|       |
   43|      1|				if (initialSize > 0)
  ------------------
  |  Branch (43:9): [True: 1, False: 0]
  ------------------
   44|      1|				{
   45|      1|					this->preallocate(initialSize);
   46|      1|				}
   47|      1|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE13acquireObjectEv:
   68|    410|			{
   69|    410|				return std::unique_ptr<T>(acquireObjectRaw());
   70|    410|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE16acquireObjectRawEv:
   79|    410|			{
   80|    410|				std::unique_lock<std::mutex> lock(m_Mutex);
   81|       |
   82|    410|				if (m_Pool.empty())
  ------------------
  |  Branch (82:9): [True: 0, False: 410]
  ------------------
   83|      0|				{
   84|       |					// We don't need the lock anymore, so release it.
   85|      0|					lock.unlock();
   86|      0|					return new T();
   87|      0|				}
   88|       |
   89|    410|				T* obj = m_Pool.top();
   90|    410|				m_Pool.pop();
   91|    410|				return obj;
   92|    410|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE13releaseObjectENSt3__110unique_ptrIS2_NS4_14default_deleteIS2_EEEE:
  101|    410|			{
  102|    410|				releaseObjectRaw(obj.release());
  103|    410|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE16releaseObjectRawEPS2_:
  112|    410|			{
  113|    410|				std::unique_lock<std::mutex> lock(m_Mutex);
  114|       |
  115|    410|				if (m_MaxPoolSize == INFINITE_POOL_SIZE || m_Pool.size() < m_MaxPoolSize)
  ------------------
  |  Branch (115:9): [True: 0, False: 410]
  |  Branch (115:48): [True: 410, False: 0]
  ------------------
  116|    410|				{
  117|    410|					m_Pool.push(obj);
  118|    410|				}
  119|      0|				else
  120|      0|				{
  121|       |					// We don't need the lock anymore, so release it.
  122|      0|					lock.unlock();
  123|      0|					delete obj;
  124|      0|				}
  125|    410|			}

_ZN4pcpp13PointerVectorINS_9RawPacketENSt3__114default_deleteIS1_EEEC2Ev:
   59|    162|		PointerVector() = default;
_ZN4pcpp13PointerVectorINS_9RawPacketENSt3__114default_deleteIS1_EEED2Ev:
   78|    162|		{
   79|    162|			freeVectorUnsafe(m_Vector);
   80|    162|		}
_ZN4pcpp13PointerVectorINS_9RawPacketENSt3__114default_deleteIS1_EEE16freeVectorUnsafeERKNS2_6vectorIPS1_NS2_9allocatorIS7_EEEE:
  362|    162|		{
  363|    162|			for (auto& obj : origin)
  ------------------
  |  Branch (363:19): [True: 106, False: 162]
  ------------------
  364|    106|			{
  365|    106|				Deleter{}(obj);
  366|    106|			}
  367|    162|		}
_ZNK4pcpp13PointerVectorINS_9RawPacketENSt3__114default_deleteIS1_EEE5frontEv:
  238|    106|		{
  239|    106|			return m_Vector.front();
  240|    106|		}
_ZN4pcpp13PointerVectorINS_9RawPacketENSt3__114default_deleteIS1_EEE8pushBackEPS1_b:
  147|    106|		{
  148|    106|			if (element == nullptr)
  ------------------
  |  Branch (148:8): [True: 0, False: 106]
  ------------------
  149|      0|			{
  150|      0|				throw std::invalid_argument("Element is nullptr");
  151|      0|			}
  152|       |
  153|    106|			try
  154|    106|			{
  155|    106|				m_Vector.push_back(element);
  156|    106|			}
  157|    106|			catch (const std::exception&)
  158|    106|			{
  159|      0|				if (freeElementOnError)
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|				{
  161|      0|					Deleter{}(element);
  162|      0|				}
  163|      0|				throw;
  164|      0|			}
  165|    106|		}

_ZN4pcpp11IPv4AddressC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   64|      4|	{
   65|      4|		if (inet_pton(AF_INET, addrAsString.data(), m_Bytes.data()) <= 0)
  ------------------
  |  Branch (65:7): [True: 0, False: 4]
  ------------------
   66|      0|		{
   67|      0|			throw std::invalid_argument("Not a valid IPv4 address: " + addrAsString);
   68|      0|		}
   69|      4|	}
_ZN4pcpp11IPv6AddressC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  133|      2|	{
  134|      2|		if (inet_pton(AF_INET6, addrAsString.data(), m_Bytes.data()) <= 0)
  ------------------
  |  Branch (134:7): [True: 0, False: 2]
  ------------------
  135|      0|		{
  136|      0|			throw std::invalid_argument("Not a valid IPv6 address: " + addrAsString);
  137|      0|		}
  138|      2|	}

_ZN4pcpp6LoggerC2Ev:
   55|      1|	Logger::Logger() : m_LogsEnabled(true), m_LogPrinter(&printToCerr)
   56|      1|	{
   57|      1|		m_LogModulesArray.fill(LogLevel::Info);
   58|      1|	}
_ZN4pcpp6Logger16createLogContextENS_8LogLevelERKNS_9LogSourceE:
   89|    410|	{
   90|    410|		if (m_UseContextPooling)
  ------------------
  |  Branch (90:7): [True: 410, False: 0]
  ------------------
   91|    410|		{
   92|    410|			auto ctx = m_LogContextPool.acquireObject();
   93|    410|			ctx->init(level, source);
   94|    410|			return ctx;
   95|    410|		}
   96|      0|		return std::make_unique<internal::LogContext>(level, source);
   97|    410|	}
_ZN4pcpp6Logger4emitENSt3__110unique_ptrINS_8internal10LogContextENS1_14default_deleteIS4_EEEE:
  100|    410|	{
  101|    410|		emit(message->m_Source, message->m_Level, message->m_Stream.str());
  102|       |		// Pushes the message back to the pool if pooling is enabled. Otherwise, the message is deleted.
  103|    410|		if (m_UseContextPooling)
  ------------------
  |  Branch (103:7): [True: 410, False: 0]
  ------------------
  104|    410|		{
  105|    410|			m_LogContextPool.releaseObject(std::move(message));
  106|    410|		}
  107|    410|	}
_ZN4pcpp6Logger4emitERKNS_9LogSourceENS_8LogLevelERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  110|    410|	{
  111|       |		// If the log level is an error, save the error to the last error message variable.
  112|    410|		if (logLevel == LogLevel::Error)
  ------------------
  |  Branch (112:7): [True: 410, False: 0]
  ------------------
  113|    410|		{
  114|    410|			static_assert(m_LastError.size() >= 1,
  115|    410|			              "Last error buffer size must be at least 1 to hold a null terminator");
  116|       |
  117|       |			// Copy the message to the last error buffer, leaving space for null terminator
  118|    410|			auto const copied = message.copy(m_LastError.data(), m_LastError.size() - 1);
  119|    410|			m_LastError[copied] = '\0';
  120|    410|		}
  121|    410|		if (m_LogsEnabled)
  ------------------
  |  Branch (121:7): [True: 0, False: 410]
  ------------------
  122|      0|		{
  123|      0|			m_LogPrinter(logLevel, message, source.file, source.function, source.line);
  124|      0|		}
  125|    410|	}

_ZN4pcpp9RawPacketC2Ev:
  312|    162|		RawPacket() = default;

_ZN4pcpp9RawPacketD2Ev:
   22|    162|	{
   23|    162|		clear();
   24|    162|	}
_ZN4pcpp9RawPacket10setRawDataEPKhib8timespecNS_13LinkLayerTypeEi:
   97|  1.26k|	{
   98|  1.26k|		return doSetRawData(pRawData, rawDataLen, takeOwnership, timestamp, layerType, frameLength);
   99|  1.26k|	}
_ZN4pcpp9RawPacket12doSetRawDataEPKhib8timespecNS_13LinkLayerTypeEi:
  103|  1.26k|	{
  104|  1.26k|		clear();
  105|       |
  106|  1.26k|		m_OwnsRawData = takeOwnership;
  107|  1.26k|		m_FrameLength = (frameLength == -1) ? rawDataLen : frameLength;
  ------------------
  |  Branch (107:19): [True: 372, False: 890]
  ------------------
  108|  1.26k|		m_RawData = (uint8_t*)pRawData;
  109|  1.26k|		m_RawDataLen = rawDataLen;
  110|  1.26k|		m_TimeStamp = timestamp;
  111|  1.26k|		m_RawPacketSet = true;
  112|  1.26k|		m_LinkLayerType = layerType;
  113|  1.26k|		return true;
  114|  1.26k|	}
_ZN4pcpp9RawPacket5clearEv:
  123|  1.42k|	{
  124|  1.42k|		if (m_RawData != nullptr && m_OwnsRawData)
  ------------------
  |  Branch (124:7): [True: 400, False: 1.02k]
  |  Branch (124:31): [True: 400, False: 0]
  ------------------
  125|    400|			delete[] m_RawData;
  126|       |
  127|  1.42k|		m_RawData = nullptr;
  128|  1.42k|		m_RawDataLen = 0;
  129|  1.42k|		m_FrameLength = 0;
  130|  1.42k|		m_RawPacketSet = false;
  131|  1.42k|	}

_ZN4pcpp17IFilterableDeviceC2Ev:
   47|    410|		IFilterableDevice() = default;
_ZN4pcpp7IDeviceC2Ev:
   23|    410|		IDevice() = default;
_ZN4pcpp7IDeviceD2Ev:
   26|    410|		virtual ~IDevice() = default;

_ZN4pcpp23IPcapStatisticsProviderD2Ev:
   27|    410|		virtual ~IPcapStatisticsProvider() = default;

_ZN4pcpp11IFileDevice21reportPacketProcessedEm:
   66|  1.26k|		{
   67|  1.26k|			m_NumOfPacketsProcessed += numPackets;
   68|  1.26k|		}
_ZN4pcpp21SnoopFileReaderDeviceC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  592|    410|		    : IFileReaderDevice(fileName), m_PcapLinkLayerType(LINKTYPE_ETHERNET)
  593|    410|		{}
_ZNK4pcpp21SnoopFileReaderDevice8isOpenedEv:
  622|  1.42k|		{
  623|  1.42k|			return m_SnoopFile.is_open();
  624|  1.42k|		}

_ZN4pcpp16BpfFilterWrapperC2Ev:
   92|    410|		BpfFilterWrapper() = default;

_ZN4pcpp11IFileDeviceC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  493|    410|	{
  494|    410|		m_FileName = fileName;
  495|    410|	}
_ZNK4pcpp11IFileDevice13getStatisticsERNS_9PcapStatsE:
  503|    162|	{
  504|    162|		PCPP_LOG_DEBUG("Statistics requested for file device for filename '" << m_FileName << "'");
  ------------------
  |  |  425|    162|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    162|	do                                                                                                                 \
  |  |  |  |  413|    162|	{                                                                                                                  \
  |  |  |  |  414|    162|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    162|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    162|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 162]
  |  |  |  |  ------------------
  |  |  |  |  416|    162|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|    162|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 162]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|    162|		stats.packetsRecv = m_NumOfPacketsProcessed;
  506|    162|		stats.packetsDrop = m_NumOfPacketsDropped;
  507|    162|		stats.packetsDropByInterface = 0;
  508|    162|	}
_ZN4pcpp11IFileDevice22resetStatisticCountersEv:
  511|    410|	{
  512|    410|		m_NumOfPacketsProcessed = 0;
  513|    410|		m_NumOfPacketsDropped = 0;
  514|    410|	}
_ZN4pcpp17IFileReaderDeviceC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  530|    410|	IFileReaderDevice::IFileReaderDevice(const std::string& fileName) : IFileDevice(fileName)
  531|    410|	{}
_ZN4pcpp17IFileReaderDevice9getReaderERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  534|    410|	{
  535|    410|		const auto extensionPos = fileName.find_last_of('.');
  536|    410|		const auto fileExtension = extensionPos != std::string::npos ? fileName.substr(extensionPos) : "";
  ------------------
  |  Branch (536:30): [True: 410, False: 0]
  ------------------
  537|       |
  538|    410|		if (fileExtension == ".pcapng" || fileExtension == ".zstd" || fileExtension == ".zst")
  ------------------
  |  Branch (538:7): [True: 0, False: 410]
  |  Branch (538:37): [True: 0, False: 410]
  |  Branch (538:65): [True: 0, False: 410]
  ------------------
  539|      0|			return new PcapNgFileReaderDevice(fileName);
  540|    410|		else if (fileExtension == ".snoop")
  ------------------
  |  Branch (540:12): [True: 410, False: 0]
  ------------------
  541|    410|			return new SnoopFileReaderDevice(fileName);
  542|       |
  543|      0|		return new PcapFileReaderDevice(fileName);
  544|    410|	}
_ZN4pcpp17IFileReaderDevice14getNextPacketsERNS_13PointerVectorINS_9RawPacketENSt3__114default_deleteIS2_EEEEi:
  605|    162|	{
  606|    162|		int numOfPacketsRead = 0;
  607|       |
  608|    268|		for (; numOfPacketsToRead < 0 || numOfPacketsRead < numOfPacketsToRead; numOfPacketsRead++)
  ------------------
  |  Branch (608:10): [True: 0, False: 268]
  |  Branch (608:36): [True: 162, False: 106]
  ------------------
  609|    162|		{
  610|    162|			RawPacket* newPacket = new RawPacket();
  611|    162|			bool packetRead = getNextPacket(*newPacket);
  612|    162|			if (packetRead)
  ------------------
  |  Branch (612:8): [True: 106, False: 56]
  ------------------
  613|    106|			{
  614|    106|				packetVec.pushBack(newPacket);
  615|    106|			}
  616|     56|			else
  617|     56|			{
  618|     56|				delete newPacket;
  619|     56|				break;
  620|     56|			}
  621|    162|		}
  622|       |
  623|    162|		return numOfPacketsRead;
  624|    162|	}
_ZN4pcpp21SnoopFileReaderDeviceD2Ev:
 1496|    410|	{
 1497|    410|		m_SnoopFile.close();
 1498|    410|	}
_ZN4pcpp21SnoopFileReaderDevice4openEv:
 1501|    410|	{
 1502|    410|		if (m_SnoopFile.is_open())
  ------------------
  |  Branch (1502:7): [True: 0, False: 410]
  ------------------
 1503|      0|		{
 1504|      0|			PCPP_LOG_ERROR("File already open");
  ------------------
  |  |  443|      0|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      0|	do                                                                                                                 \
  |  |  |  |  413|      0|	{                                                                                                                  \
  |  |  |  |  414|      0|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      0|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|      0|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1505|      0|			return false;
 1506|      0|		}
 1507|       |
 1508|    410|		resetStatisticCounters();
 1509|       |
 1510|    410|		std::ifstream snoopFile;
 1511|    410|		snoopFile.open(m_FileName.c_str(), std::ifstream::binary);
 1512|    410|		if (!snoopFile.is_open())
  ------------------
  |  Branch (1512:7): [True: 0, False: 410]
  ------------------
 1513|      0|		{
 1514|      0|			PCPP_LOG_ERROR("Cannot open snoop reader device for filename '" << m_FileName << "'");
  ------------------
  |  |  443|      0|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      0|	do                                                                                                                 \
  |  |  |  |  413|      0|	{                                                                                                                  \
  |  |  |  |  414|      0|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      0|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|      0|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1515|      0|			return false;
 1516|      0|		}
 1517|       |
 1518|    410|		snoop_file_header_t snoop_file_header;
 1519|    410|		snoopFile.read(reinterpret_cast<char*>(&snoop_file_header), sizeof(snoop_file_header_t));
 1520|    410|		if (!snoopFile)
  ------------------
  |  Branch (1520:7): [True: 2, False: 408]
  ------------------
 1521|      2|		{
 1522|      2|			PCPP_LOG_ERROR("Cannot read snoop file header for '" << m_FileName << "'");
  ------------------
  |  |  443|      2|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      2|	do                                                                                                                 \
  |  |  |  |  413|      2|	{                                                                                                                  \
  |  |  |  |  414|      2|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      2|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      2|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      2|		{                                                                                                              \
  |  |  |  |  417|      2|			auto ctx =                                                                                                 \
  |  |  |  |  418|      2|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      2|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      2|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      2|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      2|		}                                                                                                              \
  |  |  |  |  422|      2|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1523|      2|			return false;
 1524|      2|		}
 1525|       |
 1526|    408|		if (!isSnoopMagic(snoop_file_header.identification_pattern))
  ------------------
  |  Branch (1526:7): [True: 152, False: 256]
  ------------------
 1527|    152|		{
 1528|    152|			PCPP_LOG_ERROR("File content does not match snoop magic number for file: \'" << m_FileName << '\'');
  ------------------
  |  |  443|    152|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|    152|	do                                                                                                                 \
  |  |  |  |  413|    152|	{                                                                                                                  \
  |  |  |  |  414|    152|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    152|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    152|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 152, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|    152|		{                                                                                                              \
  |  |  |  |  417|    152|			auto ctx =                                                                                                 \
  |  |  |  |  418|    152|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    152|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|    152|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|    152|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|    152|		}                                                                                                              \
  |  |  |  |  422|    152|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 152]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1529|    152|			return false;
 1530|    152|		}
 1531|       |
 1532|    256|		if (be32toh(snoop_file_header.version_number) != 2)
  ------------------
  |  Branch (1532:7): [True: 51, False: 205]
  ------------------
 1533|     51|		{
 1534|     51|			PCPP_LOG_ERROR("Malformed snoop file header version number for '" << m_FileName << "'");
  ------------------
  |  |  443|     51|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|     51|	do                                                                                                                 \
  |  |  |  |  413|     51|	{                                                                                                                  \
  |  |  |  |  414|     51|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|     51|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     51|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 51, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|     51|		{                                                                                                              \
  |  |  |  |  417|     51|			auto ctx =                                                                                                 \
  |  |  |  |  418|     51|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     51|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|     51|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|     51|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|     51|		}                                                                                                              \
  |  |  |  |  422|     51|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 51]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1535|     51|			return false;
 1536|     51|		}
 1537|       |
 1538|       |		// From https://datatracker.ietf.org/doc/html/rfc1761
 1539|    205|		static const pcpp::LinkLayerType snoop_encap[] = {
 1540|    205|			LINKTYPE_ETHERNET,   /// IEEE 802.3
 1541|    205|			LINKTYPE_NULL,       /// IEEE 802.4 Token Bus
 1542|    205|			LINKTYPE_IEEE802_5,  /// IEEE 802.5
 1543|    205|			LINKTYPE_NULL,       /// IEEE 802.6 Metro Net
 1544|    205|			LINKTYPE_ETHERNET,   /// Ethernet
 1545|    205|			LINKTYPE_C_HDLC,     /// HDLC
 1546|    205|			LINKTYPE_NULL,       /// Character Synchronous, e.g. bisync
 1547|    205|			LINKTYPE_NULL,       /// IBM Channel-to-Channel
 1548|    205|			LINKTYPE_FDDI        /// FDDI
 1549|    205|		};
 1550|    205|		uint32_t datalink_type = be32toh(snoop_file_header.datalink_type);
 1551|    205|		if (datalink_type > ARRAY_SIZE(snoop_encap) - 1)
  ------------------
  |  Branch (1551:7): [True: 43, False: 162]
  ------------------
 1552|     43|		{
 1553|     43|			PCPP_LOG_ERROR("Cannot read data link type for '" << m_FileName << "'");
  ------------------
  |  |  443|     43|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|     43|	do                                                                                                                 \
  |  |  |  |  413|     43|	{                                                                                                                  \
  |  |  |  |  414|     43|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|     43|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     43|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 43, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|     43|		{                                                                                                              \
  |  |  |  |  417|     43|			auto ctx =                                                                                                 \
  |  |  |  |  418|     43|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     43|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|     43|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|     43|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|     43|		}                                                                                                              \
  |  |  |  |  422|     43|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 43]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1554|     43|			return false;
 1555|     43|		}
 1556|       |
 1557|    162|		m_SnoopFile = std::move(snoopFile);
 1558|    162|		m_PcapLinkLayerType = snoop_encap[datalink_type];
 1559|       |
 1560|    162|		constexpr uint32_t maxPacketLength = 15'000;
 1561|    162|		m_ReadBuffer.resize(maxPacketLength);
 1562|       |
 1563|    162|		PCPP_LOG_DEBUG("Successfully opened file reader device for filename '" << m_FileName << "'");
  ------------------
  |  |  425|    162|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    162|	do                                                                                                                 \
  |  |  |  |  413|    162|	{                                                                                                                  \
  |  |  |  |  414|    162|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    162|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    162|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 162]
  |  |  |  |  ------------------
  |  |  |  |  416|    162|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|    162|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 162]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1564|    162|		return true;
 1565|    205|	}
_ZN4pcpp21SnoopFileReaderDevice14readNextPacketER8timespecPhjRjS4_:
 1569|  1.42k|	{
 1570|  1.42k|		snoop_packet_header_t snoop_packet_header;
 1571|  1.42k|		m_SnoopFile.read(reinterpret_cast<char*>(&snoop_packet_header), sizeof(snoop_packet_header_t));
 1572|  1.42k|		if (!m_SnoopFile)
  ------------------
  |  Branch (1572:7): [True: 111, False: 1.31k]
  ------------------
 1573|    111|		{
 1574|    111|			PCPP_LOG_ERROR("Failed to read packet metadata");
  ------------------
  |  |  443|    111|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|    111|	do                                                                                                                 \
  |  |  |  |  413|    111|	{                                                                                                                  \
  |  |  |  |  414|    111|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    111|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    111|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 111, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|    111|		{                                                                                                              \
  |  |  |  |  417|    111|			auto ctx =                                                                                                 \
  |  |  |  |  418|    111|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    111|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|    111|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|    111|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|    111|		}                                                                                                              \
  |  |  |  |  422|    111|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 111]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1575|    111|			return false;
 1576|    111|		}
 1577|       |
 1578|  1.31k|		capturedLength = be32toh(snoop_packet_header.included_length);
 1579|  1.31k|		if (capturedLength > packetDataLen)
  ------------------
  |  Branch (1579:7): [True: 49, False: 1.26k]
  ------------------
 1580|     49|		{
 1581|     49|			PCPP_LOG_ERROR("Packet length " << capturedLength << " is too large");
  ------------------
  |  |  443|     49|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|     49|	do                                                                                                                 \
  |  |  |  |  413|     49|	{                                                                                                                  \
  |  |  |  |  414|     49|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|     49|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     49|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 49, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|     49|		{                                                                                                              \
  |  |  |  |  417|     49|			auto ctx =                                                                                                 \
  |  |  |  |  418|     49|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     49|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|     49|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|     49|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|     49|		}                                                                                                              \
  |  |  |  |  422|     49|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1582|     49|			return false;
 1583|     49|		}
 1584|       |
 1585|  1.26k|		m_SnoopFile.read(reinterpret_cast<char*>(packetData), capturedLength);
 1586|  1.26k|		if (!m_SnoopFile)
  ------------------
  |  Branch (1586:7): [True: 2, False: 1.26k]
  ------------------
 1587|      2|		{
 1588|      2|			PCPP_LOG_ERROR("Failed to read packet data");
  ------------------
  |  |  443|      2|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      2|	do                                                                                                                 \
  |  |  |  |  413|      2|	{                                                                                                                  \
  |  |  |  |  414|      2|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      2|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      2|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      2|		{                                                                                                              \
  |  |  |  |  417|      2|			auto ctx =                                                                                                 \
  |  |  |  |  418|      2|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      2|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      2|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      2|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      2|		}                                                                                                              \
  |  |  |  |  422|      2|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1589|      2|			return false;
 1590|      2|		}
 1591|       |
 1592|  1.26k|		packetTimestamp = { static_cast<time_t>(be32toh(snoop_packet_header.time_sec)),
 1593|  1.26k|			                static_cast<long>(be32toh(snoop_packet_header.time_usec)) * 1000 };
 1594|       |
 1595|  1.26k|		frameLength = be32toh(snoop_packet_header.original_length);
 1596|       |
 1597|  1.26k|		auto pad = be32toh(snoop_packet_header.packet_record_length) -
 1598|  1.26k|		           (sizeof(snoop_packet_header_t) + be32toh(snoop_packet_header.included_length));
 1599|       |
 1600|  1.26k|		m_SnoopFile.ignore(pad);
 1601|       |
 1602|  1.26k|		return true;
 1603|  1.26k|	}
_ZN4pcpp21SnoopFileReaderDevice13getNextPacketERNS_9RawPacketE:
 1606|  1.42k|	{
 1607|  1.42k|		if (!isOpened())
  ------------------
  |  Branch (1607:7): [True: 0, False: 1.42k]
  ------------------
 1608|      0|		{
 1609|      0|			PCPP_LOG_ERROR("File device not open");
  ------------------
  |  |  443|      0|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      0|	do                                                                                                                 \
  |  |  |  |  413|      0|	{                                                                                                                  \
  |  |  |  |  414|      0|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      0|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|      0|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1610|      0|			return false;
 1611|      0|		}
 1612|       |
 1613|  1.42k|		timespec packetTimestamp{};
 1614|  1.42k|		uint32_t capturedLength = 0, frameLength = 0;
 1615|       |
 1616|  1.42k|		while (readNextPacket(packetTimestamp, m_ReadBuffer.data(), m_ReadBuffer.size(), capturedLength, frameLength))
  ------------------
  |  Branch (1616:10): [True: 1.26k, False: 162]
  ------------------
 1617|  1.26k|		{
 1618|  1.26k|			if (m_BpfWrapper.matches(m_ReadBuffer.data(), capturedLength, packetTimestamp, m_PcapLinkLayerType))
  ------------------
  |  Branch (1618:8): [True: 1.26k, False: 0]
  ------------------
 1619|  1.26k|			{
 1620|  1.26k|				auto packetData = std::make_unique<uint8_t[]>(capturedLength);
 1621|  1.26k|				std::copy(m_ReadBuffer.begin(), m_ReadBuffer.begin() + capturedLength, packetData.get());
 1622|       |
 1623|  1.26k|				rawPacket.setRawData(capturedLength > 0 ? packetData.release() : nullptr, capturedLength, true,
  ------------------
  |  Branch (1623:26): [True: 400, False: 862]
  ------------------
 1624|  1.26k|				                     packetTimestamp, m_PcapLinkLayerType, frameLength);
 1625|  1.26k|				reportPacketProcessed();
 1626|  1.26k|				return true;
 1627|  1.26k|			}
 1628|      0|			PCPP_LOG_DEBUG("Packet doesn't match filter");
  ------------------
  |  |  425|      0|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|      0|	do                                                                                                                 \
  |  |  |  |  413|      0|	{                                                                                                                  \
  |  |  |  |  414|      0|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      0|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|      0|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1629|      0|		}
 1630|       |
 1631|    162|		return false;
 1632|  1.42k|	}
_ZN4pcpp21SnoopFileReaderDevice5closeEv:
 1635|    106|	{
 1636|    106|		m_SnoopFile.close();
 1637|    106|		PCPP_LOG_DEBUG("File reader closed for file '" << m_FileName << "'");
  ------------------
  |  |  425|    106|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    106|	do                                                                                                                 \
  |  |  |  |  413|    106|	{                                                                                                                  \
  |  |  |  |  414|    106|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    106|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    106|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 106]
  |  |  |  |  ------------------
  |  |  |  |  416|    106|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|      0|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|    106|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 106]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1638|    106|	}
PcapFileDevice.cpp:_ZN4pcpp12_GLOBAL__N_112isSnoopMagicEmPNS0_13FileByteOrderE:
  344|    408|		{
  345|    408|			constexpr std::array<uint64_t, 2> snoopMagicNumbers = {
  346|    408|				0x73'6E'6F'6F'70'00'00'00,  // snoop magic number, "snoop" in ASCII
  347|    408|				0x00'00'00'70'6F'6F'6E'73   // snoop magic number, "snoop" in ASCII (byte-swapped)
  348|    408|			};
  349|       |
  350|    408|			auto it = std::find(snoopMagicNumbers.begin(), snoopMagicNumbers.end(), magic);
  351|    408|			if (it == snoopMagicNumbers.end())
  ------------------
  |  Branch (351:8): [True: 152, False: 256]
  ------------------
  352|    152|			{
  353|    152|				return false;
  354|    152|			}
  355|       |
  356|    256|			if (byteOrder != nullptr)
  ------------------
  |  Branch (356:8): [True: 0, False: 256]
  ------------------
  357|      0|			{
  358|      0|				*byteOrder = (std::distance(snoopMagicNumbers.begin(), it) % 2 == 0) ? FileByteOrder::Native
  ------------------
  |  Branch (358:18): [True: 0, False: 0]
  ------------------
  359|      0|				                                                                     : FileByteOrder::Swapped;
  360|      0|			}
  361|       |
  362|    256|			return true;
  363|    408|		}
PcapFileDevice.cpp:_ZN4pcpp12_GLOBAL__N_110ARRAY_SIZEIKNS_13LinkLayerTypeELm9EEEmRAT0__T_:
   47|    205|		{
   48|    205|			return N;
   49|    205|		}

_ZNK4pcpp16BpfFilterWrapper7matchesEPKhj8timespect:
  104|  1.26k|	{
  105|  1.26k|		if (m_FilterStr.empty())
  ------------------
  |  Branch (105:7): [True: 1.26k, False: 0]
  ------------------
  106|  1.26k|			return true;
  107|       |
  108|      0|#ifdef USE_PCAP
  109|       |		// Handle uncompiled program or link type mismatch
  110|      0|		if (m_CachedProgram == nullptr || linkType != static_cast<uint16_t>(m_CachedProgramLinkType))
  ------------------
  |  Branch (110:7): [True: 0, False: 0]
  |  Branch (110:37): [True: 0, False: 0]
  ------------------
  111|      0|		{
  112|      0|			auto newProgram = compileFilter(m_FilterStr, static_cast<LinkLayerType>(linkType));
  113|      0|			if (newProgram == nullptr)
  ------------------
  |  Branch (113:8): [True: 0, False: 0]
  ------------------
  114|      0|			{
  115|      0|				PCPP_LOG_ERROR("Couldn't compile BPF filter: '" << m_FilterStr << "' for link type: " << linkType);
  ------------------
  |  |  443|      0|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|      0|	do                                                                                                                 \
  |  |  |  |  413|      0|	{                                                                                                                  \
  |  |  |  |  414|      0|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|      0|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    1|      0|#define LOG_MODULE PcapLogModuleLiveDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|		{                                                                                                              \
  |  |  |  |  417|      0|			auto ctx =                                                                                                 \
  |  |  |  |  418|      0|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    1|      0|#define LOG_MODULE PcapLogModuleLiveDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|      0|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|      0|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|      0|		}                                                                                                              \
  |  |  |  |  422|      0|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|      0|				return false;
  117|      0|			}
  118|      0|			m_CachedProgram = std::move(newProgram);
  119|      0|			m_CachedProgramLinkType = static_cast<LinkLayerType>(linkType);
  120|      0|		}
  121|       |
  122|       |		// Test the packet against the filter
  123|      0|		pcap_pkthdr pktHdr;
  124|      0|		pktHdr.caplen = packetDataLength;
  125|      0|		pktHdr.len = packetDataLength;
  126|      0|		pktHdr.ts = internal::toTimeval(timestamp);
  127|      0|		return (pcap_offline_filter(m_CachedProgram.get(), &pktHdr, packetData) != 0);
  128|       |#else
  129|       |		PCPP_LOG_ERROR("pcap is not available");
  130|       |		return false;
  131|       |#endif
  132|      0|	}

FuzzTarget.cpp:_ZL18dumpDataToPcapFilePKhmPKc:
    8|    410|{
    9|    410|	FILE* fd;
   10|    410|	int written = 0;
   11|       |
   12|    410|	fd = fopen(path, "wb");
   13|    410|	if (fd == nullptr)
  ------------------
  |  Branch (13:6): [True: 0, False: 410]
  ------------------
   14|      0|	{
   15|      0|		std::cerr << "Error opening pcap file for writing\n";
   16|      0|		return -1;
   17|      0|	}
   18|       |
   19|    410|	written = fwrite(data, 1, size, fd);
   20|    410|	if (static_cast<size_t>(written) != size)
  ------------------
  |  Branch (20:6): [True: 0, False: 410]
  ------------------
   21|      0|	{
   22|      0|		std::cerr << "Error writing pcap file\n";
   23|      0|		fclose(fd);
   24|      0|		return -1;
   25|      0|	}
   26|       |
   27|    410|	fclose(fd);
   28|    410|	return 0;
   29|    410|}

LLVMFuzzerTestOneInput:
   11|    410|{
   12|    410|	if (tmpName.empty())
  ------------------
  |  Branch (12:6): [True: 1, False: 409]
  ------------------
   13|      1|		tmpName = tmpnam(nullptr);
   14|       |
   15|    410|	if (tmpFile.empty())
  ------------------
  |  Branch (15:6): [True: 1, False: 409]
  ------------------
   16|      1|		tmpFile = tmpName + FILE_EXT;
   17|       |
   18|    410|	if (dumpDataToPcapFile(data, size, tmpFile.c_str()) != 0)
  ------------------
  |  Branch (18:6): [True: 0, False: 410]
  ------------------
   19|      0|	{
   20|      0|		std::cerr << "Can't Dump buffer to the '" << tmpFile << "' file!!!!\n";
   21|      0|		return -1;
   22|      0|	}
   23|       |
   24|    410|	pcpp::Logger::getInstance().suppressLogs();
   25|       |
   26|    410|	std::unique_ptr<pcpp::IFileReaderDevice> reader(pcpp::IFileReaderDevice::getReader(tmpFile));
   27|    410|	if (!reader->open())
  ------------------
  |  Branch (27:6): [True: 248, False: 162]
  ------------------
   28|    248|	{
   29|    248|		std::cerr << "Error opening the '" << tmpFile << "' file\n";
   30|    248|		return -1;
   31|    248|	}
   32|       |
   33|    162|	pcpp::PcapStats stats;
   34|    162|	reader->getStatistics(stats);
   35|    162|	std::cout << "Read " << stats.packetsRecv << " packets successfully and " << stats.packetsDrop
   36|    162|	          << " packets could not be read" << std::endl;
   37|       |
   38|    162|	if (auto ngReader = dynamic_cast<pcpp::PcapNgFileReaderDevice*>(reader.get()))
  ------------------
  |  Branch (38:11): [True: 0, False: 162]
  ------------------
   39|      0|	{
   40|      0|		std::cout << "OS is '" << ngReader->getOS() << "'; Hardware is '" << ngReader->getHardware() << "'"
   41|      0|		          << "'; CaptureApplication is '" << ngReader->getCaptureApplication() << "'; CaptureFileComment is '"
   42|      0|		          << ngReader->getCaptureFileComment() << "'" << std::endl;
   43|      0|	}
   44|       |
   45|    162|	pcpp::RawPacketVector packets;
   46|    162|	if (reader->getNextPackets(packets, 1) != 1)
  ------------------
  |  Branch (46:6): [True: 56, False: 106]
  ------------------
   47|     56|	{
   48|     56|		std::cerr << "Couldn't read the first packet in the file\n";
   49|     56|		return 0;
   50|     56|	}
   51|       |
   52|    106|	pcpp::RawPacket& rawPacket = *packets.front();
   53|    106|	do
   54|  1.26k|	{
   55|       |		// go deeper only for .pcap and .pcapng format
   56|       |		// for .snoop we are only fuzzing the reader
   57|  1.26k|		if (0 == strcmp(FILE_EXT, ".pcap") || 0 == strcmp(FILE_EXT, ".pcapng"))
  ------------------
  |  Branch (57:7): [Folded, False: 0]
  |  Branch (57:41): [Folded, False: 0]
  ------------------
   58|      0|		{
   59|      0|			pcpp::Packet parsedPacket(&rawPacket);
   60|      0|			parsedPacket.toString();
   61|      0|			auto layer = parsedPacket.getFirstLayer();
   62|      0|			while (layer != nullptr)
  ------------------
  |  Branch (62:11): [True: 0, False: 0]
  ------------------
   63|      0|			{
   64|      0|				std::cout << layer->toString() << std::endl;
   65|      0|				layer->getHeaderLen();
   66|      0|				readParsedPacket(parsedPacket, layer);
   67|      0|				layer = layer->getNextLayer();
   68|      0|			}
   69|      0|			parsedPacket.computeCalculateFields();
   70|      0|		}
   71|  1.26k|	} while (reader->getNextPacket(rawPacket));
  ------------------
  |  Branch (71:11): [True: 1.15k, False: 106]
  ------------------
   72|       |
   73|    106|	reader->close();
   74|    106|	return 0;
   75|    162|}

