PcapPlusPlus
NetworkUtils.h
Go to the documentation of this file.
1 #ifndef PCAPPP_NETWORK_UTILS
2 #define PCAPPP_NETWORK_UTILS
3 
4 #include "MacAddress.h"
5 #include "IpAddress.h"
6 #include "PcapLiveDevice.h"
7 
8 
10 
15 namespace pcpp
16 {
17 
24  {
25  public:
26 
32  {
33  static NetworkUtils instance;
34  return instance;
35  }
36 
40  static const int DefaultTimeout;
41 
56  MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice* device, double& arpResponseTimeMS,
57  MacAddress sourceMac = MacAddress::Zero, IPv4Address sourceIP = IPv4Address::Zero, int arpTimeout = -1);
58 
59 
79  IPv4Address getIPv4Address(std::string hostname, PcapLiveDevice* device, double& dnsResponseTimeMS, uint32_t& dnsTTL,
80  int dnsTimeout = -1, IPv4Address dnsServerIP = IPv4Address::Zero, IPv4Address gatewayIP = IPv4Address::Zero);
81 
82  private:
83 
84  // private c'tor
85  NetworkUtils() {}
86  };
87 
88 } // namespace pcpp
89 
90 #endif /* PCAPPP_NETWORK_UTILS */
Definition: MacAddress.h:21
Definition: IpAddress.h:99
MacAddress getMacAddress(IPv4Address ipAddr, PcapLiveDevice *device, double &arpResponseTimeMS, MacAddress sourceMac=MacAddress::Zero, IPv4Address sourceIP=IPv4Address::Zero, int arpTimeout=-1)
static NetworkUtils & getInstance()
Definition: NetworkUtils.h:31
static IPv4Address Zero
Definition: IpAddress.h:187
IPv4Address getIPv4Address(std::string hostname, PcapLiveDevice *device, double &dnsResponseTimeMS, uint32_t &dnsTTL, int dnsTimeout=-1, IPv4Address dnsServerIP=IPv4Address::Zero, IPv4Address gatewayIP=IPv4Address::Zero)
Definition: NetworkUtils.h:23
static const int DefaultTimeout
Definition: NetworkUtils.h:40
Definition: PcapLiveDevice.h:76
The main namespace for the PcapPlusPlus lib.
static MacAddress Zero
Definition: MacAddress.h:114