]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OpenFlow: Rename and move a function.
authorDenis Ovsienko <[email protected]>
Sat, 26 Sep 2020 21:54:23 +0000 (22:54 +0100)
committerDenis Ovsienko <[email protected]>
Mon, 28 Sep 2020 12:58:12 +0000 (13:58 +0100)
Rename of10_data_print() to of_data_print(), move it to print-openflow.c
and declare it in openflow.h.

openflow.h
print-openflow-1.0.c
print-openflow.c

index f35648a5d7890ecfdd25bb251d93e919992c3e49..0b89008ecef3ffaf231ca83a525b51d6633780b3 100644 (file)
 #define ONF_EXP_OTRANS            0xff000007
 extern const struct tok onf_exp_str[];
 
+extern const char * of_vendor_name(const uint32_t);
+extern void of_data_print(netdissect_options *ndo,
+       const u_char *, const u_int);
+
 /*
  * Routines to print packets for various versions of OpenFlow.
  */
 extern void of10_header_body_print(netdissect_options *ndo,
        const u_char *, const uint8_t, uint16_t, const uint32_t);
-extern const char * of_vendor_name(const uint32_t);
index c699c6839d62ad1b227e5bd137fa9507a07d6277..473a8dc31a9342bdac744f9a18a79ec523401b14 100644 (file)
@@ -721,20 +721,6 @@ of10_bitmap_print(netdissect_options *ndo,
        ND_PRINT((v & u) ? ") (bogus)" : ")");
 }
 
-static void
-of10_data_print(netdissect_options *ndo,
-                const u_char *cp, const u_int len)
-{
-       if (len == 0)
-               return;
-       /* data */
-       ND_PRINT("\n\t data (%u octets)", len);
-       if (ndo->ndo_vflag >= 2)
-               hex_and_ascii_print(ndo, "\n\t  ", cp, len);
-       else
-               ND_TCHECK_LEN(cp, len);
-}
-
 static void
 of10_bsn_message_print(netdissect_options *ndo,
                        const u_char *cp, u_int len)
@@ -995,7 +981,7 @@ of10_vendor_action_print(netdissect_options *ndo,
        /* data */
        decoder =
                vendor == OUI_BSN         ? of10_bsn_actions_print         :
-               of10_data_print;
+               of_data_print;
        decoder(ndo, cp, len);
        return;
 
@@ -1020,7 +1006,7 @@ of10_vendor_message_print(netdissect_options *ndo,
        /* data */
        decoder =
                vendor == OUI_BSN         ? of10_bsn_message_print         :
-               of10_data_print;
+               of_data_print;
        decoder(ndo, cp, len);
        return;
 
@@ -1043,7 +1029,7 @@ of10_vendor_data_print(netdissect_options *ndo,
        OF_FWD(4);
        ND_PRINT(", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor));
        /* data */
-       of10_data_print(ndo, cp, len);
+       of_data_print(ndo, cp, len);
        return;
 
 invalid: /* skip the undersized data */
@@ -2080,7 +2066,7 @@ of10_error_print(netdissect_options *ndo,
        else
                ND_PRINT(", code invalid (0x%04x)", code);
        /* data */
-       of10_data_print(ndo, cp, len);
+       of_data_print(ndo, cp, len);
 }
 
 void
@@ -2190,7 +2176,7 @@ of10_header_body_print(netdissect_options *ndo,
        case OFPT_ECHO_REPLY: /* [OF10] Section 5.5.3 */
                if (ndo->ndo_vflag < 1)
                        break;
-               of10_data_print(ndo, cp, len);
+               of_data_print(ndo, cp, len);
                return;
 
        /* OpenFlow header, fixed-size message body and variable-size data. */
index f56b0a35882ad779ac353af8e81e5d59107633ba..f6cd31ace99a77572920950261cf8acd38b892d9 100644 (file)
@@ -66,6 +66,20 @@ of_vendor_name(const uint32_t vendor)
        return tok2str(table, "unknown", vendor);
 }
 
+void
+of_data_print(netdissect_options *ndo,
+              const u_char *cp, const u_int len)
+{
+       if (len == 0)
+               return;
+       /* data */
+       ND_PRINT("\n\t data (%u octets)", len);
+       if (ndo->ndo_vflag >= 2)
+               hex_and_ascii_print(ndo, "\n\t  ", cp, len);
+       else
+               ND_TCHECK_LEN(cp, len);
+}
+
 static void
 of_header_print(netdissect_options *ndo, const uint8_t version, const uint8_t type,
                       const uint16_t length, const uint32_t xid)