checkAPIs.pl: support for new-style dissectors in check_hf_entries
[metze/wireshark/wip.git] / epan / frame_data.h
index 2efdb39ab422b6147f313a874ee6556f4bf646ac..4da31019f2328c476209dd258a2bf7e573cf0f75 100644 (file)
@@ -1,36 +1,29 @@
 /* frame_data.h
  * Definitions for frame_data structures and routines
  *
- * $Id$
- *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #ifndef __FRAME_DATA_H__
 #define __FRAME_DATA_H__
 
-#include <epan/column_info.h>
-#include <epan/tvbuff.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ws_diag_control.h>
+#include <ws_symbol_export.h>
 #include <wsutil/nstime.h>
-#include "ws_symbol_export.h"
 
-#define PINFO_FD_NUM(pinfo)       ((pinfo)->fd->num)
+#include <wiretap/wtap.h>
+
+struct _packet_info;
+struct epan_session;
+
 #define PINFO_FD_VISITED(pinfo)   ((pinfo)->fd->flags.visited)
 
 /** @file
 
 /* Types of character encodings */
 typedef enum {
-       PACKET_CHAR_ENC_CHAR_ASCII       = 0,   /* ASCII */
-       PACKET_CHAR_ENC_CHAR_EBCDIC      = 1    /* EBCDIC */
+  PACKET_CHAR_ENC_CHAR_ASCII     = 0, /* ASCII */
+  PACKET_CHAR_ENC_CHAR_EBCDIC    = 1  /* EBCDIC */
 } packet_char_enc;
 
 /** The frame number is the ordinal number of the frame in the capture, so
    it's 1-origin.  In various contexts, 0 as a frame number means "frame
    number unknown". */
+struct _color_filter; /* Forward */
+DIAG_OFF_PEDANTIC
 typedef struct _frame_data {
   GSList      *pfd;          /**< Per frame proto data */
   guint32      num;          /**< Frame number */
-  guint32      interface_id; /**< identifier of the interface. */
-  guint32      pack_flags;   /**< Packet Flags */
   guint32      pkt_len;      /**< Packet length */
   guint32      cap_len;      /**< Amount actually captured */
   guint32      cum_bytes;    /**< Cumulative bytes into the capture */
   gint64       file_off;     /**< File offset */
   guint16      subnum;       /**< subframe number, for protocols that require this */
-  gint16       lnk_t;        /**< Per-packet encapsulation/data-link type */
+  gint16       tsprec;       /**< Time stamp precision */
   struct {
     unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
     unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
+    /* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
     unsigned int encoding       : 1; /**< Character encoding (ASCII, EBCDIC...) */
     unsigned int visited        : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
     unsigned int marked         : 1; /**< 1 = marked by user, 0 = normal */
     unsigned int ref_time       : 1; /**< 1 = marked as a reference time frame, 0 = normal */
     unsigned int ignored        : 1; /**< 1 = ignore this frame, 0 = normal */
     unsigned int has_ts         : 1; /**< 1 = has time stamp, 0 = no time stamp */
-    unsigned int has_if_id      : 1; /**< 1 = has interface ID, 0 = no interface ID */
-    unsigned int has_pack_flags : 1; /**< 1 = has packet flags, 0 = no packet flags */
+    unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
+    unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
+    unsigned int need_colorize  : 1; /**< 1 = need to (re-)calculate packet color */
   } flags;
 
-  const void *color_filter;  /**< Per-packet matching color_filter_t object */
+  const struct _color_filter *color_filter;  /**< Per-packet matching color_filter_t object */
 
   nstime_t     abs_ts;       /**< Absolute timestamp */
   nstime_t     shift_offset; /**< How much the abs_tm of the frame is shifted */
-  nstime_t     rel_ts;       /**< Relative timestamp (yes, it can be negative) */
-  const struct _frame_data *prev_dis;   /**< Previous displayed frame */
-  const struct _frame_data *prev_cap;   /**< Previous captured frame */
-  gchar        *opt_comment; /**< NULL if not available */
+  guint32      frame_ref_num; /**< Previous reference frame (0 if this is one) */
+  guint32      prev_dis_num; /**< Previous displayed frame (0 if first one) */
 } frame_data;
-
-#ifdef WANT_PACKET_EDITOR
-/* XXX, where this struct should go? */
-typedef struct {
-  struct wtap_pkthdr phdr; /**< Modified packet header */
-  char *pd;                /**< Modified packet data */
-} modified_frame_data;
-#endif
-
-/* Utility routines used by packet*.c */
-
-WS_DLL_PUBLIC void p_add_proto_data(frame_data *fd, int proto, guint8 key, void *proto_data);
-WS_DLL_PUBLIC void *p_get_proto_data(frame_data *fd, int proto, guint8 key);
-void p_remove_proto_data(frame_data *fd, int proto, guint8 key);
-gchar *p_get_proto_name_and_key(frame_data *fd, guint pfd_index);
+DIAG_ON_PEDANTIC
 
 /** compare two frame_datas */
-WS_DLL_PUBLIC gint frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field);
+WS_DLL_PUBLIC gint frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field);
 
 WS_DLL_PUBLIC void frame_data_reset(frame_data *fdata);
 
 WS_DLL_PUBLIC void frame_data_destroy(frame_data *fdata);
 
 WS_DLL_PUBLIC void frame_data_init(frame_data *fdata, guint32 num,
-                const struct wtap_pkthdr *phdr, gint64 offset,
+                const wtap_rec *rec, gint64 offset,
                 guint32 cum_bytes);
 
-extern void frame_delta_abs_time(const frame_data *fdata,
-                const frame_data *prev, nstime_t *delta);
+extern void frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata,
+                guint32 prev_num, nstime_t *delta);
 /**
  * Sets the frame data struct values before dissection.
  */
 WS_DLL_PUBLIC void frame_data_set_before_dissect(frame_data *fdata,
                 nstime_t *elapsed_time,
-                nstime_t *first_ts,
-                const frame_data *prev_dis,
-                const frame_data *prev_cap);
+                const frame_data **frame_ref,
+                const frame_data *prev_dis);
 
 WS_DLL_PUBLIC void frame_data_set_after_dissect(frame_data *fdata,
                 guint32 *cum_bytes);
 
 /** @} */
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif  /* __FRAME_DATA__ */
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */