2001-04-01 02:47:56 +00:00
|
|
|
/* to_str.h
|
|
|
|
* Definitions for utilities to convert various other types to strings.
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-04-01 02:47:56 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-04-01 02:47:56 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 02:47:56 +00:00
|
|
|
* 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.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 02:47:56 +00:00
|
|
|
* 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.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 02:47:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-04-01 02:47:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TO_STR_H__
|
|
|
|
#define __TO_STR_H__
|
|
|
|
|
2001-09-14 07:10:13 +00:00
|
|
|
#include <glib.h>
|
2001-04-01 02:47:56 +00:00
|
|
|
|
2013-06-25 22:02:20 +00:00
|
|
|
#include "wsutil/nstime.h"
|
2010-02-27 19:01:27 +00:00
|
|
|
#include "time_fmt.h"
|
2009-08-21 20:51:13 +00:00
|
|
|
#include <epan/packet_info.h>
|
2013-03-01 23:53:11 +00:00
|
|
|
#include "ws_symbol_export.h"
|
2013-11-23 22:17:27 +00:00
|
|
|
#include "wmem/wmem.h"
|
2001-09-14 07:10:13 +00:00
|
|
|
|
2005-07-04 13:04:53 +00:00
|
|
|
#define GUID_STR_LEN 37
|
2007-01-29 20:25:26 +00:00
|
|
|
#define MAX_IP_STR_LEN 16
|
2011-05-05 20:48:21 +00:00
|
|
|
#define MAX_IP6_STR_LEN 40
|
2007-01-29 20:25:26 +00:00
|
|
|
#define MAX_ADDR_STR_LEN 256
|
2011-02-11 03:13:24 +00:00
|
|
|
#define VINES_ADDR_LEN 6
|
2011-05-08 10:23:53 +00:00
|
|
|
#define EUI64_STR_LEN 24
|
2005-04-28 09:51:55 +00:00
|
|
|
|
2013-08-30 21:15:24 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2002-08-28 20:41:00 +00:00
|
|
|
/*
|
2001-04-01 02:47:56 +00:00
|
|
|
* These are utility functions which convert various types to strings,
|
2002-08-28 20:41:00 +00:00
|
|
|
* but for which no more specific module applies.
|
2001-04-01 02:47:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct e_in6_addr;
|
2002-12-08 02:32:36 +00:00
|
|
|
|
2013-11-23 22:17:27 +00:00
|
|
|
WS_DLL_PUBLIC gchar* address_to_str(wmem_allocator_t *scope, const address *addr);
|
|
|
|
WS_DLL_PUBLIC gchar* ep_address_to_str(const address *);
|
2009-07-07 09:42:09 +00:00
|
|
|
extern gchar* se_address_to_str(const address *);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
|
|
|
|
WS_DLL_PUBLIC const gchar* ether_to_str(const guint8 *);
|
|
|
|
WS_DLL_PUBLIC const gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset);
|
2012-12-26 05:57:06 +00:00
|
|
|
extern const gchar* ax25_to_str(const guint8 *);
|
2012-08-02 16:54:43 +00:00
|
|
|
extern gchar* get_ax25_name(const guint8 *);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* ip_to_str(const guint8 *);
|
|
|
|
WS_DLL_PUBLIC const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset);
|
|
|
|
void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);
|
2012-12-26 05:57:06 +00:00
|
|
|
extern const gchar* fc_to_str(const guint8 *);
|
2002-12-08 22:53:00 +00:00
|
|
|
extern gchar* fcwwn_to_str (const guint8 *);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset);
|
|
|
|
WS_DLL_PUBLIC gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset);
|
2014-01-14 05:39:57 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* ip6_to_str(const struct e_in6_addr *);
|
2014-01-30 17:43:52 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* ip6_guint8_to_str(const guint8 *ad);
|
|
|
|
|
2014-01-14 05:39:57 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset);
|
2013-03-01 23:53:11 +00:00
|
|
|
void ip6_to_str_buf(const struct e_in6_addr *, gchar *);
|
2010-04-03 18:18:50 +00:00
|
|
|
extern gchar* ipx_addr_to_str(const guint32, const guint8 *);
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
extern gchar* ipxnet_to_string(const guint8 *ad);
|
2010-04-03 18:18:50 +00:00
|
|
|
extern gchar* ipxnet_to_str_punct(const guint32 ad, const char punct);
|
2011-02-11 03:13:24 +00:00
|
|
|
extern gchar* tvb_vines_addr_to_str(tvbuff_t *tvb, const gint offset);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC gchar* eui64_to_str(const guint64 ad);
|
|
|
|
WS_DLL_PUBLIC gchar* tvb_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding);
|
2013-12-19 16:28:39 +00:00
|
|
|
WS_DLL_PUBLIC gchar* time_secs_to_ep_str(const gint32 time_val);
|
|
|
|
gchar* time_secs_to_ep_str_unsigned(const guint32);
|
|
|
|
WS_DLL_PUBLIC gchar* time_msecs_to_ep_str(gint32 time_val);
|
|
|
|
WS_DLL_PUBLIC gchar* abs_time_to_ep_str(const nstime_t*, const absolute_time_display_e fmt,
|
2010-05-21 06:33:25 +00:00
|
|
|
gboolean show_zone);
|
2013-12-19 16:28:39 +00:00
|
|
|
WS_DLL_PUBLIC gchar* abs_time_secs_to_ep_str(const time_t, const absolute_time_display_e fmt,
|
2010-05-21 06:33:25 +00:00
|
|
|
gboolean show_zone);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC void display_signed_time(gchar *, int, const gint32, gint32, const to_str_time_res_t);
|
|
|
|
WS_DLL_PUBLIC void display_epoch_time(gchar *, int, const time_t, gint32, const to_str_time_res_t);
|
2006-12-05 03:19:51 +00:00
|
|
|
|
2010-02-23 19:28:38 +00:00
|
|
|
extern void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
|
|
|
|
|
2013-12-19 16:28:39 +00:00
|
|
|
WS_DLL_PUBLIC gchar* rel_time_to_ep_str(const nstime_t*);
|
|
|
|
WS_DLL_PUBLIC gchar* rel_time_to_secs_ep_str(const nstime_t*);
|
|
|
|
WS_DLL_PUBLIC gchar* guid_to_ep_str(const e_guid_t*);
|
2013-03-01 23:53:11 +00:00
|
|
|
gchar* guid_to_str_buf(const e_guid_t*, gchar*, int);
|
2001-04-01 02:47:56 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC char *decode_bits_in_field(const guint bit_offset, const gint no_of_bits, const guint64 value);
|
2009-05-15 18:38:13 +00:00
|
|
|
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC char *other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
|
2010-04-03 18:18:50 +00:00
|
|
|
const int width);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC char *decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
|
2010-04-03 18:18:50 +00:00
|
|
|
const int width);
|
2013-03-01 23:53:11 +00:00
|
|
|
WS_DLL_PUBLIC const char *decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width,
|
2001-04-01 02:47:56 +00:00
|
|
|
const char *fmt);
|
|
|
|
|
2013-06-17 21:54:21 +00:00
|
|
|
WS_DLL_PUBLIC const gchar* port_type_to_str (port_type type);
|
|
|
|
|
2013-11-10 09:44:02 +00:00
|
|
|
/** Turn an array of bytes into a string showing the bytes in hex.
|
|
|
|
*
|
|
|
|
* @param bd A pointer to the byte array
|
|
|
|
* @param bd_len The length of the byte array
|
|
|
|
* @return A pointer to the formatted string
|
|
|
|
*
|
2013-12-19 15:49:09 +00:00
|
|
|
* @see bytes_to_ep_str_punct()
|
2013-11-10 09:44:02 +00:00
|
|
|
*/
|
2013-12-19 15:49:09 +00:00
|
|
|
WS_DLL_PUBLIC gchar *bytes_to_ep_str(const guint8 *bd, int bd_len);
|
2013-11-10 09:44:02 +00:00
|
|
|
|
|
|
|
/** Turn an array of bytes into a string showing the bytes in hex,
|
|
|
|
* separated by a punctuation character.
|
|
|
|
*
|
|
|
|
* @param bd A pointer to the byte array
|
|
|
|
* @param bd_len The length of the byte array
|
|
|
|
* @param punct The punctuation character
|
|
|
|
* @return A pointer to the formatted string
|
|
|
|
*
|
2013-12-19 15:49:09 +00:00
|
|
|
* @see bytes_to_ep_str()
|
2013-11-10 09:44:02 +00:00
|
|
|
*/
|
2013-12-19 15:49:09 +00:00
|
|
|
WS_DLL_PUBLIC gchar *bytes_to_ep_str_punct(const guint8 *bd, int bd_len, gchar punct);
|
2013-11-10 09:44:02 +00:00
|
|
|
|
2013-12-19 20:53:44 +00:00
|
|
|
/* Deprecated, use bytestring_to_str instead */
|
2013-12-19 15:49:09 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *bytestring_to_ep_str(const guint8 *, const guint32, const char punct);
|
2013-11-10 09:44:02 +00:00
|
|
|
|
2013-12-19 20:53:44 +00:00
|
|
|
WS_DLL_PUBLIC const gchar *bytestring_to_str(wmem_allocator_t *scope, const guint8 *ad, const guint32 len, const char punct);
|
|
|
|
|
2013-08-30 21:15:24 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2001-04-01 02:47:56 +00:00
|
|
|
#endif /* __TO_STR_H__ */
|