]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-symantec.c
OpenFlow: Have a function for each message type.
[tcpdump] / print-symantec.c
index 5edb0b4e63dbbf91bb15ea392114cd87eb28a6df..8fe0c79fe644315dad09b5197f97cdfcb5fec5e3 100644 (file)
@@ -37,7 +37,7 @@ struct symantec_header {
        nd_byte     stuff2[36];
 };
 
-static inline void
+static void
 symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
        const struct symantec_header *sp;
@@ -45,7 +45,7 @@ symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
 
        sp = (const struct symantec_header *)bp;
 
-       etype = EXTRACT_BE_U_2(sp->ether_type);
+       etype = GET_BE_U_2(sp->ether_type);
        if (!ndo->ndo_qflag) {
                if (etype <= MAX_ETHERNET_LENGTH_VAL)
                          ND_PRINT("invalid ethertype %u", etype);
@@ -69,7 +69,7 @@ symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int length = h->len;
@@ -77,11 +77,14 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
        const struct symantec_header *sp;
        u_short ether_type;
 
+       ndo->ndo_protocol = "symantec";
        if (caplen < sizeof (struct symantec_header)) {
-               ND_PRINT("[|symantec]");
-               return caplen;
+               ndo->ndo_ll_hdr_len += caplen;
+               nd_print_trunc(ndo);
+               return;
        }
 
+       ndo->ndo_ll_hdr_len += sizeof (struct symantec_header);
        if (ndo->ndo_eflag)
                symantec_hdr_print(ndo, p, length);
 
@@ -90,7 +93,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
        sp = (const struct symantec_header *)p;
        p += sizeof (struct symantec_header);
 
-       ether_type = EXTRACT_BE_U_2(sp->ether_type);
+       ether_type = GET_BE_U_2(sp->ether_type);
 
        if (ether_type <= MAX_ETHERNET_LENGTH_VAL) {
                /* ether_type not known, print raw packet */
@@ -107,6 +110,4 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
        }
-
-       return (sizeof (struct symantec_header));
 }