summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-09-10 19:33:12 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-09-10 19:33:12 +0200
commitc8b065530a76b6e2344aba146d20ad8ab8d01add (patch)
tree94e4f31be8a071d4048be8eb7af77c9b2eb66453
parent0dc3b446daf823726121eeb7d7e4e355f499b565 (diff)
Make address of interface optional, because an interface may not have an address
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/interface.cpp2
-rw-r--r--src/interface.hpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/interface.cpp b/src/interface.cpp
index 3fcd16a..099fac0 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -1,6 +1,6 @@
#include "interface.hpp"
-interface::interface(std::string name, std::string addr):
+interface::interface(std::string name, std::optional<std::string> addr):
name(name), addr(addr)
{
}
diff --git a/src/interface.hpp b/src/interface.hpp
index 76a86d2..f8dd545 100644
--- a/src/interface.hpp
+++ b/src/interface.hpp
@@ -2,14 +2,15 @@
#define GETIF_INTERFACE_H
#include <string>
+#include <optional>
class interface {
public:
- interface(std::string name, std::string addr);
+ interface(std::string name, std::optional<std::string> addr);
private:
std::string name;
- std::string addr;
+ std::optional<std::string> addr;
};
#endif // GETIF_INTERFACE_H