31 lines
864 B
C++
31 lines
864 B
C++
|
|
#ifndef INTERFACE_HPP
|
|
#define INTERFACE_HPP
|
|
|
|
class Interface {
|
|
private:
|
|
int tunfd;
|
|
std::string ifname;
|
|
int mtu;
|
|
public:
|
|
std::expected<void, std::string> Create(const std::string name);
|
|
std::string Name(void);
|
|
|
|
int MTU();
|
|
std::expected<void, std::string> SetMTU(int mtu);
|
|
std::expected<int, std::string> GetMTU(void);
|
|
std::expected<void, std::string> SetIP4Address(std::string ipaddr);
|
|
std::expected<void, std::string> SetIP4Netmask(int netmask);
|
|
std::expected<std::string, std::string> GetIP4Address(void);
|
|
|
|
std::expected<void, std::string> Up(void);
|
|
std::expected<void, std::string> Down(void);
|
|
|
|
std::expected<std::string, std::string> Read(void);
|
|
std::expected<int, std::string> Write(std::string payload);
|
|
|
|
~Interface();
|
|
};
|
|
|
|
#endif
|