]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Put calls to print the management frame type in the switch statement,
authorguy <guy>
Sat, 30 Jul 2005 21:37:20 +0000 (21:37 +0000)
committerguy <guy>
Sat, 30 Jul 2005 21:37:20 +0000 (21:37 +0000)
rather than having a separate table; this makes it clearer that unknown
manaagement frame types already have a message printed, and that you
have to add a call to print that if a new management frame type is
created.

print-802_11.c

index 9a8f68ab30148bab57883ca32ee561000bbdba52..b403e5825cfe425af3c5ad7376ae2cef0becdf96 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.35 2005-07-30 18:48:35 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.36 2005-07-30 21:37:20 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -64,25 +64,6 @@ do { \
 static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
 #define NUM_AUTH_ALGS  (sizeof auth_alg_text / sizeof auth_alg_text[0])
 
 static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
 #define NUM_AUTH_ALGS  (sizeof auth_alg_text / sizeof auth_alg_text[0])
 
-static const char *subtype_text[16]={
-       "Assoc Request",
-       "Assoc Response",
-       "ReAssoc Request",
-       "ReAssoc Response",
-       "Probe Request",
-       "Probe Response",
-       "",
-       "",
-       "Beacon",
-       "ATIM",
-       "Disassociation",
-       "Authentication",
-       "DeAuthentication",
-       "",
-       "",
-       ""
-};
-
 static const char *status_text[] = {
        "Succesful",  /*  0  */
        "Unspecified failure",  /*  1  */
 static const char *status_text[] = {
        "Succesful",  /*  0  */
        "Unspecified failure",  /*  1  */
@@ -515,28 +496,36 @@ static int
 mgmt_body_print(u_int16_t fc, const struct mgmt_header_t *pmh,
     const u_char *p)
 {
 mgmt_body_print(u_int16_t fc, const struct mgmt_header_t *pmh,
     const u_char *p)
 {
-       printf("%s", subtype_text[FC_SUBTYPE(fc)]);
-
        switch (FC_SUBTYPE(fc)) {
        case ST_ASSOC_REQUEST:
        switch (FC_SUBTYPE(fc)) {
        case ST_ASSOC_REQUEST:
+               printf("Assoc Request");
                return handle_assoc_request(p);
        case ST_ASSOC_RESPONSE:
                return handle_assoc_request(p);
        case ST_ASSOC_RESPONSE:
+               printf("Assoc Response");
                return handle_assoc_response(p);
        case ST_REASSOC_REQUEST:
                return handle_assoc_response(p);
        case ST_REASSOC_REQUEST:
+               printf("ReAssoc Request");
                return handle_reassoc_request(p);
        case ST_REASSOC_RESPONSE:
                return handle_reassoc_request(p);
        case ST_REASSOC_RESPONSE:
+               printf("ReAssoc Response");
                return handle_reassoc_response(p);
        case ST_PROBE_REQUEST:
                return handle_reassoc_response(p);
        case ST_PROBE_REQUEST:
+               printf("Probe Request");
                return handle_probe_request(p);
        case ST_PROBE_RESPONSE:
                return handle_probe_request(p);
        case ST_PROBE_RESPONSE:
+               printf("Probe Response");
                return handle_probe_response(p);
        case ST_BEACON:
                return handle_probe_response(p);
        case ST_BEACON:
+               printf("Beacon");
                return handle_beacon(p);
        case ST_ATIM:
                return handle_beacon(p);
        case ST_ATIM:
+               printf("ATIM");
                return handle_atim();
        case ST_DISASSOC:
                return handle_atim();
        case ST_DISASSOC:
+               printf("Disassociation");
                return handle_disassoc(p);
        case ST_AUTH:
                return handle_disassoc(p);
        case ST_AUTH:
+               printf("Authentication");
                if (!TTEST2(*p, 3))
                        return 0;
                if ((p[0] == 0 ) && (p[1] == 0) && (p[2] == 0)) {
                if (!TTEST2(*p, 3))
                        return 0;
                if ((p[0] == 0 ) && (p[1] == 0) && (p[2] == 0)) {
@@ -545,6 +534,7 @@ mgmt_body_print(u_int16_t fc, const struct mgmt_header_t *pmh,
                }
                return handle_auth(p);
        case ST_DEAUTH:
                }
                return handle_auth(p);
        case ST_DEAUTH:
+               printf("DeAuthentication");
                return handle_deauth(pmh, p);
                break;
        default:
                return handle_deauth(pmh, p);
                break;
        default: