Switch.cpp 802 Bytes
Newer Older
/jdi/'s avatar
/jdi/ committed
1
2
3
4
5
6
7
/*
 * Switch.cpp
 *
 *  Created on: 29.09.2015
 *      Author: jdi
 */

/jdi/'s avatar
/jdi/ committed
8
#include <string>
/jdi/'s avatar
/jdi/ committed
9
#include "Types/Types.h"
/jdi/'s avatar
/jdi/ committed
10
#include "Switch.h"
/jdi/'s avatar
/jdi/ committed
11
12
#include "Lookup.h"
#include "Options.h"
/jdi/'s avatar
/jdi/ committed
13

/jdi/'s avatar
/jdi/ committed
14
15
16
17
18
19
20
21
22
void Switch::parse(datasets arr) {
	device.type = arr[1].value;
	settings.hostname = arr[2].value;
	device.mac = arr[3].value;
	settings.ip_addr = arr[4].value;
	settings.ip_mask = arr[5].value;
	settings.gateway = arr[6].value;
	device.firmware_version = arr[7].value;
	device.hardware_version = arr[8].value;
/jdi/'s avatar
/jdi/ committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
	settings.dhcp = arr[9].value[0];
}

void Switch::parse(dataset d) {
	auto lookup = (options.flags & FLAG_REVERSE) ? snd_lookup : rcv_lookup;
	if(d.type==lookup["type"]){
		device.type = d.value;
	}
	if(d.type==lookup["mac"]){
		device.mac = d.value;
	}
	if(d.type==lookup["type"]){
		device.type = d.value;
	}
/jdi/'s avatar
/jdi/ committed
37
38
}