PcapPlusPlus  24.09
NetworkUtils.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "MacAddress.h"
4 #include "IpAddress.h"
5 #include "PcapLiveDevice.h"
6 
8 
13 namespace pcpp
14 {
15 
23  {
24  public:
30  {
31  static NetworkUtils instance;
32  return instance;
33  }
34 
38  static const int DefaultTimeout;
39 
57  MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice* device, double& arpResponseTimeMS,
59  int arpTimeout = -1) const;
60 
83  IPv4Address getIPv4Address(const std::string& hostname, PcapLiveDevice* device, double& dnsResponseTimeMS,
84  uint32_t& dnsTTL, int dnsTimeout = -1, IPv4Address dnsServerIP = IPv4Address::Zero,
85  IPv4Address gatewayIP = IPv4Address::Zero) const;
86 
87  private:
88  // private c'tor
89  NetworkUtils()
90  {}
91  };
92 
93 } // namespace pcpp
Definition: IpAddress.h:32
static const IPv4Address Zero
Definition: IpAddress.h:170
Definition: MacAddress.h:25
static MacAddress Zero
Definition: MacAddress.h:171
Definition: NetworkUtils.h:23
MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice *device, double &arpResponseTimeMS, MacAddress sourceMac=MacAddress::Zero, IPv4Address sourceIP=IPv4Address::Zero, int arpTimeout=-1) const
static const int DefaultTimeout
Definition: NetworkUtils.h:38
static NetworkUtils & getInstance()
Definition: NetworkUtils.h:29
IPv4Address getIPv4Address(const std::string &hostname, PcapLiveDevice *device, double &dnsResponseTimeMS, uint32_t &dnsTTL, int dnsTimeout=-1, IPv4Address dnsServerIP=IPv4Address::Zero, IPv4Address gatewayIP=IPv4Address::Zero) const
Definition: PcapLiveDevice.h:79
The main namespace for the PcapPlusPlus lib.