_ZN4pcpp6Logger11getInstanceEv:
  367|  1.23k|		{
  368|  1.23k|			static Logger instance;
  369|  1.23k|			return instance;
  370|  1.23k|		}
_ZN4pcpp6Logger12suppressLogsEv:
  319|    409|		{
  320|    409|			m_LogsEnabled = false;
  321|    409|		}
_ZN4pcpp9LogSourceC2ENS_9LogModuleEPKcS3_i:
  137|    409|		    : file(file), function(function), line(line), logModule(logModule)
  138|    409|		{}
_ZN4pcpp8internal10LogContext4initENS_8LogLevelERKNS_9LogSourceE:
  187|    409|			{
  188|    409|				m_Source = source;
  189|    409|				m_Level = level;
  190|    409|				m_Stream.clear();
  191|    409|				m_Stream.str({});
  192|    409|			}
_ZNK4pcpp6Logger9shouldLogENS_8LogLevelENS_9LogModuleE:
  287|    828|		{
  288|    828|			return level != LogLevel::Off && m_LogModulesArray[module] >= level;
  ------------------
  |  Branch (288:11): [True: 828, False: 0]
  |  Branch (288:37): [True: 409, False: 419]
  ------------------
  289|    828|		}
_ZN4pcpp8internal10LogContextlsINSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEERS1_RKT_:
  198|    251|			{
  199|    251|				m_Stream << value;
  200|    251|				return *this;
  201|    251|			}
_ZN4pcpp8internal10LogContextlsIA2_cEERS1_RKT_:
  198|     93|			{
  199|     93|				m_Stream << value;
  200|     93|				return *this;
  201|     93|			}
_ZN4pcpp8internal10LogContextlsIjEERS1_RKT_:
  198|     48|			{
  199|     48|				m_Stream << value;
  200|     48|				return *this;
  201|     48|			}
_ZN4pcpp8internal10LogContextlsIA31_cEERS1_RKT_:
  198|    108|			{
  199|    108|				m_Stream << value;
  200|    108|				return *this;
  201|    108|			}
_ZN4pcpp8internal10LogContextlsIA27_cEERS1_RKT_:
  198|      2|			{
  199|      2|				m_Stream << value;
  200|      2|				return *this;
  201|      2|			}
_ZN4pcpp8internal10LogContextlsIA49_cEERS1_RKT_:
  198|     48|			{
  199|     48|				m_Stream << value;
  200|     48|				return *this;
  201|     48|			}
_ZN4pcpp8internal10LogContextlsIA33_cEERS1_RKT_:
  198|     43|			{
  199|     43|				m_Stream << value;
  200|     43|				return *this;
  201|     43|			}
_ZN4pcpp8internal10LogContextlsIA59_cEERS1_RKT_:
  198|    158|			{
  199|    158|				m_Stream << value;
  200|    158|				return *this;
  201|    158|			}
_ZN4pcpp8internal10LogContextlsIA36_cEERS1_RKT_:
  198|      2|			{
  199|      2|				m_Stream << value;
  200|      2|				return *this;
  201|      2|			}
_ZN4pcpp8internal10LogContextlsIcEERS1_RKT_:
  198|    158|			{
  199|    158|				m_Stream << value;
  200|    158|				return *this;
  201|    158|			}
_ZN4pcpp8internal10LogContextlsIA15_cEERS1_RKT_:
  198|     48|			{
  199|     48|				m_Stream << value;
  200|     48|				return *this;
  201|     48|			}
_ZN4pcpp8internal10LogContextlsIA14_cEERS1_RKT_:
  198|     48|			{
  199|     48|				m_Stream << value;
  200|     48|				return *this;
  201|     48|			}
_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|    409|			{
   69|    409|				return std::unique_ptr<T>(acquireObjectRaw());
   70|    409|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE16acquireObjectRawEv:
   79|    409|			{
   80|    409|				std::unique_lock<std::mutex> lock(m_Mutex);
   81|       |
   82|    409|				if (m_Pool.empty())
  ------------------
  |  Branch (82:9): [True: 0, False: 409]
  ------------------
   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|    409|				T* obj = m_Pool.top();
   90|    409|				m_Pool.pop();
   91|    409|				return obj;
   92|    409|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE13releaseObjectENSt3__110unique_ptrIS2_NS4_14default_deleteIS2_EEEE:
  101|    409|			{
  102|    409|				releaseObjectRaw(obj.release());
  103|    409|			}
_ZN4pcpp8internal17DynamicObjectPoolINS0_10LogContextELb1EE16releaseObjectRawEPS2_:
  112|    409|			{
  113|    409|				std::unique_lock<std::mutex> lock(m_Mutex);
  114|       |
  115|    409|				if (m_MaxPoolSize == INFINITE_POOL_SIZE || m_Pool.size() < m_MaxPoolSize)
  ------------------
  |  Branch (115:9): [True: 0, False: 409]
  |  Branch (115:48): [True: 409, False: 0]
  ------------------
  116|    409|				{
  117|    409|					m_Pool.push(obj);
  118|    409|				}
  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|    409|			}

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

_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|    409|	{
   90|    409|		if (m_UseContextPooling)
  ------------------
  |  Branch (90:7): [True: 409, False: 0]
  ------------------
   91|    409|		{
   92|    409|			auto ctx = m_LogContextPool.acquireObject();
   93|    409|			ctx->init(level, source);
   94|    409|			return ctx;
   95|    409|		}
   96|      0|		return std::make_unique<internal::LogContext>(level, source);
   97|    409|	}
_ZN4pcpp6Logger4emitENSt3__110unique_ptrINS_8internal10LogContextENS1_14default_deleteIS4_EEEE:
  100|    409|	{
  101|    409|		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|    409|		if (m_UseContextPooling)
  ------------------
  |  Branch (103:7): [True: 409, False: 0]
  ------------------
  104|    409|		{
  105|    409|			m_LogContextPool.releaseObject(std::move(message));
  106|    409|		}
  107|    409|	}
_ZN4pcpp6Logger4emitERKNS_9LogSourceENS_8LogLevelERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  110|    409|	{
  111|       |		// If the log level is an error, save the error to the last error message variable.
  112|    409|		if (logLevel == LogLevel::Error)
  ------------------
  |  Branch (112:7): [True: 409, False: 0]
  ------------------
  113|    409|		{
  114|    409|			static_assert(m_LastError.size() >= 1,
  115|    409|			              "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|    409|			auto const copied = message.copy(m_LastError.data(), m_LastError.size() - 1);
  119|    409|			m_LastError[copied] = '\0';
  120|    409|		}
  121|    409|		if (m_LogsEnabled)
  ------------------
  |  Branch (121:7): [True: 0, False: 409]
  ------------------
  122|      0|		{
  123|      0|			m_LogPrinter(logLevel, message, source.file, source.function, source.line);
  124|      0|		}
  125|    409|	}

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

_ZN4pcpp9RawPacketD2Ev:
   22|    158|	{
   23|    158|		clear();
   24|    158|	}
_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: 322, False: 945]
  ------------------
  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|    409|		IFilterableDevice() = default;
_ZN4pcpp7IDeviceC2Ev:
   23|    409|		IDevice() = default;
_ZN4pcpp7IDeviceD2Ev:
   26|    409|		virtual ~IDevice() = default;

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

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

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

_ZN4pcpp11IFileDeviceC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  493|    409|	{
  494|    409|		m_FileName = fileName;
  495|    409|	}
_ZNK4pcpp11IFileDevice13getStatisticsERNS_9PcapStatsE:
  503|    158|	{
  504|    158|		PCPP_LOG_DEBUG("Statistics requested for file device for filename '" << m_FileName << "'");
  ------------------
  |  |  425|    158|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    158|	do                                                                                                                 \
  |  |  |  |  413|    158|	{                                                                                                                  \
  |  |  |  |  414|    158|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    158|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    158|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 158]
  |  |  |  |  ------------------
  |  |  |  |  416|    158|		{                                                                                                              \
  |  |  |  |  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|    158|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 158]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  505|    158|		stats.packetsRecv = m_NumOfPacketsProcessed;
  506|    158|		stats.packetsDrop = m_NumOfPacketsDropped;
  507|    158|		stats.packetsDropByInterface = 0;
  508|    158|	}
_ZN4pcpp11IFileDevice22resetStatisticCountersEv:
  511|    409|	{
  512|    409|		m_NumOfPacketsProcessed = 0;
  513|    409|		m_NumOfPacketsDropped = 0;
  514|    409|	}
_ZN4pcpp17IFileReaderDeviceC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  530|    409|	IFileReaderDevice::IFileReaderDevice(const std::string& fileName) : IFileDevice(fileName)
  531|    409|	{}
_ZN4pcpp17IFileReaderDevice9getReaderERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  534|    409|	{
  535|    409|		const auto extensionPos = fileName.find_last_of('.');
  536|    409|		const auto fileExtension = extensionPos != std::string::npos ? fileName.substr(extensionPos) : "";
  ------------------
  |  Branch (536:30): [True: 409, False: 0]
  ------------------
  537|       |
  538|    409|		if (fileExtension == ".pcapng" || fileExtension == ".zstd" || fileExtension == ".zst")
  ------------------
  |  Branch (538:7): [True: 0, False: 409]
  |  Branch (538:37): [True: 0, False: 409]
  |  Branch (538:65): [True: 0, False: 409]
  ------------------
  539|      0|			return new PcapNgFileReaderDevice(fileName);
  540|    409|		else if (fileExtension == ".snoop")
  ------------------
  |  Branch (540:12): [True: 409, False: 0]
  ------------------
  541|    409|			return new SnoopFileReaderDevice(fileName);
  542|       |
  543|      0|		return new PcapFileReaderDevice(fileName);
  544|    409|	}
_ZN4pcpp17IFileReaderDevice14getNextPacketsERNS_13PointerVectorINS_9RawPacketENSt3__114default_deleteIS2_EEEEi:
  605|    158|	{
  606|    158|		int numOfPacketsRead = 0;
  607|       |
  608|    261|		for (; numOfPacketsToRead < 0 || numOfPacketsRead < numOfPacketsToRead; numOfPacketsRead++)
  ------------------
  |  Branch (608:10): [True: 0, False: 261]
  |  Branch (608:36): [True: 158, False: 103]
  ------------------
  609|    158|		{
  610|    158|			RawPacket* newPacket = new RawPacket();
  611|    158|			bool packetRead = getNextPacket(*newPacket);
  612|    158|			if (packetRead)
  ------------------
  |  Branch (612:8): [True: 103, False: 55]
  ------------------
  613|    103|			{
  614|    103|				packetVec.pushBack(newPacket);
  615|    103|			}
  616|     55|			else
  617|     55|			{
  618|     55|				delete newPacket;
  619|     55|				break;
  620|     55|			}
  621|    158|		}
  622|       |
  623|    158|		return numOfPacketsRead;
  624|    158|	}
_ZN4pcpp21SnoopFileReaderDeviceD2Ev:
 1496|    409|	{
 1497|    409|		m_SnoopFile.close();
 1498|    409|	}
_ZN4pcpp21SnoopFileReaderDevice4openEv:
 1501|    409|	{
 1502|    409|		if (m_SnoopFile.is_open())
  ------------------
  |  Branch (1502:7): [True: 0, False: 409]
  ------------------
 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|    409|		resetStatisticCounters();
 1509|       |
 1510|    409|		std::ifstream snoopFile;
 1511|    409|		snoopFile.open(m_FileName.c_str(), std::ifstream::binary);
 1512|    409|		if (!snoopFile.is_open())
  ------------------
  |  Branch (1512:7): [True: 0, False: 409]
  ------------------
 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|    409|		snoop_file_header_t snoop_file_header;
 1519|    409|		snoopFile.read(reinterpret_cast<char*>(&snoop_file_header), sizeof(snoop_file_header_t));
 1520|    409|		if (!snoopFile)
  ------------------
  |  Branch (1520:7): [True: 2, False: 407]
  ------------------
 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|    407|		if (!isSnoopMagic(snoop_file_header.identification_pattern))
  ------------------
  |  Branch (1526:7): [True: 158, False: 249]
  ------------------
 1527|    158|		{
 1528|    158|			PCPP_LOG_ERROR("File content does not match snoop magic number for file: \'" << m_FileName << '\'');
  ------------------
  |  |  443|    158|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|    158|	do                                                                                                                 \
  |  |  |  |  413|    158|	{                                                                                                                  \
  |  |  |  |  414|    158|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    158|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    158|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 158, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|    158|		{                                                                                                              \
  |  |  |  |  417|    158|			auto ctx =                                                                                                 \
  |  |  |  |  418|    158|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    158|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|    158|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|    158|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|    158|		}                                                                                                              \
  |  |  |  |  422|    158|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 158]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1529|    158|			return false;
 1530|    158|		}
 1531|       |
 1532|    249|		if (be32toh(snoop_file_header.version_number) != 2)
  ------------------
  |  Branch (1532:7): [True: 48, False: 201]
  ------------------
 1533|     48|		{
 1534|     48|			PCPP_LOG_ERROR("Malformed snoop file header version number for '" << m_FileName << "'");
  ------------------
  |  |  443|     48|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|     48|	do                                                                                                                 \
  |  |  |  |  413|     48|	{                                                                                                                  \
  |  |  |  |  414|     48|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|     48|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     48|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 48, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|     48|		{                                                                                                              \
  |  |  |  |  417|     48|			auto ctx =                                                                                                 \
  |  |  |  |  418|     48|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     48|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|     48|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|     48|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|     48|		}                                                                                                              \
  |  |  |  |  422|     48|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1535|     48|			return false;
 1536|     48|		}
 1537|       |
 1538|       |		// From https://datatracker.ietf.org/doc/html/rfc1761
 1539|    201|		static const pcpp::LinkLayerType snoop_encap[] = {
 1540|    201|			LINKTYPE_ETHERNET,   /// IEEE 802.3
 1541|    201|			LINKTYPE_NULL,       /// IEEE 802.4 Token Bus
 1542|    201|			LINKTYPE_IEEE802_5,  /// IEEE 802.5
 1543|    201|			LINKTYPE_NULL,       /// IEEE 802.6 Metro Net
 1544|    201|			LINKTYPE_ETHERNET,   /// Ethernet
 1545|    201|			LINKTYPE_C_HDLC,     /// HDLC
 1546|    201|			LINKTYPE_NULL,       /// Character Synchronous, e.g. bisync
 1547|    201|			LINKTYPE_NULL,       /// IBM Channel-to-Channel
 1548|    201|			LINKTYPE_FDDI        /// FDDI
 1549|    201|		};
 1550|    201|		uint32_t datalink_type = be32toh(snoop_file_header.datalink_type);
 1551|    201|		if (datalink_type > ARRAY_SIZE(snoop_encap) - 1)
  ------------------
  |  Branch (1551:7): [True: 43, False: 158]
  ------------------
 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|    158|		m_SnoopFile = std::move(snoopFile);
 1558|    158|		m_PcapLinkLayerType = snoop_encap[datalink_type];
 1559|       |
 1560|    158|		constexpr uint32_t maxPacketLength = 15'000;
 1561|    158|		m_ReadBuffer.resize(maxPacketLength);
 1562|       |
 1563|    158|		PCPP_LOG_DEBUG("Successfully opened file reader device for filename '" << m_FileName << "'");
  ------------------
  |  |  425|    158|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    158|	do                                                                                                                 \
  |  |  |  |  413|    158|	{                                                                                                                  \
  |  |  |  |  414|    158|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    158|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    158|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 158]
  |  |  |  |  ------------------
  |  |  |  |  416|    158|		{                                                                                                              \
  |  |  |  |  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|    158|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 158]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1564|    158|		return true;
 1565|    201|	}
_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: 108, False: 1.31k]
  ------------------
 1573|    108|		{
 1574|    108|			PCPP_LOG_ERROR("Failed to read packet metadata");
  ------------------
  |  |  443|    108|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|    108|	do                                                                                                                 \
  |  |  |  |  413|    108|	{                                                                                                                  \
  |  |  |  |  414|    108|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    108|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    108|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 108, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|    108|		{                                                                                                              \
  |  |  |  |  417|    108|			auto ctx =                                                                                                 \
  |  |  |  |  418|    108|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    108|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|    108|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|    108|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|    108|		}                                                                                                              \
  |  |  |  |  422|    108|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 108]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1575|    108|			return false;
 1576|    108|		}
 1577|       |
 1578|  1.31k|		capturedLength = be32toh(snoop_packet_header.included_length);
 1579|  1.31k|		if (capturedLength > packetDataLen)
  ------------------
  |  Branch (1579:7): [True: 48, False: 1.26k]
  ------------------
 1580|     48|		{
 1581|     48|			PCPP_LOG_ERROR("Packet length " << capturedLength << " is too large");
  ------------------
  |  |  443|     48|#	define PCPP_LOG_ERROR(message) PCPP_LOG(pcpp::LogLevel::Error, message)
  |  |  ------------------
  |  |  |  |  412|     48|	do                                                                                                                 \
  |  |  |  |  413|     48|	{                                                                                                                  \
  |  |  |  |  414|     48|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|     48|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     48|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 48, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|     48|		{                                                                                                              \
  |  |  |  |  417|     48|			auto ctx =                                                                                                 \
  |  |  |  |  418|     48|			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|     48|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |               			    logger.createLogContext(level, pcpp::LogSource(LOG_MODULE, PCAPPP_FILENAME, __FUNCTION__, __LINE__));  \
  |  |  |  |  ------------------
  |  |  |  |  |  |   20|       |#	define PCAPPP_FILENAME __FILE_NAME__
  |  |  |  |  ------------------
  |  |  |  |  419|     48|			(*ctx) << message;                                                                                         \
  |  |  |  |  420|     48|			logger.emit(std::move(ctx));                                                                               \
  |  |  |  |  421|     48|		}                                                                                                              \
  |  |  |  |  422|     48|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1582|     48|			return false;
 1583|     48|		}
 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: 158]
  ------------------
 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: 867]
  ------------------
 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|    158|		return false;
 1632|  1.42k|	}
_ZN4pcpp21SnoopFileReaderDevice5closeEv:
 1635|    103|	{
 1636|    103|		m_SnoopFile.close();
 1637|    103|		PCPP_LOG_DEBUG("File reader closed for file '" << m_FileName << "'");
  ------------------
  |  |  425|    103|#	define PCPP_LOG_DEBUG(message) PCPP_LOG(pcpp::LogLevel::Debug, message)
  |  |  ------------------
  |  |  |  |  412|    103|	do                                                                                                                 \
  |  |  |  |  413|    103|	{                                                                                                                  \
  |  |  |  |  414|    103|		auto& logger = pcpp::Logger::getInstance();                                                                    \
  |  |  |  |  415|    103|		if (logger.shouldLog(level, LOG_MODULE))                                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |    2|    103|#define LOG_MODULE PcapLogModuleFileDevice
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 103]
  |  |  |  |  ------------------
  |  |  |  |  416|    103|		{                                                                                                              \
  |  |  |  |  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|    103|	} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (422:11): [Folded, False: 103]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1638|    103|	}
PcapFileDevice.cpp:_ZN4pcpp12_GLOBAL__N_112isSnoopMagicEmPNS0_13FileByteOrderE:
  344|    407|		{
  345|    407|			constexpr std::array<uint64_t, 2> snoopMagicNumbers = {
  346|    407|				0x73'6E'6F'6F'70'00'00'00,  // snoop magic number, "snoop" in ASCII
  347|    407|				0x00'00'00'70'6F'6F'6E'73   // snoop magic number, "snoop" in ASCII (byte-swapped)
  348|    407|			};
  349|       |
  350|    407|			auto it = std::find(snoopMagicNumbers.begin(), snoopMagicNumbers.end(), magic);
  351|    407|			if (it == snoopMagicNumbers.end())
  ------------------
  |  Branch (351:8): [True: 158, False: 249]
  ------------------
  352|    158|			{
  353|    158|				return false;
  354|    158|			}
  355|       |
  356|    249|			if (byteOrder != nullptr)
  ------------------
  |  Branch (356:8): [True: 0, False: 249]
  ------------------
  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|    249|			return true;
  363|    407|		}
PcapFileDevice.cpp:_ZN4pcpp12_GLOBAL__N_110ARRAY_SIZEIKNS_13LinkLayerTypeELm9EEEmRAT0__T_:
   47|    201|		{
   48|    201|			return N;
   49|    201|		}

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

LLVMFuzzerTestOneInput:
   11|    409|{
   12|    409|	if (tmpName.empty())
  ------------------
  |  Branch (12:6): [True: 1, False: 408]
  ------------------
   13|      1|		tmpName = tmpnam(nullptr);
   14|       |
   15|    409|	if (tmpFile.empty())
  ------------------
  |  Branch (15:6): [True: 1, False: 408]
  ------------------
   16|      1|		tmpFile = tmpName + FILE_EXT;
   17|       |
   18|    409|	if (dumpDataToPcapFile(data, size, tmpFile.c_str()) != 0)
  ------------------
  |  Branch (18:6): [True: 0, False: 409]
  ------------------
   19|      0|	{
   20|      0|		std::cerr << "Can't Dump buffer to the '" << tmpFile << "' file!!!!\n";
   21|      0|		return -1;
   22|      0|	}
   23|       |
   24|    409|	pcpp::Logger::getInstance().suppressLogs();
   25|       |
   26|    409|	std::unique_ptr<pcpp::IFileReaderDevice> reader(pcpp::IFileReaderDevice::getReader(tmpFile));
   27|    409|	if (!reader->open())
  ------------------
  |  Branch (27:6): [True: 251, False: 158]
  ------------------
   28|    251|	{
   29|    251|		std::cerr << "Error opening the '" << tmpFile << "' file\n";
   30|    251|		return -1;
   31|    251|	}
   32|       |
   33|    158|	pcpp::PcapStats stats;
   34|    158|	reader->getStatistics(stats);
   35|    158|	std::cout << "Read " << stats.packetsRecv << " packets successfully and " << stats.packetsDrop
   36|    158|	          << " packets could not be read" << std::endl;
   37|       |
   38|    158|	if (auto ngReader = dynamic_cast<pcpp::PcapNgFileReaderDevice*>(reader.get()))
  ------------------
  |  Branch (38:11): [True: 0, False: 158]
  ------------------
   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|    158|	pcpp::RawPacketVector packets;
   46|    158|	if (reader->getNextPackets(packets, 1) != 1)
  ------------------
  |  Branch (46:6): [True: 55, False: 103]
  ------------------
   47|     55|	{
   48|     55|		std::cerr << "Couldn't read the first packet in the file\n";
   49|     55|		return 0;
   50|     55|	}
   51|       |
   52|    103|	pcpp::RawPacket& rawPacket = *packets.front();
   53|    103|	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.16k, False: 103]
  ------------------
   72|       |
   73|    103|	reader->close();
   74|    103|	return 0;
   75|    158|}

