PcapPlusPlus  Next
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 
11 namespace pcpp
12 {
18  {
19  public:
23  {
24  static NetworkUtils instance;
25  return instance;
26  }
27 
29  static const int DefaultTimeout;
30 
47  MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice* device, double& arpResponseTimeMS,
49  int arpTimeout = -1) const;
50 
71  IPv4Address getIPv4Address(const std::string& hostname, PcapLiveDevice* device, double& dnsResponseTimeMS,
72  uint32_t& dnsTTL, int dnsTimeout = -1, IPv4Address dnsServerIP = IPv4Address::Zero,
73  IPv4Address gatewayIP = IPv4Address::Zero) const;
74 
75  private:
76  // private c'tor
77  NetworkUtils() = default;
78  };
79 
80 } // namespace pcpp
Definition: IpAddress.h:28
static const IPv4Address Zero
A static value representing a zero value of IPv4 address, meaning address of value "0....
Definition: IpAddress.h:131
Definition: MacAddress.h:21
static MacAddress Zero
A static value representing a zero value of MAC address, meaning address of value "00:00:00:00:00:00"...
Definition: MacAddress.h:139
Definition: NetworkUtils.h:18
MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice *device, double &arpResponseTimeMS, MacAddress sourceMac=MacAddress::Zero, IPv4Address sourceIP=IPv4Address::Zero, int arpTimeout=-1) const
static const int DefaultTimeout
Default timeout used for several utilities. Currently set to 5 seconds.
Definition: NetworkUtils.h:29
static NetworkUtils & getInstance()
Definition: NetworkUtils.h:22
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:68
The main namespace for the PcapPlusPlus lib.