]> The Tcpdump Group git mirrors - tcpdump/blobdiff - netdissect.h
NTP: Use tstr for truncation indicator.
[tcpdump] / netdissect.h
index ea77e74d4632acfc992fdae46e482702e162605f..26d6d47b3d1260d5da05ff481df3f25954977a7c 100644 (file)
@@ -82,19 +82,13 @@ extern int32_t thiszone;    /* seconds offset from gmt to local time */
 extern const char istr[];
 
 #if !defined(HAVE_SNPRINTF)
-int snprintf (char *str, size_t sz, const char *format, ...)
-#ifdef __ATTRIBUTE___FORMAT_OK
-     __attribute__((format (printf, 3, 4)))
-#endif /* __ATTRIBUTE___FORMAT_OK */
-     ;
+int snprintf (char *str, size_t sz, FORMAT_STRING(const char *format), ...)
+     PRINTFLIKE(3, 4);
 #endif /* !defined(HAVE_SNPRINTF) */
 
 #if !defined(HAVE_VSNPRINTF)
-int vsnprintf (char *str, size_t sz, const char *format, va_list ap)
-#ifdef __ATTRIBUTE___FORMAT_OK
-     __attribute__((format (printf, 3, 0)))
-#endif /* __ATTRIBUTE___FORMAT_OK */
-     ;
+int vsnprintf (char *str, size_t sz, FORMAT_STRING(const char *format),
+     va_list ap) PRINTFLIKE(3, 0);
 #endif /* !defined(HAVE_VSNPRINTF) */
 
 #ifndef HAVE_STRLCAT
@@ -158,8 +152,8 @@ struct netdissect_options {
   int ndo_uflag;               /* Print undecoded NFS handles */
   int ndo_vflag;               /* verbosity level */
   int ndo_xflag;               /* print packet in hex */
-  int ndo_Xflag;               /* print packet in hex/ascii */
-  int ndo_Aflag;               /* print packet only in ascii observing TAB,
+  int ndo_Xflag;               /* print packet in hex/ASCII */
+  int ndo_Aflag;               /* print packet only in ASCII observing TAB,
                                 * LF, CR and SPACE as graphical chars
                                 */
   int ndo_Hflag;               /* dissect 802.11s draft mesh standard */
@@ -192,27 +186,15 @@ struct netdissect_options {
   /* pointer to function to do regular output */
   int  (*ndo_printf)(netdissect_options *,
                     const char *fmt, ...)
-#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
-                    __attribute__ ((format (printf, 2, 3)))
-#endif
-                    ;
+                    PRINTFLIKE_FUNCPTR(2, 3);
   /* pointer to function to output errors */
-  void (*ndo_error)(netdissect_options *,
-                   const char *fmt, ...)
-#ifdef __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS
-                    __attribute__ ((noreturn))
-#endif /* __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS */
-#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
-                    __attribute__ ((format (printf, 2, 3)))
-#endif /* __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS */
-                    ;
+  void NORETURN_FUNCPTR (*ndo_error)(netdissect_options *,
+                                    const char *fmt, ...)
+                                    PRINTFLIKE_FUNCPTR(2, 3);
   /* pointer to function to output warnings */
   void (*ndo_warning)(netdissect_options *,
                      const char *fmt, ...)
-#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
-                    __attribute__ ((format (printf, 2, 3)))
-#endif
-                    ;
+                     PRINTFLIKE_FUNCPTR(2, 3);
 };
 
 #define PT_VAT         1       /* Visual Audio Tool */
@@ -264,15 +246,14 @@ struct netdissect_options {
  *       savefile header to control the size of the buffer they allocate,
  *       so a size of, say, 2^31-1 might not work well.
  *
- * XXX - does it need to be bigger still?
+ * XXX - does it need to be bigger still?  Note that, for versions of
+ * libpcap with pcap_create()/pcap_activate(), if no -s flag is specified
+ * or -s 0 is specified, we won't set the snapshot length at all, and will
+ * let libpcap choose a snapshot length; newer versions may choose a bigger
+ * value than 262144 for D-Bus, for example.
  */
 #define MAXIMUM_SNAPLEN        262144
 
-/*
- * The default snapshot length is the maximum.
- */
-#define DEFAULT_SNAPLEN        MAXIMUM_SNAPLEN
-
 #define ESRC(ep) ((ep)->ether_shost)
 #define EDST(ep) ((ep)->ether_dhost)
 
@@ -328,10 +309,12 @@ struct netdissect_options {
 #define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
 
 extern void ts_print(netdissect_options *, const struct timeval *);
-extern void relts_print(netdissect_options *, int);
+extern void signed_relts_print(netdissect_options *, int32_t);
+extern void unsigned_relts_print(netdissect_options *, uint32_t);
 
 extern void fn_print_char(netdissect_options *, u_char);
 extern int fn_print(netdissect_options *, const u_char *, const u_char *);
+extern u_int fn_printztn(netdissect_options *ndo, const u_char *, u_int, const u_char *);
 extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
 extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
 
@@ -545,7 +528,7 @@ extern void lwapp_control_print(netdissect_options *, const u_char *, u_int, int
 extern void lwapp_data_print(netdissect_options *, const u_char *, u_int);
 extern void lwres_print(netdissect_options *, const u_char *, u_int);
 extern void m3ua_print(netdissect_options *, const u_char *, const u_int);
-extern void medsa_print(netdissect_options *, const u_char *, u_int, u_int);
+extern void medsa_print(netdissect_options *, const u_char *, u_int, u_int, const struct lladdr_info *, const struct lladdr_info *);
 extern u_int mfr_print(netdissect_options *, register const u_char *, u_int);
 extern void mobile_print(netdissect_options *, const u_char *, u_int);
 extern int mobility_print(netdissect_options *, const u_char *, const u_char *);