From: darkcoven Date: Tue, 8 Apr 2014 17:30:35 +0000 (+0200) Subject: Handle ports duplex mode X-Git-Url: https://git.sur5r.net/?p=ngadmin;a=commitdiff_plain;h=d926beda08aeff1b8c54af22563a3fc21c9f6c1d Handle ports duplex mode --- diff --git a/cli/src/com_ports.c b/cli/src/com_ports.c index 3337b43..6cf0c81 100644 --- a/cli/src/com_ports.c +++ b/cli/src/com_ports.c @@ -38,16 +38,24 @@ int do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga) printf("down"); break; - case SPEED_10: - printf("up, 10M"); + case SPEED_10_HD: + printf("up, 10M half-duplex"); break; - case SPEED_100: - printf("up, 100M"); + case SPEED_10_FD: + printf("up, 10M full-duplex"); break; - case SPEED_1000: - printf("up, 1000M"); + case SPEED_100_HD: + printf("up, 100M half-duplex"); + break; + + case SPEED_100_FD: + printf("up, 100M full-duplex"); + break; + + case SPEED_1000_FD: + printf("up, 1000M full-duplex"); break; default: diff --git a/emu/src/emu.c b/emu/src/emu.c index 8526ca3..ecf8d6f 100644 --- a/emu/src/emu.c +++ b/emu/src/emu.c @@ -505,7 +505,7 @@ int main (int argc, char **argv) swi.ports = malloc(swi.ports_count * sizeof(struct port_info)); memset(swi.ports, 0, swi.ports_count * sizeof(struct port_info)); for (p = 0; p < swi.ports_count; p++) { - swi.ports[p].state = SPEED_1000; + swi.ports[p].state = SPEED_1000_FD; swi.ports[p].pvid = 1; swi.ports[p].bitrate_in = BITRATE_NOLIMIT; swi.ports[p].bitrate_out = BITRATE_NOLIMIT; diff --git a/lib/include/ngadmin.h b/lib/include/ngadmin.h index 49dc761..7f8a504 100644 --- a/lib/include/ngadmin.h +++ b/lib/include/ngadmin.h @@ -63,9 +63,11 @@ enum { enum { SPEED_UNK = -1, /**< unknown status */ SPEED_DOWN = 0, /**< link down */ - SPEED_10 = 1, /**< 10 Mb/s */ - SPEED_100 = 4, /**< 100 Mb/s */ - SPEED_1000 = 5 /**< 1000 Mb/s */ + SPEED_10_HD = 1, /**< 10 Mb/s half duplex */ + SPEED_10_FD = 2, /**< 10 Mb/s full duplex */ + SPEED_100_HD = 3, /**< 100 Mb/s half duplex */ + SPEED_100_FD = 4, /**< 100 Mb/s full duplex */ + SPEED_1000_FD = 5 /**< 1000 Mb/s full duplex */ }; diff --git a/raw/src/attr.c b/raw/src/attr.c index aec7584..ec8a0da 100644 --- a/raw/src/attr.c +++ b/raw/src/attr.c @@ -77,9 +77,11 @@ static int ports_status_endecode (struct attr *at) switch (ps->status) { case SPEED_DOWN: - case SPEED_10: - case SPEED_100: - case SPEED_1000: + case SPEED_10_HD: + case SPEED_10_FD: + case SPEED_100_HD: + case SPEED_100_FD: + case SPEED_1000_FD: return 0; default: diff --git a/spy/src/spy.c b/spy/src/spy.c index 2006890..70a3eb9 100644 --- a/spy/src/spy.c +++ b/spy/src/spy.c @@ -66,14 +66,20 @@ static const char* port_status_str (unsigned char status) case SPEED_DOWN: return "down"; - case SPEED_10: - return "10M"; + case SPEED_10_HD: + return "10M half-duplex"; - case SPEED_100: - return "100M"; + case SPEED_10_FD: + return "10M full-duplex"; - case SPEED_1000: - return "1000M"; + case SPEED_100_HD: + return "100M half-duplex"; + + case SPEED_100_FD: + return "100M full-duplex"; + + case SPEED_1000_FD: + return "1000M full-duplex"; default: return "unknown"; diff --git a/wireshark/nsdp.lua b/wireshark/nsdp.lua index 2518559..6703a21 100644 --- a/wireshark/nsdp.lua +++ b/wireshark/nsdp.lua @@ -40,9 +40,11 @@ local error_codes = { local status_codes = { [0] = "down", - [1] = "10M", - [4] = "100M", - [5] = "1000M" + [1] = "10M half-duplex", + [2] = "10M full-duplex", + [3] = "100M half-duplex", + [4] = "100M full-duplex", + [5] = "1000M full-duplex" }