working commit
This commit is contained in:
@@ -284,6 +284,16 @@ std::expected<std::string, std::string> Interface::Read() {
|
||||
return rdata;
|
||||
}
|
||||
|
||||
std::expected<int, std::string> Interface::Write(std::string payload) {
|
||||
int wsize = 0;
|
||||
if ((wsize = write(tunfd, payload.data(), payload.size())) < 0) {
|
||||
int errnocopy = errno;
|
||||
std::string error = std::strerror(errnocopy);
|
||||
return std::unexpected("Write interface error: " + error);
|
||||
}
|
||||
return wsize;
|
||||
}
|
||||
|
||||
std::string Interface::Name() {
|
||||
return ifname;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user