-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice_ping.h
37 lines (31 loc) · 1.04 KB
/
device_ping.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <cstdint>
#include <string>
#include <memory>
class dev_ping {
public:
dev_ping();
dev_ping(const std::string &hostname);
virtual ~dev_ping();
typedef struct result_s {
uint16_t icmp_id; // id proccess
uint16_t icmp_seq; // sequence number
uint16_t icmp_len; // lenght of icmp packet
uint8_t ip_ttl; // time to live
double rtt; // round trip time
std::string from_addr; // ip addres of host
std::string status; // status string of result
} result_t;
bool check(const std::string &hostname, result_t *result = nullptr);
bool check(result_t *result = nullptr);
void setSize(uint16_t size);
private:
class Impl;
std::unique_ptr<Impl> impl;
std::string m_hostname;
private:
dev_ping(const dev_ping&) = delete;
dev_ping(const dev_ping&&) = delete;
dev_ping& operator=(const dev_ping&) = delete;
dev_ping& operator=(const dev_ping&&) = delete;
};