diff --git a/src/Lookup.h b/src/Lookup.h index 28cc61a..451cdb7 100644 --- a/src/Lookup.h +++ b/src/Lookup.h @@ -16,12 +16,14 @@ static table rcv_lookup = { { 1, table::STRING, "type" }, //string { 7, table::STRING, "firmware_version" }, { 8, table::STRING, "hardware_version" }, { 9, table::DEC, "dhcp" }, //bool byte - { 19, table::DEC, "ports" }, //byte, maybe number of ports + { 10, table::DEC, "ports???" }, //byte, maybe number of ports { 4352, table::HEX, "igmp_snooping" }, //switching { 4096, table::HEX, "port_settings" }, //switching { 4608, table::HEX, "port_trunk" }, //byte[5] last byte bitmask?? - { 8704, table::HEX, "802.1q vlan" }, //??? - + { 8192, table::HEX, "mtu_vlan" }, //byte[2] first byte bool,second byte port id + { 8704, table::HEX, "802.1q vlan enabled" }, //bool byte + { 8705, table::HEX, "802.1q vlan" }, //one set per vlan + { 8706, table::HEX, "802.1q vlan pvid" }, //???? { 12288, table::HEX, "QoS Basic 1" }, //bool = QoS Mod { 12289, table::HEX, "QoS Basic 2" }, //QoS { 16640, table::HEX, "port_mirror" }, //byte[10] second byte port id?? @@ -35,7 +37,7 @@ static table snd_lookup = { // TODO find out if id is unique in response { 2, table::HEX, "system_info" }, //page sysinfo { 9, table::HEX, "ip_config" }, //page sysinfo - { 10, table::HEX, "??? - 10" }, //after login + { 10, table::HEX, "ports???" }, //after login { 512, table::STRING, "login_user" }, //string { 513, table::STRING, "new_user" }, //string { 514, table::STRING, "login_password" }, //string @@ -50,7 +52,7 @@ static table snd_lookup = { { 8192, table::HEX, "mtu_vlan" }, //byte[2] first byte bool, second byte port id { 8449, table::HEX, "port_vlan1" }, //??? { 8448, table::HEX, "port_vlan2" }, //open page - { 8704, table::HEX, "802.1q vlan" }, //??? get vlan / set status + { 8704, table::HEX, "802.1q vlan enabled" }, //??? get vlan / set status { 8705, table::HEX, "802.1q vlan" }, //??? { 8706, table::HEX, "802.1q vlan pvid" }, //???? diff --git a/src/Packet.cpp b/src/Packet.cpp index a9dc63d..e382618 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -33,7 +33,7 @@ void Packet::printHeader() { bytes Packet::getBytes() { int i = 0; for (auto d : payload) - push(body, i, d.second); + push(body, i, d); push(body, i, (int) PACKET_END); i = 0; push(head, i, version); @@ -79,7 +79,7 @@ void Packet::parse(bytes data) { pull(body, i, d.type); pull(body, i, d.len); pull(body, i, d.value, d.len); - payload = d; + payload.push_back(d); } } diff --git a/src/Program.cpp b/src/Program.cpp index 849cdc0..392ed09 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -32,8 +32,7 @@ int printPacket(Packet p) { if (options.flags & FLAG_HEX) { std::cout << "Received Payload:\n\t" << p.getBody() << "\n"; } else { - for (auto a : p.getPayload()) { - dataset d = a.second; + for (dataset d : p.getPayload()) { auto lookup = (options.flags & FLAG_REVERSE) ? snd_lookup : rcv_lookup; if (lookup.exists(d.type)) { diff --git a/src/Switch.cpp b/src/Switch.cpp index 96aaf9e..106a158 100644 --- a/src/Switch.cpp +++ b/src/Switch.cpp @@ -13,8 +13,8 @@ #include "Options.h" int Switch::parse(datasets arr) { - for (auto a : arr) { - parse(a.second); + for (dataset a : arr) { + parse(a); } return 0; } diff --git a/src/datasets.h b/src/datasets.h index e570b18..bc9ac83 100644 --- a/src/datasets.h +++ b/src/datasets.h @@ -17,13 +17,14 @@ struct dataset { bytes value; }; -class datasets : public std::map { +class datasets : public std::vector { public: datasets(){}; datasets(std::initializer_list s) { for (dataset b : s) { - (*this)[b.type]=b; + //(*this)[b.type]=b; + push_back(b); } } };