Switch.h 939 Bytes
Newer Older
/jdi/'s avatar
/jdi/ committed
1
2
3
4
5
6
7
8
9
10
11
12
/*
 * Switch.h
 *
 *  Created on: 29.09.2015
 *      Author: jdi
 */

#ifndef SWITCH_H_
#define SWITCH_H_

#include <string>
#include "Types.h"
/jdi/'s avatar
/jdi/ committed
13
14
#include "Types/bytes.h"
#include "Types/datasets.h"
/jdi/'s avatar
/jdi/ committed
15
16
17
18
19
20
21
22
23
24

#define DEFAULT_USER "admin"
#define DEFAULT_PASS "admin"

struct vlan {
	int vlan_id;
	std::string name;
};

struct port {
/jdi/'s avatar
/jdi/ committed
25
26
	byte id;
	byte status;
/jdi/'s avatar
/jdi/ committed
27
28
29
30
31
32
33
34
35
	struct {
		std::vector<vlan*> tagged;
		std::vector<vlan*> untagged;
		int pvid;
	} vlan;
};

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

#endif /* SWITCH_H_ */