]> The Tcpdump Group git mirrors - tcpdump/blobdiff - netdissect.h
the failed/passed count was not kept in the right place
[tcpdump] / netdissect.h
index 7decd4c0c4d4dd6b3f5147a57c9a7ece51842c6f..66ae4fad97031d5748b5739f37815f2e5537b008 100644 (file)
@@ -112,8 +112,6 @@ typedef unsigned char nd_byte;
 #define        roundup2(x, y)  (((x)+((y)-1))&(~((y)-1)))
 #endif
 
-/* nd_snprintf et al */
-
 #include <stdarg.h>
 #include <pcap.h>
 
@@ -180,12 +178,18 @@ typedef u_int (*if_printer) IF_PRINTER_ARGS;
  *
  * A buffer has a beginnning and end pointer, and a link to the previous
  * buffer on the stack.
+ *
+ * In other cases, we temporarily adjust the snapshot end to reflect a
+ * packet-length field in the packet data and, when finished dissecting
+ * that part of the packet, restore the old snapshot end.  We keep that
+ * on the stack with null buffer pointer, meaning there's nothing to
+ * free.
  */
-struct netdissect_saved_info {
-  u_char *ndsi_buffer;                         /* pointer to allocated buffer data */
-  const u_char *ndsi_packetp;                  /* saved beginning of data */
-  const u_char *ndsi_snapend;                  /* saved end of data */
-  struct netdissect_saved_info *ndsi_prev;     /* previous buffer on the stack */
+struct netdissect_saved_packet_info {
+  u_char *ndspi_buffer;                                        /* pointer to allocated buffer data */
+  const u_char *ndspi_packetp;                         /* saved beginning of data */
+  const u_char *ndspi_snapend;                         /* saved end of data */
+  struct netdissect_saved_packet_info *ndspi_prev;     /* previous buffer on the stack */
 };
 
 struct netdissect_options {
@@ -228,8 +232,8 @@ struct netdissect_options {
   const u_char *ndo_packetp;
   const u_char *ndo_snapend;
 
-  /* stack of saved buffer information */
-  struct netdissect_saved_info *ndo_buffer_stack;
+  /* stack of saved packet boundary and buffer information */
+  struct netdissect_saved_packet_info *ndo_packet_info_stack;
 
   /* pointer to the if_printer function */
   if_printer ndo_if_printer;
@@ -255,8 +259,10 @@ struct netdissect_options {
 
 extern int nd_push_buffer(netdissect_options *, u_char *, const u_char *,
     const u_char *);
-extern void nd_pop_buffer(netdissect_options *);
-extern void nd_pop_all_buffers(netdissect_options *);
+extern int nd_push_snapend(netdissect_options *, const u_char *);
+extern void nd_change_snapend(netdissect_options *, const u_char *);
+extern void nd_pop_packet_info(netdissect_options *);
+extern void nd_pop_all_packet_info(netdissect_options *);
 
 #define PT_VAT         1       /* Visual Audio Tool */
 #define PT_WB          2       /* distributed White Board */
@@ -558,6 +564,7 @@ extern int ah_print(netdissect_options *, const u_char *);
 extern void ahcp_print(netdissect_options *, const u_char *, const u_int);
 extern void aodv_print(netdissect_options *, const u_char *, u_int, int);
 extern void aoe_print(netdissect_options *, const u_char *, const u_int);
+extern int  arista_ethertype_print(netdissect_options *,const u_char *, u_int);
 extern void arp_print(netdissect_options *, const u_char *, u_int, u_int);
 extern void ascii_print(netdissect_options *, const u_char *, u_int);
 extern void atalk_print(netdissect_options *, const u_char *, u_int);
@@ -578,7 +585,7 @@ extern void cnfp_print(netdissect_options *, const u_char *);
 extern void dccp_print(netdissect_options *, const u_char *, const u_char *, u_int);
 extern void decnet_print(netdissect_options *, const u_char *, u_int, u_int);
 extern void dhcp6_print(netdissect_options *, const u_char *, u_int);
-extern int dstopt_print(netdissect_options *, const u_char *);
+extern int dstopt_process(netdissect_options *, const u_char *);
 extern void dtp_print(netdissect_options *, const u_char *, u_int);
 extern void dvmrp_print(netdissect_options *, const u_char *, u_int);
 extern void eap_print(netdissect_options *, const u_char *, u_int);
@@ -586,7 +593,7 @@ extern void egp_print(netdissect_options *, const u_char *, u_int);
 extern void eigrp_print(netdissect_options *, const u_char *, u_int);
 extern void esp_print(netdissect_options *, const u_char *, u_int, const u_char *, u_int, int, u_int);
 extern u_int ether_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *);
-extern u_int ether_hdr_len_print(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), const u_char *, u_int);
+extern u_int ether_print_switch_tag(netdissect_options *, const u_char *, u_int, u_int, void (*)(netdissect_options *, const u_char *), u_int);
 extern int ethertype_print(netdissect_options *, u_short, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
 extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
 extern void forces_print(netdissect_options *, const u_char *, u_int);
@@ -596,7 +603,7 @@ extern void ftp_print(netdissect_options *, const u_char *, u_int);
 extern void geneve_print(netdissect_options *, const u_char *, u_int);
 extern void geonet_print(netdissect_options *, const u_char *, u_int, const struct lladdr_info *);
 extern void gre_print(netdissect_options *, const u_char *, u_int);
-extern int hbhopt_print(netdissect_options *, const u_char *);
+extern int hbhopt_process(netdissect_options *, const u_char *, int *, uint32_t *);
 extern void hex_and_ascii_print(netdissect_options *, const char *, const u_char *, u_int);
 extern void hex_print(netdissect_options *, const char *ident, const u_char *cp, u_int);
 extern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp, u_int, u_int);
@@ -681,6 +688,7 @@ extern void rtsp_print(netdissect_options *, const u_char *, u_int);
 extern void rx_print(netdissect_options *, const u_char *, u_int, u_int, u_int, const u_char *);
 extern void sctp_print(netdissect_options *, const u_char *, const u_char *, u_int);
 extern void sflow_print(netdissect_options *, const u_char *, u_int);
+extern void ssh_print(netdissect_options *, const u_char *, u_int);
 extern void sip_print(netdissect_options *, const u_char *, u_int);
 extern void slow_print(netdissect_options *, const u_char *, u_int);
 extern void smb_data_print(netdissect_options *, const u_char *, u_int);
@@ -734,6 +742,7 @@ extern uint16_t nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, c
 /* Utilities */
 extern void nd_print_trunc(netdissect_options *);
 extern void nd_print_protocol(netdissect_options *);
+extern void nd_print_protocol_caps(netdissect_options *);
 extern void nd_print_invalid(netdissect_options *);
 
 extern int mask2plen(uint32_t);