Commit 96a10549 authored by jedi's avatar jedi
Browse files

new id names

parent 73df3e05
......@@ -16,19 +16,28 @@ 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
{ 10, 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
{ 4096, table::HEX, "port_settings" }, //per port
{ 4608, table::HEX, "port_trunk" }, //byte[5] last byte bitmask??
{ 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
{ 8448, table::HEX, "port_vlan_1" }, //???
{ 8450, table::HEX, "port_vlan_2" }, //???
{ 8704, table::HEX, "vlan enabled" }, //bool byte
{ 8705, table::HEX, "vlan" }, //one set per vlan
{ 8706, table::HEX, "vlan_pvid" }, //per port
{ 8707, table::HEX, "vlan ?????" }, //????
{ 12288, table::HEX, "qos_basic_1" }, //bool = QoS Mod
{ 12289, table::HEX, "qos_basic_2" }, //per port
{ 12544, table::HEX, "bandwidth_control_1" }, //per port
{ 12545, table::HEX, "bandwidth_control_2" }, //per port
{ 12800, table::HEX, "storm_control" }, //per port
{ 16640, table::HEX, "port_mirror" }, //byte[10] second byte port id??
{ 16384, table::HEX, "port_statistics" }, //???
{ 16384, table::HEX, "port_statistics" }, //per port
{ 16896, table::HEX, "cable_test" }, //per port
{ 17152, table::HEX, "loop_prevention" }, //bool byte
//{0000," "},
};
......@@ -37,27 +46,37 @@ 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, "ports???" }, //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
{ 515, table::STRING, "new_passwoord" }, //string
{ 773, table::HEX, "reboot" }, //bool byte = save config
{ 1280, table::ACTION, "reset" }, //
{ 1536, table::ACTION, "flash" }, //update firmware
{ 2200, table::HEX, "vlan" }, //vlan
{ 2304, table::ACTION, "save" }, //save
{ 2305, table::ACTION, "ping" }, //sent before SET ???
{ 2305, table::HEX, "??? - 2305" }, //sent before login and before change hostname
{ 4352, table::HEX, "igmp_snooping" }, //switching
{ 4096, table::HEX, "port_settings" }, //switching
{ 4608, table::HEX, "port_trunk" }, //byte[5] last byte bitmask??
{ 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 enabled" }, //??? get vlan / set status
{ 8705, table::HEX, "802.1q vlan" }, //???
{ 8706, table::HEX, "802.1q vlan pvid" }, //????
{ 8449, table::HEX, "port_vlan ???" }, //???
{ 8448, table::HEX, "port_vlan" }, //open page
{ 8704, table::HEX, "vlan_enabled" }, //??? get vlan / set status
{ 8705, table::HEX, "vlan" }, // per vlan
{ 8706, table::HEX, "vlan_pvid" }, //per port
{ 12288, table::HEX, "qos_basic_enabled" }, //bool = QoS Mod
{ 12289, table::HEX, "qos_basic" }, //per port
{ 12544, table::HEX, "bandwidth_control_1" }, //per port
{ 12545, table::HEX, "bandwidth_control_2" }, //per port
{ 12800, table::HEX, "storm_control" }, //???
{ 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??
{ 16384, table::HEX, "port_statistics" }, //???
{ 17152, table::HEX, "loop_prevention" }, //bool byte
......
......@@ -143,12 +143,10 @@ std::string Packet::opCodeToString() {
return "GET";
case SET:
return "SET";
case LOGIN:
return "LOGIN";
case CONFIRM:
return "CONFIRM";
case RETURN:
return "RETURN";
case READ5:
return "READ5";
default:
return "NONE";
}
......
......@@ -16,7 +16,7 @@
class Packet {
public:
enum OpCode {
DISCOVERY, GET, SET, LOGIN, RETURN, READ5
DISCOVERY, GET, RETURN, SET, CONFIRM
};
Packet(OpCode);
void encode(bytes&);
......
......@@ -36,29 +36,30 @@ int printPacket(Packet p) {
auto lookup =
(options.flags & FLAG_REVERSE) ? snd_lookup : rcv_lookup;
if (lookup.exists(d.type)) {
const table::set *s = lookup.get(d.type);
const table::set *s = lookup.get(d.type);
if (d.len > 0) {
switch (s->format) {
case table::STRING:
std::cout << "+\t" << s->name << " = "
<< &d.value[0] << std::dec << "\n";
std::cout << "+\t" << s->name << " = " << &d.value[0]
<< "\n";
break;
case table::HEX:
std::cout << "+\t" << s->name << " = "
<< std::hex << d.value << std::dec << "\n";
std::cout << "+\t" << s->name << " = " << d.value
<< "\n";
break;
case table::DEC:
std::cout << "+\t" << s->name << " = "
<< std::dec << d.value << std::dec << "\n";
case table::ACTION:
std::cout << "Error:" << s->name
<< " is marked as 'action' but carries payload."
<< d.value << "\n";
break;
default:
std::cout << "+\t" << s->name << " = "
<< std::hex << d.value << std::dec << "\n";
std::cout << "+\t" << s->name << " = " << d.value
<< "\n";
}
} else { //empty
std::cout << std::dec << ">\t" << s->name << "\n";
}
} else {//unknown id
} else { //unknown id
if (d.len > 0) {
std::cout << "##\t" << d.type << ":\n\t";
std::cout << std::hex << d.value << std::dec << "\n";
......@@ -176,7 +177,7 @@ int Program::getProperty() {
datasets d =a.getPayload();
Switch sw = Switch();
sw.parse(d);
Packet p = Packet(Packet::LOGIN);
Packet p = Packet(Packet::SET);
p.setSwitchMac(a.getSwitchMac());
p.setHostMac(host.getMac());
datasets t = { {snd_lookup["login_user"], 0, {}}};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment