]> git.sur5r.net Git - ngadmin/commitdiff
Handle ports duplex mode
authordarkcoven <admin@darkcoven.tk>
Tue, 8 Apr 2014 17:30:35 +0000 (19:30 +0200)
committerdarkcoven <admin@darkcoven.tk>
Tue, 8 Apr 2014 18:56:53 +0000 (20:56 +0200)
cli/src/com_ports.c
emu/src/emu.c
lib/include/ngadmin.h
raw/src/attr.c
spy/src/spy.c
wireshark/nsdp.lua

index 3337b435d3d2f9a8a22b0002bd095b98bcf6ef52..6cf0c813e492f25e3b91d2b4e0c3d406486bb292 100644 (file)
@@ -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:
index 8526ca3c60e0e9ea2ee27d070f2dc2b1961f7662..ecf8d6f6e1def2712ac4c3cfc81869ad3e56d155 100644 (file)
@@ -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;
index 49dc761cd2edbac0798cbf69c174651620e78441..7f8a5043a84d680cadc3915aceb8347f2fb03139 100644 (file)
@@ -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 */
 };
 
 
index aec75843bd1ad4af4e04a4283614924e918bcc62..ec8a0daad9574c334fe3558e2c5d8241a971f91a 100644 (file)
@@ -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:
index 20068906348a4ceee75ac5885c34c24bbd9c3b51..70a3eb96996cad547a0f0d314735acf66493c192 100644 (file)
@@ -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";
index 2518559f103fac802e3f40a41f5dbcfcb6ab1a5c..6703a2169af1e0e7eba10fefb71bb2f90d66191c 100644 (file)
@@ -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"
 }