Switch.h 865 Bytes
Newer Older
/jdi/'s avatar
/jdi/ committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Switch.h
 *
 *  Created on: 29.09.2015
 *      Author: jdi
 */

#ifndef SWITCH_H_
#define SWITCH_H_

#include <string>
#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<vlan*> tagged;
		std::vector<vlan*> untagged;
		int pvid;
	} vlan;
};

class Switch {
public:
	Switch();
	void parse(datasets);
private:
	struct {
		std::string type;
		std::string hardware_version;
		std::string firmware_version;
/jdi/'s avatar
/jdi/ committed
40
		macAddr mac;
/jdi/'s avatar
/jdi/ committed
41
42
43
44
45
46
	} device;
	struct {
		std::string password = DEFAULT_PASS;
		std::string username = DEFAULT_USER;
		struct {
			std::string hostname;
/jdi/'s avatar
/jdi/ committed
47
48
49
			inetAddr ip_addr;
			inetAddr ip_mask;
			inetAddr gateway;
/jdi/'s avatar
/jdi/ committed
50
51
52
53
54
55
56
57
			byte dhcp;
		} network;
	} settings;
	std::vector<vlan> vlans;
	std::vector<port> ports;
};

#endif /* SWITCH_H_ */