Move headers outside extern C to fix build fail

This commit is contained in:
lingsheng 2021-07-27 14:48:41 +08:00
parent 6563f7e52a
commit 53f563ae7e
6 changed files with 1441 additions and 1 deletions

View File

@ -0,0 +1,185 @@
From e434d404d0db719440cc911729d225417a49b4f4 Mon Sep 17 00:00:00 2001
From: Guy Harris <gharris@sonic.net>
Date: Tue, 16 Mar 2021 04:33:00 -0700
Subject: [PATCH] Move even more headers outside extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
---
wsutil/cpu_info.h | 2 --
wsutil/file_util.h | 12 ++++++------
wsutil/plugins.h | 7 +++----
wsutil/processes.h | 19 ++++++++++++++-----
wsutil/time_util.h | 4 ++--
wsutil/unicode-utils.h | 10 ++++++----
6 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/wsutil/cpu_info.h b/wsutil/cpu_info.h
index 3579576..145b1be 100644
--- a/wsutil/cpu_info.h
+++ b/wsutil/cpu_info.h
@@ -17,8 +17,6 @@
extern "C" {
#endif /* __cplusplus */
-#include "ws_symbol_export.h"
-
WS_DLL_PUBLIC void get_cpu_info(GString *str);
#ifdef __cplusplus
diff --git a/wsutil/file_util.h b/wsutil/file_util.h
index 5d8f41a..1e8b726 100644
--- a/wsutil/file_util.h
+++ b/wsutil/file_util.h
@@ -15,10 +15,6 @@
#include "ws_symbol_export.h"
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#ifdef _WIN32
#include <io.h> /* for _read(), _write(), etc. */
#include <gmodule.h>
@@ -36,6 +32,12 @@ extern "C" {
#include <sys/stat.h> /* for stat() and struct stat */
#endif
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/*
* Visual C++ on Win32 systems doesn't define these. (Old UNIX systems don't
* define them either.)
@@ -55,8 +57,6 @@ extern "C" {
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
-#include <stdio.h>
-
#ifdef _WIN32
/*
diff --git a/wsutil/plugins.h b/wsutil/plugins.h
index 1a76c78..5ab8d0a 100644
--- a/wsutil/plugins.h
+++ b/wsutil/plugins.h
@@ -13,14 +13,13 @@
#include <glib.h>
+#include <gmodule.h>
+#include "ws_symbol_export.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <gmodule.h>
-
-#include "ws_symbol_export.h"
-
typedef void (*plugin_register_func)(void);
typedef void plugins_t;
diff --git a/wsutil/processes.h b/wsutil/processes.h
index 03c76e8..61655c8 100644
--- a/wsutil/processes.h
+++ b/wsutil/processes.h
@@ -13,6 +13,20 @@
#include "ws_symbol_export.h"
+#ifdef _WIN32
+/*
+ * On Windows, a process ID is a HANDLE.
+ * Include <windows.h> to make sure HANDLE is defined.
+ */
+#include <windows.h>
+#else
+/*
+ * On UN*X, a process ID is a pid_t.
+ * Include <sys/types.h> to make sure pid_t is defined.
+ */
+#include <sys/types.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -20,9 +34,7 @@ extern "C" {
#ifdef _WIN32
/*
* On Windows, a process ID is a HANDLE.
- * Include <windows.h> to make sure HANDLE is defined.
*/
-#include <windows.h>
typedef HANDLE ws_process_id;
@@ -30,10 +42,7 @@ typedef HANDLE ws_process_id;
#else
/*
* On UN*X, a process ID is a pid_t.
- * Include <sys/types.h> to make sure pid_t is defined.
*/
-#include <sys/types.h>
-
typedef pid_t ws_process_id;
#define WS_INVALID_PID -1
diff --git a/wsutil/time_util.h b/wsutil/time_util.h
index 1cd430d..045ab6a 100644
--- a/wsutil/time_util.h
+++ b/wsutil/time_util.h
@@ -12,12 +12,12 @@
#include "ws_symbol_export.h"
+#include <time.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <time.h>
-
WS_DLL_PUBLIC
time_t mktime_utc(struct tm *tm);
diff --git a/wsutil/unicode-utils.h b/wsutil/unicode-utils.h
index 8bb06ee..b7ab394 100644
--- a/wsutil/unicode-utils.h
+++ b/wsutil/unicode-utils.h
@@ -15,6 +15,12 @@
#include <glib.h>
+#ifdef _WIN32
+#include <windows.h>
+#include <tchar.h>
+#include <wchar.h>
+#endif
+
/**
* @file
* Unicode convenience routines.
@@ -29,10 +35,6 @@ int ws_utf8_char_len(guint8 ch);
#ifdef _WIN32
-#include <windows.h>
-#include <tchar.h>
-#include <wchar.h>
-
/** Given a UTF-8 string, convert it to UTF-16. This is meant to be used
* to convert between GTK+ 2.x (UTF-8) to Windows (UTF-16).
*
--
GitLab

View File

@ -0,0 +1,398 @@
From 1e1f4e6b5f9a309cef55d4459c8bba40d6acc104 Mon Sep 17 00:00:00 2001
From: Guy Harris <gharris@sonic.net>
Date: Tue, 16 Mar 2021 02:36:10 -0700
Subject: [PATCH] Move more headers outside extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
---
epan/color_filters.h | 4 ++--
epan/conversation.h | 4 ++--
epan/epan.h | 8 ++++----
epan/epan_dissect.h | 8 ++++----
epan/etypes.h | 4 ++--
epan/follow.h | 8 ++++----
epan/frame_data.h | 8 ++++----
epan/guid-utils.h | 7 +++++++
epan/maxmind_db.h | 8 ++++----
epan/oids.h | 8 ++++----
epan/prefs-int.h | 6 +++---
epan/prefs.h | 7 ++++---
epan/proto_data.h | 4 ++--
epan/rtp_pt.h | 6 +++---
epan/stat_tap_ui.h | 12 ++++++------
epan/value_string.h | 6 +++---
16 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/epan/color_filters.h b/epan/color_filters.h
index 4410864..d5c8014 100644
--- a/epan/color_filters.h
+++ b/epan/color_filters.h
@@ -12,12 +12,12 @@
#include "ws_symbol_export.h"
+#include <wsutil/color.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <wsutil/color.h>
-
struct epan_dissect;
#define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___"
diff --git a/epan/conversation.h b/epan/conversation.h
index 0059703..d77a413 100644
--- a/epan/conversation.h
+++ b/epan/conversation.h
@@ -13,6 +13,8 @@
#include "ws_symbol_export.h"
+#include "packet.h" /* for conversation dissector type */
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -46,8 +48,6 @@ extern "C" {
/* Flags to handle endpoints */
#define USE_LAST_ENDPOINT 0x08 /* Use last endpoint created, regardless of type */
-#include "packet.h" /* for conversation dissector type */
-
/* Types of port numbers Wireshark knows about. */
typedef enum {
ENDPOINT_NONE, /* no endpoint */
diff --git a/epan/epan.h b/epan/epan.h
index 95f47f8..76958fa 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -12,10 +12,6 @@
#include <glib.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/tvbuff.h>
#include <epan/prefs.h>
#include <epan/frame_data.h>
@@ -23,6 +19,10 @@ extern "C" {
#include "register.h"
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
typedef struct epan_dissect epan_dissect_t;
struct epan_dfilter;
diff --git a/epan/epan_dissect.h b/epan/epan_dissect.h
index 956a147..005120b 100644
--- a/epan/epan_dissect.h
+++ b/epan/epan_dissect.h
@@ -10,15 +10,15 @@
#ifndef EPAN_DISSECT_H
#define EPAN_DISSECT_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "epan.h"
#include "tvbuff.h"
#include "proto.h"
#include "packet_info.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/* Dissection of a single byte array. Holds tvbuff info as
* well as proto_tree info. As long as the epan_dissect_t for a byte
* array is in existence, you must not free or move that byte array,
diff --git a/epan/etypes.h b/epan/etypes.h
index e5928fb..5353ddd 100644
--- a/epan/etypes.h
+++ b/epan/etypes.h
@@ -13,12 +13,12 @@
#include "ws_symbol_export.h"
+#include <epan/value_string.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <epan/value_string.h>
-
/*
* Maximum length of an IEEE 802.3 frame; Ethernet type/length values
* less than or equal to it are lengths.
diff --git a/epan/follow.h b/epan/follow.h
index 99b2050..45cfaff 100644
--- a/epan/follow.h
+++ b/epan/follow.h
@@ -13,16 +13,16 @@
#ifndef __FOLLOW_H__
#define __FOLLOW_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/epan.h>
#include <epan/packet.h>
#include <epan/ipv6.h>
#include <epan/wmem/wmem.h>
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
typedef enum {
TCP_STREAM = 0,
UDP_STREAM,
diff --git a/epan/frame_data.h b/epan/frame_data.h
index b6fe4e7..19f0b56 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -11,16 +11,16 @@
#ifndef __FRAME_DATA_H__
#define __FRAME_DATA_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <ws_diag_control.h>
#include <ws_symbol_export.h>
#include <wsutil/nstime.h>
#include <wiretap/wtap.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
struct _packet_info;
struct epan_session;
diff --git a/epan/guid-utils.h b/epan/guid-utils.h
index d937878..b33f50f 100644
--- a/epan/guid-utils.h
+++ b/epan/guid-utils.h
@@ -25,6 +25,9 @@ typedef struct _e_guid_t {
guint8 data4[8];
} e_guid_t;
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
WS_DLL_PUBLIC void guids_init(void);
@@ -50,4 +53,8 @@ WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid);
WS_DLL_PUBLIC int guid_cmp(const e_guid_t *g1, const e_guid_t *g2);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif /* __GUID_UTILS_H__ */
diff --git a/epan/maxmind_db.h b/epan/maxmind_db.h
index 0bbf668..15e6ecb 100644
--- a/epan/maxmind_db.h
+++ b/epan/maxmind_db.h
@@ -13,14 +13,14 @@
#ifndef __MAXMIND_DB_H__
#define __MAXMIND_DB_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/ipv6.h>
#include <epan/prefs.h>
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
typedef struct _mmdb_lookup_t {
gboolean found;
const char *country;
diff --git a/epan/oids.h b/epan/oids.h
index 97075a1..a102c46 100644
--- a/epan/oids.h
+++ b/epan/oids.h
@@ -13,15 +13,15 @@
#ifndef __OIDS_H__
#define __OIDS_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/ftypes/ftypes.h>
#include <epan/prefs.h>
#include <epan/wmem/wmem.h>
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/**
*@file
*/
diff --git a/epan/prefs-int.h b/epan/prefs-int.h
index 8921c00..369a54a 100644
--- a/epan/prefs-int.h
+++ b/epan/prefs-int.h
@@ -12,14 +12,14 @@
#ifndef __PREFS_INT_H__
#define __PREFS_INT_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
#include <stdio.h>
#include "ws_symbol_export.h"
#include <epan/wmem/wmem.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
/**
*@file
*/
diff --git a/epan/prefs.h b/epan/prefs.h
index 29e4eaf..4229efc 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -13,9 +13,6 @@
#include <glib.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
#include <epan/params.h>
#include <epan/range.h>
@@ -24,6 +21,10 @@ extern "C" {
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#define PR_DEST_CMD 0
#define PR_DEST_FILE 1
diff --git a/epan/proto_data.h b/epan/proto_data.h
index 74c61a9..88f3e04 100644
--- a/epan/proto_data.h
+++ b/epan/proto_data.h
@@ -11,12 +11,12 @@
#ifndef __PROTO_DATA_H__
#define __PROTO_DATA_H__
+#include "ws_symbol_export.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "ws_symbol_export.h"
-
/* Allocator should be either pinfo->pool or wmem_file_scope() */
WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data);
WS_DLL_PUBLIC void *p_get_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key);
diff --git a/epan/rtp_pt.h b/epan/rtp_pt.h
index 74df568..5890a30 100644
--- a/epan/rtp_pt.h
+++ b/epan/rtp_pt.h
@@ -11,13 +11,13 @@
#ifndef __RTP_PT_H__
#define __RTP_PT_H__
+#include <epan/value_string.h>
+#include "ws_symbol_export.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <epan/value_string.h>
-#include "ws_symbol_export.h"
-
/*
* RTP Payload types
* Table B.2 / H.225.0
diff --git a/epan/stat_tap_ui.h b/epan/stat_tap_ui.h
index 20eb590..d6fca31 100644
--- a/epan/stat_tap_ui.h
+++ b/epan/stat_tap_ui.h
@@ -13,6 +13,12 @@
#include "ws_symbol_export.h"
+#include <epan/params.h>
+#include <epan/stat_groups.h>
+#include <epan/packet_info.h>
+#include <epan/tap.h>
+#include <epan/wmem/wmem.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -21,12 +27,6 @@ extern "C" {
* Parameters for taps.
*/
-#include <epan/params.h>
-#include <epan/stat_groups.h>
-#include <epan/packet_info.h>
-#include <epan/tap.h>
-#include <epan/wmem/wmem.h>
-
typedef enum {
PARAM_UINT, /* Unused? */
PARAM_STRING, /* Unused? */
diff --git a/epan/value_string.h b/epan/value_string.h
index e6ddd1a..c609695 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -13,13 +13,13 @@
#include <glib.h>
+#include "ws_symbol_export.h"
+#include "wmem/wmem.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "ws_symbol_export.h"
-#include "wmem/wmem.h"
-
/* VALUE TO STRING MATCHING */
typedef struct _value_string {
--
GitLab

View File

@ -0,0 +1,513 @@
From 2820156fbd4b0213ca015216d8cd97c31b503c8c Mon Sep 17 00:00:00 2001
From: Guy Harris <gharris@sonic.net>
Date: Tue, 16 Mar 2021 13:50:13 -0700
Subject: [PATCH] Move still *more* headers outside of extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
---
capchild/capture_session.h | 10 ++++++----
caputils/capture-pcap-util.h | 8 ++++----
caputils/ws80211_utils.h | 4 ++--
.../asn1/kerberos/packet-kerberos-template.h | 4 ++--
epan/dissectors/packet-a21.h | 4 ++--
epan/dissectors/packet-bluetooth.h | 8 ++++----
epan/dissectors/packet-scsi.h | 6 +++---
epan/dissectors/packet-tcp.h | 8 ++++----
epan/dissectors/packet-udp.h | 8 ++++----
epan/wmem/wmem_user_cb_int.h | 4 ++--
epan/wslua/init_wslua.h | 6 +++---
ui/export_object_ui.h | 4 ++--
ui/mcast_stream.h | 4 ++--
ui/packet_range.h | 8 ++++----
ui/proto_hier_stats.h | 6 +++---
ui/recent.h | 8 ++++----
ui/rtp_stream.h | 16 ++++++++--------
ui/tap-rlc-graph.h | 8 ++++----
ui/tap-sctp-analysis.h | 14 +++++++-------
ui/voip_calls.h | 18 +++++++++---------
20 files changed, 79 insertions(+), 77 deletions(-)
diff --git a/capchild/capture_session.h b/capchild/capture_session.h
index bdf1af3..0bf9565 100644
--- a/capchild/capture_session.h
+++ b/capchild/capture_session.h
@@ -10,10 +10,6 @@
#ifndef __CAPCHILD_CAPTURE_SESSION_H__
#define __CAPCHILD_CAPTURE_SESSION_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#ifndef _WIN32
#include <sys/types.h>
#include <stdint.h>
@@ -23,6 +19,12 @@ extern "C" {
#include <wsutil/processes.h>
+#include "cfile.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#ifdef HAVE_LIBPCAP
/* Current state of capture engine. XXX - differentiate states */
typedef enum {
diff --git a/caputils/capture-pcap-util.h b/caputils/capture-pcap-util.h
index c9e1f55..486cee9 100644
--- a/caputils/capture-pcap-util.h
+++ b/caputils/capture-pcap-util.h
@@ -10,10 +10,6 @@
#ifndef __CAPTURE_PCAP_UTIL_H__
#define __CAPTURE_PCAP_UTIL_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#ifdef HAVE_LIBPCAP
#include <wsutil/wspcap.h>
@@ -29,6 +25,10 @@ extern "C" {
*/
#define MIN_PACKET_SIZE 1 /* minimum amount of packet data we can read */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
GList *get_interface_list(int *err, char **err_str);
#ifdef HAVE_PCAP_REMOTE
GList *get_remote_interface_list(const char *hostname, const char *port,
diff --git a/caputils/ws80211_utils.h b/caputils/ws80211_utils.h
index a8b28cc..e90bc90 100644
--- a/caputils/ws80211_utils.h
+++ b/caputils/ws80211_utils.h
@@ -10,12 +10,12 @@
#ifndef __WS80211_UTILS_H__
#define __WS80211_UTILS_H__
+#include "ws_attributes.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "ws_attributes.h"
-
enum ws80211_channel_type {
WS80211_CHAN_NO_HT,
WS80211_CHAN_HT20,
diff --git a/epan/dissectors/asn1/kerberos/packet-kerberos-template.h b/epan/dissectors/asn1/kerberos/packet-kerberos-template.h
index f29fa68..3ca9f5e 100644
--- a/epan/dissectors/asn1/kerberos/packet-kerberos-template.h
+++ b/epan/dissectors/asn1/kerberos/packet-kerberos-template.h
@@ -12,12 +12,12 @@
#ifndef __PACKET_KERBEROS_H
#define __PACKET_KERBEROS_H
-#include "ws_symbol_export.h"
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+#include "ws_symbol_export.h"
+
/* This is a list of callback functions a caller can use to specify that
octet strings in kerberos to be passed back to application specific
dissectors, outside of kerberos.
diff --git a/epan/dissectors/packet-a21.h b/epan/dissectors/packet-a21.h
index 1877aa3..802b650 100644
--- a/epan/dissectors/packet-a21.h
+++ b/epan/dissectors/packet-a21.h
@@ -10,12 +10,12 @@
#ifndef __PACKET_A21_H__
#define __PACKET_A21_H__
+#include "ws_symbol_export.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "ws_symbol_export.h"
-
WS_DLL_PUBLIC
void dissect_a21_ie_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, proto_tree *tree, gint offset, guint8 message_type);
diff --git a/epan/dissectors/packet-bluetooth.h b/epan/dissectors/packet-bluetooth.h
index d59411b..0bd23f8 100644
--- a/epan/dissectors/packet-bluetooth.h
+++ b/epan/dissectors/packet-bluetooth.h
@@ -10,15 +10,15 @@
#ifndef __PACKET_BLUETOOTH_H__
#define __PACKET_BLUETOOTH_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/wmem/wmem.h>
#include "packet-usb.h"
#include "packet-ubertooth.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#define PROTO_DATA_BLUETOOTH_SERVICE_UUID 0
#define BLUETOOTH_DATA_SRC 0
diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h
index 408414e..4dce427 100644
--- a/epan/dissectors/packet-scsi.h
+++ b/epan/dissectors/packet-scsi.h
@@ -11,13 +11,13 @@
#ifndef __PACKET_SCSI_H_
#define __PACKET_SCSI_H_
+#include <epan/exceptions.h>
+#include <epan/srt_table.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <epan/exceptions.h>
-#include <epan/srt_table.h>
-
/* Structure containing itl nexus data :
* The itlq nexus is a structure containing data specific
* for a initiator target lun combination.
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index 3d2530f..255e4ab 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -10,16 +10,16 @@
#ifndef __PACKET_TCP_H__
#define __PACKET_TCP_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "ws_symbol_export.h"
#include <epan/conversation.h>
#include <epan/wmem/wmem.h>
#include <epan/wmem/wmem_interval_tree.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/* TCP flags */
#define TH_FIN 0x0001
#define TH_SYN 0x0002
diff --git a/epan/dissectors/packet-udp.h b/epan/dissectors/packet-udp.h
index 30857cb..6109ef4 100644
--- a/epan/dissectors/packet-udp.h
+++ b/epan/dissectors/packet-udp.h
@@ -11,14 +11,14 @@
#ifndef __PACKET_UDP_H__
#define __PACKET_UDP_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include "ws_symbol_export.h"
#include <epan/conversation.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/* UDP structs and definitions */
typedef struct _e_udphdr {
guint16 uh_sport;
diff --git a/epan/wmem/wmem_user_cb_int.h b/epan/wmem/wmem_user_cb_int.h
index ae51917..205f35f 100644
--- a/epan/wmem/wmem_user_cb_int.h
+++ b/epan/wmem/wmem_user_cb_int.h
@@ -14,12 +14,12 @@
#include <glib.h>
+#include "wmem_user_cb.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "wmem_user_cb.h"
-
WS_DLL_LOCAL
void
wmem_call_callbacks(wmem_allocator_t *allocator, wmem_cb_event_t event);
diff --git a/epan/wslua/init_wslua.h b/epan/wslua/init_wslua.h
index 8edb777..1fd0e88 100644
--- a/epan/wslua/init_wslua.h
+++ b/epan/wslua/init_wslua.h
@@ -11,13 +11,13 @@
#ifndef __INIT_WSLUA_H__
#define __INIT_WSLUA_H__
+#include "epan/register.h"
+#include "ws_symbol_export.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include "epan/register.h"
-#include "ws_symbol_export.h"
-
WS_DLL_PUBLIC int wslua_count_plugins(void);
WS_DLL_PUBLIC void wslua_reload_plugins (register_cb cb, gpointer client_data);
diff --git a/ui/export_object_ui.h b/ui/export_object_ui.h
index d0a80a1..6821c94 100644
--- a/ui/export_object_ui.h
+++ b/ui/export_object_ui.h
@@ -12,12 +12,12 @@
#ifndef __EXPORT_OBJECT_UI_H__
#define __EXPORT_OBJECT_UI_H__
+#include <epan/export_object.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <epan/export_object.h>
-
/* Common between protocols */
gboolean eo_save_entry(const gchar *save_as_filename, export_object_entry_t *entry, gboolean show_err);
diff --git a/ui/mcast_stream.h b/ui/mcast_stream.h
index 89d4bab..02b5ee9 100644
--- a/ui/mcast_stream.h
+++ b/ui/mcast_stream.h
@@ -18,12 +18,12 @@
#ifndef __MCAST_STREAM_H__
#define __MCAST_STREAM_H__
+#include <epan/tap.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <epan/tap.h>
-
#define MAX_SPEED 200000
/* typedefs for sliding window and buffer size */
diff --git a/ui/packet_range.h b/ui/packet_range.h
index e9b63c0..c1add38 100644
--- a/ui/packet_range.h
+++ b/ui/packet_range.h
@@ -15,15 +15,15 @@
#include <glib.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/range.h>
#include <epan/frame_data.h>
#include "cfile.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
extern guint32 curr_selected_frame;
typedef enum {
diff --git a/ui/proto_hier_stats.h b/ui/proto_hier_stats.h
index e3b4259..601263a 100644
--- a/ui/proto_hier_stats.h
+++ b/ui/proto_hier_stats.h
@@ -10,6 +10,9 @@
#ifndef __UI_PROTO_HIER_STATS_H__
#define __UI_PROTO_HIER_STATS_H__
+#include <epan/proto.h>
+#include "cfile.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -18,9 +21,6 @@ extern "C" {
* Protocol Hierarchy Statistics
*/
-#include <epan/proto.h>
-#include "cfile.h"
-
typedef struct {
header_field_info *hfinfo;
guint num_pkts_total;
diff --git a/ui/recent.h b/ui/recent.h
index a29b681..a2b3b1c 100644
--- a/ui/recent.h
+++ b/ui/recent.h
@@ -14,14 +14,14 @@
#include <glib.h>
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <stdio.h>
#include "epan/timestamp.h"
#include "ui/ws_ui_util.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/** @file
* Recent user interface settings.
* @ingroup main_window_group
diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h
index 65754a2..c6d0e35 100644
--- a/ui/rtp_stream.h
+++ b/ui/rtp_stream.h
@@ -16,6 +16,14 @@
#include <glib.h>
+#include "tap-rtp-analysis.h"
+#include <stdio.h>
+
+#include "cfile.h"
+
+#include <epan/address.h>
+#include <epan/tap.h>
+
/** @file
* "RTP Streams" dialog box common routines.
* @ingroup main_ui_group
@@ -25,14 +33,6 @@
extern "C" {
#endif /* __cplusplus */
-#include "tap-rtp-analysis.h"
-#include <stdio.h>
-
-#include "cfile.h"
-
-#include <epan/address.h>
-#include <epan/tap.h>
-
/** Defines an rtp stream */
typedef struct _rtp_stream_info {
address src_addr;
diff --git a/ui/tap-rlc-graph.h b/ui/tap-rlc-graph.h
index 8dfdc24..333bef3 100644
--- a/ui/tap-rlc-graph.h
+++ b/ui/tap-rlc-graph.h
@@ -10,15 +10,15 @@
#ifndef __TAP_RLC_GRAPH_H__
#define __TAP_RLC_GRAPH_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/epan.h>
#include <epan/packet.h>
#include <cfile.h>
#include <epan/dissectors/packet-rlc-lte.h>
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
struct rlc_segment {
struct rlc_segment *next;
guint32 num; /* framenum */
diff --git a/ui/tap-sctp-analysis.h b/ui/tap-sctp-analysis.h
index 16f7a23..2120e47 100644
--- a/ui/tap-sctp-analysis.h
+++ b/ui/tap-sctp-analysis.h
@@ -11,20 +11,20 @@
#ifndef __TAP_SCTP_ANALYSIS_H__
#define __TAP_SCTP_ANALYSIS_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <epan/dissectors/packet-sctp.h>
#include <epan/address.h>
-#ifndef _WIN32
+#ifdef _WIN32
+#include <winsock2.h>
+#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#else
-#include <winsock2.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#define CHUNK_TYPE_LENGTH 1
#define CHUNK_FLAGS_LENGTH 1
#define CHUNK_LENGTH_LENGTH 2
diff --git a/ui/voip_calls.h b/ui/voip_calls.h
index 3f0b76a..7862f35 100644
--- a/ui/voip_calls.h
+++ b/ui/voip_calls.h
@@ -24,15 +24,6 @@
#include <glib.h>
-/** @file
- * "VoIP Calls" dialog box common routines.
- * @ingroup main_ui_group
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
#include <stdio.h>
#include "epan/address.h"
@@ -42,6 +33,15 @@ extern "C" {
#include "epan/tap-voip.h"
#include "epan/sequence_analysis.h"
+/** @file
+ * "VoIP Calls" dialog box common routines.
+ * @ingroup main_ui_group
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/****************************************************************************/
extern const char *voip_call_state_name[8];
--
GitLab

View File

@ -0,0 +1,296 @@
From c8246c99737c7a844f45eb0e777382cc68397d17 Mon Sep 17 00:00:00 2001
From: Michal Ruprich <michalruprich@gmail.com>
Date: Wed, 10 Feb 2021 15:32:18 +0100
Subject: [PATCH] Moving glib.h out of extern C
---
caputils/capture_ifinfo.h | 4 ++--
epan/dissectors/dissectors.h | 3 +--
epan/epan.h | 3 ++-
epan/prefs.h | 4 ++--
epan/value_string.h | 3 ++-
epan/wmem/wmem_user_cb_int.h | 3 ++-
ui/packet_range.h | 4 ++--
ui/recent.h | 3 ++-
ui/rtp_media.h | 4 ++--
ui/rtp_stream.h | 3 ++-
ui/taps.h | 4 ++--
ui/voip_calls.h | 3 ++-
wsutil/file_util.h | 4 ++--
wsutil/plugins.h | 3 ++-
14 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/caputils/capture_ifinfo.h b/caputils/capture_ifinfo.h
index 8e42b64..0e2c792 100644
--- a/caputils/capture_ifinfo.h
+++ b/caputils/capture_ifinfo.h
@@ -10,12 +10,12 @@
#ifndef __CAPTURE_IFINFO_H__
#define __CAPTURE_IFINFO_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
typedef enum {
IF_WIRED,
IF_AIRPCAP,
diff --git a/epan/dissectors/dissectors.h b/epan/dissectors/dissectors.h
index 5ff81d2..15b510d 100644
--- a/epan/dissectors/dissectors.h
+++ b/epan/dissectors/dissectors.h
@@ -11,14 +11,13 @@
#ifndef __DISSECTOR_REGISTER_H__
#define __DISSECTOR_REGISTER_H__
+#include <glib.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
typedef struct _dissector_reg {
const char *cb_name;
void (*cb_func)(void);
diff --git a/epan/epan.h b/epan/epan.h
index 67e54dc..95f47f8 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -10,11 +10,12 @@
#ifndef __EPAN_H__
#define __EPAN_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include <epan/tvbuff.h>
#include <epan/prefs.h>
#include <epan/frame_data.h>
diff --git a/epan/prefs.h b/epan/prefs.h
index 7010a45..29e4eaf 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -11,12 +11,12 @@
#ifndef __PREFS_H__
#define __PREFS_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
#include <epan/params.h>
#include <epan/range.h>
diff --git a/epan/value_string.h b/epan/value_string.h
index 5fccabb..e6ddd1a 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -11,11 +11,12 @@
#ifndef __VALUE_STRING_H__
#define __VALUE_STRING_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include "ws_symbol_export.h"
#include "wmem/wmem.h"
diff --git a/epan/wmem/wmem_user_cb_int.h b/epan/wmem/wmem_user_cb_int.h
index 79ff154..ae51917 100644
--- a/epan/wmem/wmem_user_cb_int.h
+++ b/epan/wmem/wmem_user_cb_int.h
@@ -12,11 +12,12 @@
#ifndef __WMEM_USER_CB_INT_H__
#define __WMEM_USER_CB_INT_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include "wmem_user_cb.h"
WS_DLL_LOCAL
diff --git a/ui/packet_range.h b/ui/packet_range.h
index 9b0b5eb..e9b63c0 100644
--- a/ui/packet_range.h
+++ b/ui/packet_range.h
@@ -13,12 +13,12 @@
#ifndef __PACKET_RANGE_H__
#define __PACKET_RANGE_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
#include <epan/range.h>
#include <epan/frame_data.h>
diff --git a/ui/recent.h b/ui/recent.h
index cfafcc6..a29b681 100644
--- a/ui/recent.h
+++ b/ui/recent.h
@@ -12,11 +12,12 @@
#ifndef __RECENT_H__
#define __RECENT_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include <stdio.h>
#include "epan/timestamp.h"
#include "ui/ws_ui_util.h"
diff --git a/ui/rtp_media.h b/ui/rtp_media.h
index 3842582..2693b56 100644
--- a/ui/rtp_media.h
+++ b/ui/rtp_media.h
@@ -14,6 +14,8 @@
#ifndef __RTP_MEDIA_H__
#define __RTP_MEDIA_H__
+#include <glib.h>
+
/** @file
* "RTP Player" dialog box common routines.
* @ingroup main_ui_group
@@ -23,8 +25,6 @@
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
/****************************************************************************/
/* INTERFACE */
/****************************************************************************/
diff --git a/ui/rtp_stream.h b/ui/rtp_stream.h
index f280879..65754a2 100644
--- a/ui/rtp_stream.h
+++ b/ui/rtp_stream.h
@@ -14,6 +14,8 @@
#ifndef __RTP_STREAM_H__
#define __RTP_STREAM_H__
+#include <glib.h>
+
/** @file
* "RTP Streams" dialog box common routines.
* @ingroup main_ui_group
@@ -24,7 +26,6 @@ extern "C" {
#endif /* __cplusplus */
#include "tap-rtp-analysis.h"
-#include <glib.h>
#include <stdio.h>
#include "cfile.h"
diff --git a/ui/taps.h b/ui/taps.h
index 7718354..bc205d9 100644
--- a/ui/taps.h
+++ b/ui/taps.h
@@ -11,12 +11,12 @@
#ifndef __TAP_REGISTER_H__
#define __TAP_REGISTER_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
typedef struct _tap_reg {
const char *cb_name;
void (*cb_func)(void);
diff --git a/ui/voip_calls.h b/ui/voip_calls.h
index 5a72475..3f0b76a 100644
--- a/ui/voip_calls.h
+++ b/ui/voip_calls.h
@@ -22,6 +22,8 @@
#ifndef __VOIP_CALLS_H__
#define __VOIP_CALLS_H__
+#include <glib.h>
+
/** @file
* "VoIP Calls" dialog box common routines.
* @ingroup main_ui_group
@@ -31,7 +33,6 @@
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include <stdio.h>
#include "epan/address.h"
diff --git a/wsutil/file_util.h b/wsutil/file_util.h
index fe2f7ba..5d8f41a 100644
--- a/wsutil/file_util.h
+++ b/wsutil/file_util.h
@@ -11,14 +11,14 @@
#ifndef __FILE_UTIL_H__
#define __FILE_UTIL_H__
+#include <glib.h>
+
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
-
#ifdef _WIN32
#include <io.h> /* for _read(), _write(), etc. */
#include <gmodule.h>
diff --git a/wsutil/plugins.h b/wsutil/plugins.h
index 49c221e..1a76c78 100644
--- a/wsutil/plugins.h
+++ b/wsutil/plugins.h
@@ -11,11 +11,12 @@
#ifndef __PLUGINS_H__
#define __PLUGINS_H__
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <glib.h>
#include <gmodule.h>
#include "ws_symbol_export.h"
--
GitLab

View File

@ -0,0 +1,40 @@
From 7efb2120bc37cbb3b23682c16f5bb73e05295383 Mon Sep 17 00:00:00 2001
From: Guy Harris <gharris@sonic.net>
Date: Tue, 16 Mar 2021 14:57:30 -0700
Subject: [PATCH] kerberos: regenerate packet-kerberos.h.
We updated the template; regenerate the header.
---
epan/dissectors/packet-kerberos.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/epan/dissectors/packet-kerberos.h b/epan/dissectors/packet-kerberos.h
index 8af3a90..5072e01 100644
--- a/epan/dissectors/packet-kerberos.h
+++ b/epan/dissectors/packet-kerberos.h
@@ -90,6 +90,10 @@ extern gboolean krb_decrypt;
#endif /* HAVE_KERBEROS */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
/*--- Included file: packet-kerberos-exp.h ---*/
#line 1 "./asn1/kerberos/packet-kerberos-exp.h"
@@ -116,10 +120,7 @@ extern gboolean krb_decrypt;
int dissect_kerberos_ChangePasswdData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
/*--- End of included file: packet-kerberos-exp.h ---*/
-#line 86 "./asn1/kerberos/packet-kerberos-template.h"
+#line 89 "./asn1/kerberos/packet-kerberos-template.h"
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* __PACKET_KERBEROS_H */
--
GitLab

View File

@ -1,6 +1,6 @@
Name: wireshark Name: wireshark
Version: 2.6.2 Version: 2.6.2
Release: 18 Release: 19
Epoch: 1 Epoch: 1
Summary: Network traffic analyzer Summary: Network traffic analyzer
License: GPL+ and GPL-2.0+ and GPL-3.0 and GPL-3.0+ and BSD and ISC License: GPL+ and GPL-2.0+ and GPL-3.0 and GPL-3.0+ and BSD and ISC
@ -10,6 +10,11 @@ Source1: https://www.wireshark.org/download/src/all-versions/SIGNATURES-%
Patch0001: wireshark-0006-Move-tmp-to-var-tmp.patch Patch0001: wireshark-0006-Move-tmp-to-var-tmp.patch
Patch0002: wireshark-0007-cmakelists.patch Patch0002: wireshark-0007-cmakelists.patch
Patch0003: Moving-glib.h-out-of-extern-C.patch
Patch0004: Move-more-headers-outside-extern-C.patch
Patch0005: Move-even-more-headers-outside-extern-C.patch
Patch0006: Move-still-more-headers-outside-of-extern-C.patch
Patch0007: kerberos-regenerate-packet-kerberos-header.patch
Patch6000: wireshark-CVE-2018-16057.patch Patch6000: wireshark-CVE-2018-16057.patch
Patch6001: wireshark-CVE-2018-16058.patch Patch6001: wireshark-CVE-2018-16058.patch
@ -160,6 +165,9 @@ getent group usbmon >/dev/null || groupadd -r usbmon
%{_mandir}/man?/* %{_mandir}/man?/*
%changelog %changelog
* Tue Jul 27 2021 lingsheng <lingsheng@huawei.com> - 2.6.2-19
- Move headers outside extern C to fix build fail
* Thu Feb 25 2021 wangxiao <wangxiao65@huawei.com> - 2.6.2-18 * Thu Feb 25 2021 wangxiao <wangxiao65@huawei.com> - 2.6.2-18
- Fix CVE-2019-13619 CVE-2019-19553 CVE-2020-9428 CVE-2020-9431 - Fix CVE-2019-13619 CVE-2019-19553 CVE-2020-9428 CVE-2020-9431