From 6b178bd41548b561913be45a6ee649a497ec5d1f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 29 Dec 2011 00:08:47 +0000 Subject: Add 'extern "C"' wrappers and #include guards to various header files. svn path=/trunk/; revision=40321 --- airpcap_loader.h | 8 ++++++++ capture-pcap-util.h | 4 ++-- capture-wpcap.h | 10 +++++++++- capture.h | 8 ++++++++ capture_ifinfo.h | 8 ++++++++ capture_info.h | 9 ++++++++- capture_opts.h | 8 ++++++++ capture_ui_utils.h | 10 +++++++++- capture_wpcap_packet.h | 6 ++++++ cfile.h | 8 ++++++++ color.h | 10 +++++++++- color_filters.h | 8 +++++++- disabled_protos.h | 13 +++++++++++++ epan/base64.h | 3 ++- epan/epan.h | 8 ++++++++ epan/epan_dissect.h | 7 +++++++ epan/ex-opt.h | 12 ++++++++++-- epan/prefs.h | 8 ++++++++ epan/strutil.h | 8 ++++++++ epan/timestamp.h | 8 ++++++++ epan/tvbuff.h | 8 ++++++++ file.h | 7 +++++++ filters.h | 12 ++++++++++++ globals.h | 6 +++--- gtk/recent.h | 16 ++++++++++++---- main_statusbar.h | 7 +++++++ progress_dlg.h | 10 +++++++++- register.h | 9 +++++++++ 28 files changed, 221 insertions(+), 18 deletions(-) diff --git a/airpcap_loader.h b/airpcap_loader.h index 765fde330e..823b658d24 100644 --- a/airpcap_loader.h +++ b/airpcap_loader.h @@ -30,6 +30,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* Error values from "get_airpcap_interface_list()". */ #define CANT_GET_AIRPCAP_INTERFACE_LIST 0 /* error getting list */ #define NO_AIRPCAP_INTERFACES_FOUND 1 /* list is empty */ @@ -551,4 +555,8 @@ get_compiled_airpcap_version(GString *str); void get_runtime_airpcap_version(GString *str); +#ifdef __cplusplus +} #endif + +#endif /* __AIRPCAP_LOADER_H__ */ diff --git a/capture-pcap-util.h b/capture-pcap-util.h index fa16c5c74e..781979e05e 100644 --- a/capture-pcap-util.h +++ b/capture-pcap-util.h @@ -27,12 +27,12 @@ #ifdef HAVE_LIBPCAP +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include - /* * A snapshot length of 0 is useless - and libpcap/WinPcap don't guarantee * that a snapshot length of 0 will work, and, on some platforms, it won't diff --git a/capture-wpcap.h b/capture-wpcap.h index c3b45ea230..cfe23828d7 100644 --- a/capture-wpcap.h +++ b/capture-wpcap.h @@ -25,10 +25,18 @@ #ifndef CAPTURE_WPCAP_H #define CAPTURE_WPCAP_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern gboolean has_wpcap; void load_wpcap(void); -#endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* CAPTURE_WPCAP_H */ diff --git a/capture.h b/capture.h index a09829d58e..d4cc76986b 100644 --- a/capture.h +++ b/capture.h @@ -33,6 +33,10 @@ #include "capture_opts.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef enum { capture_cb_capture_prepared, capture_cb_capture_update_started, @@ -123,4 +127,8 @@ extern gboolean capture_stats(if_stat_cache_t *sc, char *ifname, struct pcap_sta */ void capture_stat_stop(if_stat_cache_t *sc); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* capture.h */ diff --git a/capture_ifinfo.h b/capture_ifinfo.h index ea18085bb7..e96dfb6cfb 100644 --- a/capture_ifinfo.h +++ b/capture_ifinfo.h @@ -25,6 +25,10 @@ #ifndef __CAPTURE_IFINFO_H__ #define __CAPTURE_IFINFO_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * The list of interfaces returned by "get_interface_list()" is * a list of these structures. @@ -93,4 +97,8 @@ void free_if_capabilities(if_capabilities_t *caps); void add_interface_to_remote_list(if_info_t *if_info); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __CAPTURE_IFINFO_H__ */ diff --git a/capture_info.h b/capture_info.h index 29df790178..0fd08cdd7b 100644 --- a/capture_info.h +++ b/capture_info.h @@ -24,7 +24,7 @@ /** @file - * + * * capture info functions * */ @@ -34,6 +34,10 @@ #include "capture_opts.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* open the info - init values (wtap, counts), create dialog */ extern void capture_info_open(capture_options *capture_opts); @@ -73,5 +77,8 @@ capture_info *cinfo); extern void capture_info_ui_destroy( capture_info *cinfo); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* capture_info.h */ diff --git a/capture_opts.h b/capture_opts.h index 7778bf49af..baa40099a7 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -38,6 +38,10 @@ #include "capture_ifinfo.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Current state of capture engine. XXX - differentiate states */ typedef enum { CAPTURE_STOPPED, /**< stopped */ @@ -190,4 +194,8 @@ capture_opts_trim_ring_num_files(capture_options *capture_opts); extern gboolean capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* capture_opts.h */ diff --git a/capture_ui_utils.h b/capture_ui_utils.h index a7531b5b60..f2c6f4c117 100644 --- a/capture_ui_utils.h +++ b/capture_ui_utils.h @@ -27,6 +27,10 @@ #include "capture_opts.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** @file * GList of available capture interfaces. */ @@ -99,4 +103,8 @@ char *build_capture_combo_name(GList *if_list, gchar *if_name); */ const char *get_iface_description_for_interface(capture_options *capture_opts, guint i); -#endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CAPTURE_UI_UTILS_H__ */ diff --git a/capture_wpcap_packet.h b/capture_wpcap_packet.h index 4aeb756c96..044547bfe2 100644 --- a/capture_wpcap_packet.h +++ b/capture_wpcap_packet.h @@ -25,6 +25,9 @@ #ifndef CAPTURE_WPCAP_PACKET_H #define CAPTURE_WPCAP_PACKET_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ extern void wpcap_packet_load(void); @@ -43,5 +46,8 @@ extern int wpcap_packet_request_uint(void *a, ULONG Oid, UINT *value); extern int wpcap_packet_request_ulong(void *a, ULONG Oid, ULONG *value); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* CAPTURE_WPCAP_PACKET_H */ diff --git a/cfile.h b/cfile.h index 163f4ca426..730da187c7 100644 --- a/cfile.h +++ b/cfile.h @@ -27,6 +27,10 @@ #include "frame_data_sequence.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Current state of file. */ typedef enum { FILE_CLOSED, /* No file open */ @@ -115,4 +119,8 @@ typedef struct _capture_file { extern void cap_file_init(capture_file *cf); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* cfile.h */ diff --git a/color.h b/color.h index 622b6ab7f1..7a55cf66ed 100644 --- a/color.h +++ b/color.h @@ -25,6 +25,10 @@ #ifndef __COLOR_H__ #define __COLOR_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Data structure holding RGB value for a color. * @@ -52,4 +56,8 @@ typedef struct { */ gboolean initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue); -#endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __COLOR_H__ */ diff --git a/color_filters.h b/color_filters.h index 5de7c23cf0..5d5c1ad1cf 100644 --- a/color_filters.h +++ b/color_filters.h @@ -24,6 +24,10 @@ #ifndef __COLOR_FILTERS_H__ #define __COLOR_FILTERS_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___" /** @file * Color filters. @@ -190,6 +194,8 @@ void color_filter_delete(color_filter_t *colorf); */ void color_filter_list_delete(GSList **cfl); - +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif diff --git a/disabled_protos.h b/disabled_protos.h index 6bee1e6f71..3314cceb29 100644 --- a/disabled_protos.h +++ b/disabled_protos.h @@ -23,6 +23,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef DISABLED_PROTOS_H +#define DISABLED_PROTOS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Item in a list of disabled protocols. */ @@ -59,3 +66,9 @@ void set_disabled_protos_list(void); * and "*errno_return" is set to the error. */ void save_disabled_protos_list(char **pref_path_return, int *errno_return); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* DISABLED_PROTOS_H */ diff --git a/epan/base64.h b/epan/base64.h index ef68eb4f63..8b18616efb 100644 --- a/epan/base64.h +++ b/epan/base64.h @@ -24,11 +24,12 @@ #ifndef __BASE64_H__ #define __BASE64_H__ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include /* In-place decoding of a base64 string. */ size_t epan_base64_decode(char *s); diff --git a/epan/epan.h b/epan/epan.h index 0b98c584b4..834e990df3 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -24,6 +24,10 @@ #ifndef EPAN_H #define EPAN_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include #include "frame_data.h" #include "column_info.h" @@ -183,4 +187,8 @@ epan_get_compiled_version_info(GString *str); void epan_get_runtime_version_info(GString *str); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* EPAN_H */ diff --git a/epan/epan_dissect.h b/epan/epan_dissect.h index 5b0f2d9345..96ea52324f 100644 --- a/epan/epan_dissect.h +++ b/epan/epan_dissect.h @@ -24,6 +24,10 @@ #ifndef EPAN_DISSECT_H #define EPAN_DISSECT_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include "tvbuff.h" #include "proto.h" #include "packet_info.h" @@ -40,5 +44,8 @@ struct _epan_dissect_t { packet_info pi; }; +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* EPAN_DISSECT_H */ diff --git a/epan/ex-opt.h b/epan/ex-opt.h index 0cfbc3aa1f..2001b2829d 100644 --- a/epan/ex-opt.h +++ b/epan/ex-opt.h @@ -23,12 +23,16 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _EX_OPT_H #define _EX_OPT_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* will be called by main each time a -X option is found */ extern gboolean ex_opt_add(const gchar* optarg); @@ -41,4 +45,8 @@ extern const gchar* ex_opt_get_nth(const gchar* key, guint index); /* extracts the next value of a given key */ extern const gchar* ex_opt_get_next(const gchar* key); -#endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _EX_OPT_H */ diff --git a/epan/prefs.h b/epan/prefs.h index cec0a4af46..eae802e3d7 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -25,6 +25,10 @@ #ifndef __PREFS_H__ #define __PREFS_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include #include "color.h" @@ -462,4 +466,8 @@ extern gboolean prefs_is_capture_device_hidden(const char *name); */ extern gboolean prefs_capture_device_monitor_mode(const char *name); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* prefs.h */ diff --git a/epan/strutil.h b/epan/strutil.h index 38da893a25..8c1dbcbc90 100644 --- a/epan/strutil.h +++ b/epan/strutil.h @@ -25,6 +25,10 @@ #ifndef __STRUTIL_H__ #define __STRUTIL_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* ... thus, config.h needs to be #included */ /** @file @@ -268,4 +272,8 @@ gchar* ws_strdup_unescape_char (const gchar *str, const gchar chr); */ gchar *string_replace(const gchar* str, const gchar *old_val, const gchar *new_val); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __STRUTIL_H__ */ diff --git a/epan/timestamp.h b/epan/timestamp.h index 9282ac5216..da41c947a2 100644 --- a/epan/timestamp.h +++ b/epan/timestamp.h @@ -25,6 +25,10 @@ #ifndef __TIMESTAMP_H__ #define __TIMESTAMP_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Type of time-stamp shown in the summary display. */ @@ -81,4 +85,8 @@ extern void timestamp_set_precision(int tsp); extern ts_seconds_type timestamp_get_seconds_type(void); extern void timestamp_set_seconds_type(ts_seconds_type); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* timestamp.h */ diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 61b7b12c30..3f9124e5a3 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -40,6 +40,10 @@ #include #include "exceptions.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** @file * "testy, virtual(-izable) buffer". They are testy in that they get mad when * an attempt is made to access data beyond the bounds of their array. In that @@ -674,4 +678,8 @@ extern tvbuff_t* tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int /************** END OF ACCESSORS ****************/ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __TVBUFF_H__ */ diff --git a/file.h b/file.h index 842e48608a..facf0f1d40 100644 --- a/file.h +++ b/file.h @@ -34,6 +34,9 @@ #include "cfile.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /** Return values from functions that only can succeed or fail. */ typedef enum { @@ -581,4 +584,8 @@ cf_merge_files(char **out_filename, int in_file_count, void read_keytab_file(const char *); #endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* file.h */ diff --git a/filters.h b/filters.h index 78a59a483f..bfb3f93c2b 100644 --- a/filters.h +++ b/filters.h @@ -23,6 +23,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef FILTERS_H +#define FILTERS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Filter lists. */ @@ -85,3 +92,8 @@ void save_filter_list(filter_list_type_t list_type, char **pref_path_return, */ void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* FILTERS_H */ diff --git a/globals.h b/globals.h index 7e3e526ecd..5c1e0675cb 100644 --- a/globals.h +++ b/globals.h @@ -25,13 +25,13 @@ #ifndef __GLOBALS_H__ #define __GLOBALS_H__ +#include "file.h" +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "file.h" -#include - extern capture_file cfile; #ifdef __cplusplus diff --git a/gtk/recent.h b/gtk/recent.h index 788a6ac8da..d582573bbf 100644 --- a/gtk/recent.h +++ b/gtk/recent.h @@ -26,6 +26,10 @@ #ifndef __RECENT_H__ #define __RECENT_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include /** @file @@ -87,7 +91,7 @@ typedef struct recent_settings_tag { gboolean privs_warn_if_elevated; gboolean privs_warn_if_no_npf; GList *col_width_list; /* column widths */ - gchar *gui_fileopen_remembered_dir; /* folder of last capture loaded in File Open dialog */ + gchar *gui_fileopen_remembered_dir; /* folder of last capture loaded in File Open dialog */ } recent_settings_t; /** Global recent settings. */ @@ -146,20 +150,20 @@ extern void write_recent_geom(gpointer key, gpointer value, gpointer rf); extern int recent_set_arg(char *prefarg); /** Get the column width for the given column - * + * * @param col column number */ extern gint recent_get_column_width(gint col); /** Set the column width for the given column - * + * * @param col column number * @param width column width */ extern void recent_set_column_width(gint col, gint width); /** Get the column xalign for the given column - * + * * @param col column number */ extern gchar recent_get_column_xalign(gint col); @@ -171,4 +175,8 @@ extern gchar recent_get_column_xalign(gint col); */ extern void recent_set_column_xalign(gint col, gchar xalign); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* recent.h */ diff --git a/main_statusbar.h b/main_statusbar.h index a15aa4e158..9647a2ed62 100644 --- a/main_statusbar.h +++ b/main_statusbar.h @@ -24,6 +24,9 @@ #ifndef __MAIN_STATUSBAR_H__ #define __MAIN_STATUSBAR_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ void profile_bar_update(void); void packets_bar_update(void); @@ -61,4 +64,8 @@ void statusbar_pop_filter_msg(void); void statusbar_push_temporary_msg(const gchar *msg_format, ...) G_GNUC_PRINTF(1, 2); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __MAIN_STATUSBAR_H__ */ diff --git a/progress_dlg.h b/progress_dlg.h index 0f404c71d7..638c8a3cca 100644 --- a/progress_dlg.h +++ b/progress_dlg.h @@ -25,6 +25,10 @@ #ifndef __PROGRESS_DLG_H__ #define __PROGRESS_DLG_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** @file * Progress (modal) dialog box routines. * @ingroup dialog_group @@ -56,7 +60,7 @@ progdlg_t *create_progress_dlg(const gchar *task_title, const gchar *item_title, /** * Create a progress dialog, but only if it's not likely to disappear - * immediately. This can be disconcerting for the user. + * immediately. This can be disconcerting for the user. * * @param task_title the task to do, e.g. "Loading" * @param item_title the item to do, e.g. "capture.cap" @@ -91,4 +95,8 @@ void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status) */ void destroy_progress_dlg(progdlg_t *dlg); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __PROGRESS_DLG_H__ */ diff --git a/register.h b/register.h index 91fd0f1ffc..25ba0a657c 100644 --- a/register.h +++ b/register.h @@ -25,6 +25,10 @@ #ifndef __REGISTER_H__ #define __REGISTER_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #include typedef enum { @@ -48,4 +52,9 @@ extern void register_all_protocols(register_cb cb, gpointer client_data); extern void register_all_protocol_handoffs(register_cb cb, gpointer client_data); extern void register_all_tap_listeners(void); extern gulong register_count(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __REGISTER_H__ */ -- cgit v1.2.3