From 0fb0fa8794861d6bb6beaa286252a5f834003182 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 18 Jan 2007 18:43:30 +0000 Subject: [PATCH] Put #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ ... #ifdef __cplusplus } #endif /* __cplusplus */ wrappers into some header files, for the benefit of C++ plugins. Also, add multiple-include protections. svn path=/trunk/; revision=20485 --- epan/addr_and_mask.h | 8 ++++++++ epan/addr_resolv.h | 8 ++++++++ epan/address.h | 9 ++++++++- epan/afn.h | 8 ++++++++ epan/aftypes.h | 13 +++++++++++++ epan/arcnet_pids.h | 13 +++++++++++++ epan/arptypes.h | 8 ++++++++ epan/atalk-utils.h | 9 +++++++++ epan/bitswap.h | 16 ++++++++++++++-- epan/bridged_pids.h | 10 +++++++++- epan/camel-persistentdata.h | 22 +++++++++++++++------- epan/chdlctypes.h | 8 ++++++++ epan/circuit.h | 9 ++++++++- epan/column-utils.h | 7 +++++++ epan/column.h | 8 ++++++++ epan/column_info.h | 17 +++++++++++------ epan/conversation.h | 8 ++++++++ epan/crc16.h | 11 +++++++++++ epan/crc32.h | 12 ++++++++++++ epan/packet.h | 8 ++++++++ epan/proto.h | 8 ++++++++ wiretap/wtap.h | 7 +++++++ 22 files changed, 209 insertions(+), 18 deletions(-) diff --git a/epan/addr_and_mask.h b/epan/addr_and_mask.h index 7498179ac5..849f65c6ef 100644 --- a/epan/addr_and_mask.h +++ b/epan/addr_and_mask.h @@ -26,6 +26,10 @@ #ifndef __ADDR_AND_MASK_H__ #define __ADDR_AND_MASK_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * These routines return PREFIX_LEN_OK on success, PREFIX_LEN_TOO_LONG if * the prefix length is too long, and PREFIX_LEN_ZERO if the prefix length @@ -42,4 +46,8 @@ extern int ipv4_addr_and_mask(tvbuff_t *tvb, int offset, guint8 *addr, extern int ipv6_addr_and_mask(tvbuff_t *tvb, int offset, struct e_in6_addr *addr, guint32 prefix_len); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __ADDR_AND_MASK_H__ */ diff --git a/epan/addr_resolv.h b/epan/addr_resolv.h index 544aad0f96..ca23252e77 100644 --- a/epan/addr_resolv.h +++ b/epan/addr_resolv.h @@ -36,6 +36,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #ifndef MAXNAMELEN #define MAXNAMELEN 64 /* max name length (hostname and port name) */ #endif @@ -187,4 +191,8 @@ gboolean get_host_ipaddr6(const char *host, struct e_in6_addr *addrp); */ const char* host_ip_af(const char *host); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __RESOLV_H__ */ diff --git a/epan/address.h b/epan/address.h index 6a57ba38e9..0f202a3008 100644 --- a/epan/address.h +++ b/epan/address.h @@ -26,6 +26,10 @@ #ifndef __ADDRESS_H__ #define __ADDRESS_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Types of addresses Wireshark knows about. */ /* If a new address type is added here, a string representation procedure should */ /* also be included in address_to_str_buf defined in to_str.c, for presentation purposes */ @@ -137,5 +141,8 @@ typedef enum { /* Could also have ATM VPI/VCI pairs */ } circuit_type; -#endif /* __ADDRESS_H__ */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __ADDRESS_H__ */ diff --git a/epan/afn.h b/epan/afn.h index a8f25bb5f7..268a8143c7 100644 --- a/epan/afn.h +++ b/epan/afn.h @@ -25,6 +25,10 @@ #ifndef __AFN_H__ #define __AFN_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Address family numbers, from * @@ -60,4 +64,8 @@ #define AFNUM_L2VPN_OLD 196 extern const value_string afn_vals[]; +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __AFN_H__ */ diff --git a/epan/aftypes.h b/epan/aftypes.h index 5899671ff0..607355800d 100644 --- a/epan/aftypes.h +++ b/epan/aftypes.h @@ -24,6 +24,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __AFTYPES_H__ +#define __AFTYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* BSD AF_ values. */ #define BSD_AF_INET 2 #define BSD_AF_ISO 7 @@ -32,3 +39,9 @@ #define BSD_AF_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */ #define BSD_AF_INET6_FREEBSD 28 #define BSD_AF_INET6_DARWIN 30 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* aftypes.h */ diff --git a/epan/arcnet_pids.h b/epan/arcnet_pids.h index ec0024d34e..4d0dcc3bbe 100644 --- a/epan/arcnet_pids.h +++ b/epan/arcnet_pids.h @@ -23,6 +23,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __ARCNET_PIDS_H__ +#define __ARCNET_PIDS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* RFC 1051 */ #define ARCNET_PROTO_IP_1051 240 #define ARCNET_PROTO_ARP_1051 241 @@ -55,3 +62,9 @@ #define ARCNET_PROTO_DIAGNOSE 128 /* as per ANSI/ATA 878.1 */ #define ARCNET_PROTO_BACNET 205 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* arcnet_pids.h */ diff --git a/epan/arptypes.h b/epan/arptypes.h index af4e527496..e57858a3f2 100644 --- a/epan/arptypes.h +++ b/epan/arptypes.h @@ -25,6 +25,10 @@ #ifndef __ARPTYPES_H__ #define __ARPTYPES_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Definitions taken from Linux "linux/if_arp.h" header file, and from http://www.iana.org/assignments/arp-parameters @@ -61,4 +65,8 @@ #define ARPHRD_TWINAX 26 /* Twinaxial */ #define ARPHRD_EUI_64 27 /* EUI-64 */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* arptypes.h */ diff --git a/epan/atalk-utils.h b/epan/atalk-utils.h index 5eed8a2362..3343561bdd 100644 --- a/epan/atalk-utils.h +++ b/epan/atalk-utils.h @@ -23,6 +23,11 @@ #include #include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Structure used to represent a DDP address; gives the layout of the * data pointed to by an AT_ATALK "address" structure. @@ -51,4 +56,8 @@ extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp); extern void atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf, int buf_len); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif diff --git a/epan/bitswap.h b/epan/bitswap.h index cc7efd4aa9..be018bfc42 100644 --- a/epan/bitswap.h +++ b/epan/bitswap.h @@ -4,10 +4,9 @@ * $Id$ * * Wireshark - Network traffic analyzer - * By Gerald Combs + * By Gerald Combs * 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 @@ -23,6 +22,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __BITSWAP_H__ +#define __BITSWAP_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern guint8 swaptab[256]; #define BIT_SWAP(b) (swaptab[b]) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* bitswap.h */ diff --git a/epan/bridged_pids.h b/epan/bridged_pids.h index e3c0384a0a..fa2a12f12f 100644 --- a/epan/bridged_pids.h +++ b/epan/bridged_pids.h @@ -26,6 +26,10 @@ #ifndef __BRIDGED_PID_H__ #define __BRIDGED_PID_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define BPID_ETH_WITH_FCS 0x0001 /* 802.3/Ethernet with preserved FCS */ #define BPID_ETH_WITHOUT_FCS 0x0007 /* 802.3/Ethernet without preserved FCS */ @@ -47,4 +51,8 @@ #define BPID_SR_BPDU 0x000F /* Source Routing BPDUs */ -#endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* bridged_pid.h */ diff --git a/epan/camel-persistentdata.h b/epan/camel-persistentdata.h index 10ffba8620..99d067ab9f 100644 --- a/epan/camel-persistentdata.h +++ b/epan/camel-persistentdata.h @@ -23,13 +23,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __camelsrt_HASH__ -#define __camelsrt_HASH__ +#ifndef __CAMEL_PERSISTENTDATA_H__ +#define __CAMEL_PERSISTENTDATA_H__ -#include "epan/packet.h" -#include "epan/conversation.h" -#include "epan/dissectors/packet-camel.h" -#include "epan/tcap-persistentdata.h" +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ #define NB_CAMELSRT_CATEGORY 9+1 /* Number of type of message */ /* for example TC_BEGIN with InitalDP, and TC_CONT with RequestReportBCSMEvent @@ -114,4 +118,8 @@ void camelsrt_call_matching(tvbuff_t *tvb, WS_VAR_IMPORT gboolean gcamel_StatSRT; -#endif /* __camelsrt_HASH__*/ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* camel-persistentdata.h */ diff --git a/epan/chdlctypes.h b/epan/chdlctypes.h index 552fd3040b..811445d804 100644 --- a/epan/chdlctypes.h +++ b/epan/chdlctypes.h @@ -25,8 +25,16 @@ #ifndef __CHDLCTYPES_H__ #define __CHDLCTYPES_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define CHDLCTYPE_FRARP 0x0808 /* Frame Relay ARP */ #define CHDLCTYPE_BPDU 0x4242 /* IEEE spanning tree protocol */ #define CHDLCTYPE_OSI 0xfefe /* ISO network-layer protocols */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* chdlctypes.h */ diff --git a/epan/circuit.h b/epan/circuit.h index 7e802ba62b..1271706a33 100644 --- a/epan/circuit.h +++ b/epan/circuit.h @@ -27,6 +27,10 @@ #include "packet.h" /* for circuit dissector type */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Data structure representing a circuit. */ @@ -69,5 +73,8 @@ extern gboolean try_circuit_dissector(circuit_type ctype, guint32 circuit_id, guint32 frame, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -#endif /* circuit.h */ +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* circuit.h */ diff --git a/epan/column-utils.h b/epan/column-utils.h index 3f84a7dcc3..141e9ce25d 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -31,6 +31,10 @@ #include "column_info.h" #include "packet_info.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** Maximum length of columns (except COL_INFO). * Internal, don't use this in dissectors! */ @@ -205,5 +209,8 @@ extern void col_append_sep_fstr(column_info *cinfo, gint col, const gchar *sep, const gchar *format, ...) GNUC_FORMAT_CHECK(printf, 4, 5); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* __COLUMN_UTILS_H__ */ diff --git a/epan/column.h b/epan/column.h index e17bd626aa..da09ce4704 100644 --- a/epan/column.h +++ b/epan/column.h @@ -25,6 +25,10 @@ #ifndef __COLUMN_H__ #define __COLUMN_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + typedef struct _fmt_data { gchar *title; gchar *fmt; @@ -40,4 +44,8 @@ const gchar *get_column_width_string(gint, gint); const char *get_column_longest_string(gint); gint get_column_char_width(gint format); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* column.h */ diff --git a/epan/column_info.h b/epan/column_info.h index 44683d6dc7..ad91439d4d 100644 --- a/epan/column_info.h +++ b/epan/column_info.h @@ -27,6 +27,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define COL_MAX_LEN 256 #define COL_MAX_INFO_LEN 4096 @@ -102,13 +106,14 @@ enum { COL_8021Q_VLAN_ID, /* 802.1Q vlan ID */ COL_DSCP_VALUE, /* IP DSCP Value */ COL_COS_VALUE, /* L2 COS Value */ - COL_TEI, /* q.921 TEI */ - COL_FR_DLCI, /* Frame Relay DLCI */ - COL_BSSGP_TLLI, /* GPRS BSSGP IE TLLI */ + COL_TEI, /* Q.921 TEI */ + COL_FR_DLCI, /* Frame Relay DLCI */ + COL_BSSGP_TLLI, /* GPRS BSSGP IE TLLI */ NUM_COL_FMTS /* Should always be last */ }; +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* __COLUMN_INFO_H__ */ - - - diff --git a/epan/conversation.h b/epan/conversation.h index f00ff93e46..530b700e57 100644 --- a/epan/conversation.h +++ b/epan/conversation.h @@ -25,6 +25,10 @@ #ifndef __CONVERSATION_H__ #define __CONVERSATION_H__ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Flags to pass to "conversation_new()" to indicate that the address 2 * and/or port 2 values for the conversation should be wildcards. @@ -99,4 +103,8 @@ try_conversation_dissector(address *addr_a, address *addr_b, port_type ptype, extern void conversation_set_port2(conversation_t *conv, guint32 port); extern void conversation_set_addr2(conversation_t *conv, address *addr); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* conversation.h */ diff --git a/epan/crc16.h b/epan/crc16.h index 90ddedb5e8..e9aca01423 100644 --- a/epan/crc16.h +++ b/epan/crc16.h @@ -26,6 +26,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __CRC16_H_ +#define __CRC16_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Calculate the CCITT/ITU/CRC-16 16-bit CRC (parameters for this CRC are: @@ -95,4 +102,8 @@ extern guint16 crc16_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint16 seed); extern guint16 crc16_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, guint16 seed); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* crc16.h */ diff --git a/epan/crc32.h b/epan/crc32.h index 5396204263..b497b04290 100644 --- a/epan/crc32.h +++ b/epan/crc32.h @@ -24,6 +24,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef __CRC32_H_ +#define __CRC32_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern const guint32 crc32_ccitt_table[256]; /** Compute CRC32 CCITT checksum of a buffer of data. @@ -80,3 +87,8 @@ extern guint32 crc32_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset, @return The IEEE 802.x CRC32 checksum. */ extern guint32 crc32_802_tvb(tvbuff_t *tvb, guint len); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* crc32.h */ diff --git a/epan/packet.h b/epan/packet.h index 8512fa4cb5..2968e1ac08 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -46,6 +46,10 @@ #include "epan.h" #include "tfs.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define hi_nibble(b) (((b) & 0xf0) >> 4) #define lo_nibble(b) ((b) & 0x0f) @@ -402,4 +406,8 @@ extern void dissector_dump_decodes(void); extern void register_postdissector(dissector_handle_t); extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* packet.h */ diff --git a/epan/proto.h b/epan/proto.h index 786f24eb33..1169856fba 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -51,6 +51,10 @@ #include "tvbuff.h" #include "ftypes/ftypes.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** The header-field index for the special text pseudo-field. Exported by libwireshark.dll */ WS_VAR_IMPORT int hf_text_only; @@ -1556,4 +1560,8 @@ proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb); extern proto_item * proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_hdr, gint ett, const int **fields, gboolean little_endian); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* proto.h */ diff --git a/wiretap/wtap.h b/wiretap/wtap.h index f439c5bff0..b812869c15 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -35,6 +35,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* Encapsulation types. Choose names that truly reflect * what is contained in the packet trace file. * @@ -681,5 +685,8 @@ void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped); #define WTAP_ERR_ZLIB_MAX -100 #define WTAP_ERR_ZLIB_MIN -300 +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* __WTAP_H__ */