forked from jackburton79/inventory-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkInterface.h
More file actions
46 lines (38 loc) · 931 Bytes
/
NetworkInterface.h
File metadata and controls
46 lines (38 loc) · 931 Bytes
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
38
39
40
41
42
43
44
45
46
/*
* Network.h
*
* Created on: 12 ott 2015
* Author: Stefano Ceccherini
*/
#ifndef NETWORKINTERFACE_H_
#define NETWORKINTERFACE_H_
#include <list>
#include <string>
#include <net/if.h>
#include <netinet/in.h>
struct route_info {
struct in_addr dstAddr;
struct in_addr srcAddr;
struct in_addr gateWay;
char ifName[IF_NAMESIZE];
};
class NetworkInterface {
public:
NetworkInterface();
NetworkInterface(const char* name);
~NetworkInterface();
std::string Name() const;
std::string HardwareAddress() const;
std::string IPAddress() const;
std::string NetMask() const;
std::string BroadcastAddress() const;
std::string DefaultGateway() const;
std::string Type() const;
std::string Speed() const;
std::string Status() const;
private:
int _GetRoutes(std::list<route_info>& routeList) const;
int _DoRequest(int request, struct ifreq& ifr) const;
std::string fName;
};
#endif /* NETWORKINTERFACE_H_ */