summaryrefslogtreecommitdiff
path: root/hscript
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 03:16:46 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-12 03:16:46 -0500
commit6d857cc2dd223fde89eb9c3c08815a14c08ea7a9 (patch)
treeabb02746c3fa85dd111a7362e81afcb96ff97f48 /hscript
parentd7fb1cb3093e17d79598c9aaabedf77465960ac6 (diff)
downloadhorizon-6d857cc2dd223fde89eb9c3c08815a14c08ea7a9.tar.gz
horizon-6d857cc2dd223fde89eb9c3c08815a14c08ea7a9.tar.bz2
horizon-6d857cc2dd223fde89eb9c3c08815a14c08ea7a9.tar.xz
horizon-6d857cc2dd223fde89eb9c3c08815a14c08ea7a9.zip
hscript: Stub out NetAddress class
Diffstat (limited to 'hscript')
-rw-r--r--hscript/network.cc13
-rw-r--r--hscript/network.hh38
2 files changed, 51 insertions, 0 deletions
diff --git a/hscript/network.cc b/hscript/network.cc
index 1c8edd1..e5ca787 100644
--- a/hscript/network.cc
+++ b/hscript/network.cc
@@ -28,3 +28,16 @@ Key *Network::parseFromData(const std::string data, int lineno, int *errors,
bool Network::execute(ScriptOptions) const {
return false;
}
+
+Key *NetAddress::parseFromData(const std::string data, int lineno, int *errors,
+ int *warnings) {
+ return nullptr;
+}
+
+bool NetAddress::validate(ScriptOptions) const {
+ return false;
+}
+
+bool NetAddress::execute(ScriptOptions) const {
+ return false;
+}
diff --git a/hscript/network.hh b/hscript/network.hh
index f24dd0f..282429b 100644
--- a/hscript/network.hh
+++ b/hscript/network.hh
@@ -29,6 +29,44 @@ public:
};
class NetAddress : public Key {
+public:
+ /*! Determines the type of address an interface will obtain. */
+ enum AddressType {
+ /*! DHCP address, obtained automatically from an addressing server. */
+ DHCP,
+ /*! IPv6 address automatically derived from router solicitation. */
+ SLAAC,
+ /*! Static address obtained from the netaddress key. */
+ Static
+ };
+private:
+ const std::string _iface;
+ const AddressType _type;
+ const std::string _address;
+ const uint8_t _prefix;
+ const std::string _gw;
+
+ NetAddress(const int _line, const std::string _i, const AddressType _t,
+ const std::string _a, const uint8_t _p, const std::string _g) :
+ Key(_line), _iface(_i), _type(_t), _address(_a), _prefix(_p), _gw(_g)
+ {}
+public:
+ static Key *parseFromData(const std::string data, int lineno, int *errors,
+ int *warnings);
+
+ /*! Retrieve the interface to which this 'netaddress' key is associated. */
+ const std::string iface() const { return this->_iface; }
+ /*! Retrieve the address type of this 'netadress' key. */
+ const AddressType type() const { return this->_type; }
+ /*! Retrieve the static address, if any. */
+ const std::string address() const { return this->_address; }
+ /*! Retreive the prefix length for the static address. */
+ const uint8_t prefix() const { return this->_prefix; }
+ /*! Retrieve the gateway, if any. */
+ const std::string gateway() const { return this->_gw; }
+
+ bool validate(ScriptOptions) const override;
+ bool execute(ScriptOptions) const override;
};
class Nameserver : public Key {