From 4c16611390959653d4c6c070f5bec59ea22b779c Mon Sep 17 00:00:00 2001 From: /jdi/ Date: Wed, 30 Sep 2015 00:02:00 +0200 Subject: [PATCH] switch Class --- src/Switch.cpp | 14 +++++++++++++ src/Switch.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/Switch.cpp create mode 100644 src/Switch.h diff --git a/src/Switch.cpp b/src/Switch.cpp new file mode 100644 index 0000000..5ff7d8f --- /dev/null +++ b/src/Switch.cpp @@ -0,0 +1,14 @@ +/* + * Switch.cpp + * + * Created on: 29.09.2015 + * Author: jdi + */ + +#include "Switch.h" + +Switch::Switch() { + // TODO Auto-generated constructor stub + +} + diff --git a/src/Switch.h b/src/Switch.h new file mode 100644 index 0000000..94828c0 --- /dev/null +++ b/src/Switch.h @@ -0,0 +1,57 @@ +/* + * Switch.h + * + * Created on: 29.09.2015 + * Author: jdi + */ + +#ifndef SWITCH_H_ +#define SWITCH_H_ + +#include +#include "Types.h" + +#define DEFAULT_USER "admin" +#define DEFAULT_PASS "admin" + +struct vlan { + int vlan_id; + std::string name; +}; + +struct port { + int id; + struct { + std::vector tagged; + std::vector untagged; + int pvid; + } vlan; +}; + +class Switch { +public: + Switch(); + void parse(datasets); +private: + struct { + std::string type; + std::string hardware_version; + std::string firmware_version; + byteArray<6> mac; + } device; + struct { + std::string password = DEFAULT_PASS; + std::string username = DEFAULT_USER; + struct { + std::string hostname; + byteArray<4> ip_addr; + byteArray<4> ip_mask; + byteArray<4> gateway; + byte dhcp; + } network; + } settings; + std::vector vlans; + std::vector ports; +}; + +#endif /* SWITCH_H_ */