]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-symantec.c
Add EXTRACT_ calls.
[tcpdump] / print-symantec.c
index 39d8b65162774f5f19558b3926bbf16af9922af2..e80bd45c626673af5fc661f789558b6425914042 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define NETDISSECT_REWORKED
+/* \summary: Symantec Enterprise Firewall printer */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 #include "ethertype.h"
 
-#include "ether.h"
-
 struct symantec_header {
-       u_int8_t  stuff1[6];
-       u_int16_t ether_type;
-       u_int8_t  stuff2[36];
+       uint8_t  stuff1[6];
+       uint16_t ether_type;
+       uint8_t  stuff2[36];
 };
 
 static inline void
-symantec_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int length)
+symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
-       register const struct symantec_header *sp;
-       u_int16_t etype;
+       const struct symantec_header *sp;
+       uint16_t etype;
 
        sp = (const struct symantec_header *)bp;
 
-       etype = EXTRACT_16BITS(&sp->ether_type);
+       etype = EXTRACT_BE_U_2(&sp->ether_type);
        if (!ndo->ndo_qflag) {
-               if (etype <= ETHERMTU)
+               if (etype <= MAX_ETHERNET_LENGTH_VAL)
                          ND_PRINT((ndo, "invalid ethertype %u", etype));
                 else
                          ND_PRINT((ndo, "ethertype %s (0x%04x)",
                                       tok2str(ethertype_values,"Unknown", etype),
                                        etype));
         } else {
-                if (etype <= ETHERMTU)
+                if (etype <= MAX_ETHERNET_LENGTH_VAL)
                           ND_PRINT((ndo, "invalid ethertype %u", etype));
                 else
                           ND_PRINT((ndo, "%s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", etype)));
@@ -75,7 +74,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
 {
        u_int length = h->len;
        u_int caplen = h->caplen;
-       struct symantec_header *sp;
+       const struct symantec_header *sp;
        u_short ether_type;
 
        if (caplen < sizeof (struct symantec_header)) {
@@ -88,22 +87,22 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
 
        length -= sizeof (struct symantec_header);
        caplen -= sizeof (struct symantec_header);
-       sp = (struct symantec_header *)p;
+       sp = (const struct symantec_header *)p;
        p += sizeof (struct symantec_header);
 
-       ether_type = EXTRACT_16BITS(&sp->ether_type);
+       ether_type = EXTRACT_BE_U_2(&sp->ether_type);
 
-       if (ether_type <= ETHERMTU) {
+       if (ether_type <= MAX_ETHERNET_LENGTH_VAL) {
                /* ether_type not known, print raw packet */
                if (!ndo->ndo_eflag)
-                       symantec_hdr_print(ndo, (u_char *)sp, length + sizeof (struct symantec_header));
+                       symantec_hdr_print(ndo, (const u_char *)sp, length + sizeof (struct symantec_header));
 
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
-       } else if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
+       } else if (ethertype_print(ndo, ether_type, p, length, caplen, NULL, NULL) == 0) {
                /* ether_type not known, print raw packet */
                if (!ndo->ndo_eflag)
-                       symantec_hdr_print(ndo, (u_char *)sp, length + sizeof (struct symantec_header));
+                       symantec_hdr_print(ndo, (const u_char *)sp, length + sizeof (struct symantec_header));
 
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);