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
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
Add a "time_secs_to_str_buf()" routine, which takes seconds and
fractions-of-a-second (the units of which are either milliseconds or
microseconds, specified by a Boolean argument), and formats it into a
"DD days, HH hours, MM minutes, SS seconds" using a buffer supplied to
it. Have "time_secs_to_str()" and "time_msecs_to_str()" both use it.
Also, have it correctly handle the case of SS being > 0 but < 1 (which
"time_msecs_to_str()" didn't do).
Rename "rel_time_to_str()" to "rel_time_to_secs_str()", and add a
"rel_time_to_str()" routine that takes a "struct timeval" and hands its
seconds and microseconds values to "time_secs_to_str_buf()". Use
"rel_time_to_secs_str()" to format FT_RELATIVE_TIME values for now; we
might want to use "rel_time_to_str()" for them, though, or make it an
option (either a user option, or a per-field option, using the field
that also holds BASE_ values).
svn path=/trunk/; revision=3806
2001-08-01 08:27:00 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
2001-09-14 07:10:13 +00:00
|
|
|
#include "nstime.h"
|
2003-08-23 13:35:06 +00:00
|
|
|
#include "epan/packet_info.h"
|
2001-09-14 07:10:13 +00:00
|
|
|
|
2005-04-28 09:51:55 +00:00
|
|
|
#define MAX_OID_STR_LEN 256
|
2005-07-04 13:04:53 +00:00
|
|
|
#define GUID_STR_LEN 37
|
2005-04-28 09:51:55 +00:00
|
|
|
|
2001-09-14 07:10:13 +00:00
|
|
|
/*
|
|
|
|
* Resolution of a time stamp.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2005-08-25 21:29:54 +00:00
|
|
|
SECS, /* seconds */
|
|
|
|
DSECS, /* deciseconds */
|
|
|
|
CSECS, /* centiseconds */
|
2001-09-14 07:10:13 +00:00
|
|
|
MSECS, /* milliseconds */
|
|
|
|
USECS, /* microseconds */
|
|
|
|
NSECS /* nanoseconds */
|
|
|
|
} time_res_t;
|
|
|
|
|
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
|
|
|
|
2005-01-01 12:29:26 +00:00
|
|
|
extern gchar* address_to_str(const address *);
|
2005-08-08 18:50:39 +00:00
|
|
|
extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
|
2005-08-28 06:44:06 +00:00
|
|
|
extern gchar* bytestring_to_str(const guint8 *, guint32, char);
|
2002-12-08 22:53:00 +00:00
|
|
|
extern gchar* ether_to_str(const guint8 *);
|
|
|
|
extern gchar* ip_to_str(const guint8 *);
|
|
|
|
extern void ip_to_str_buf(const guint8 *, gchar *);
|
|
|
|
extern gchar* fc_to_str(const guint8 *);
|
|
|
|
extern gchar* fcwwn_to_str (const guint8 *);
|
2004-01-10 12:50:19 +00:00
|
|
|
extern gchar* ip6_to_str(const struct e_in6_addr *);
|
2003-12-09 05:06:22 +00:00
|
|
|
extern void ip6_to_str_buf(const struct e_in6_addr *, gchar *);
|
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* ipx_addr_to_str(guint32, const guint8 *);
|
|
|
|
extern gchar* ipxnet_to_string(const guint8 *ad);
|
|
|
|
extern gchar* ipxnet_to_str_punct(const guint32 ad, char punct);
|
|
|
|
extern gchar* vines_addr_to_str(const guint8 *addrp);
|
2005-08-20 02:33:33 +00:00
|
|
|
extern void vines_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len);
|
2005-04-12 19:59:08 +00:00
|
|
|
extern gchar* time_secs_to_str(gint32);
|
|
|
|
extern gchar* time_msecs_to_str(gint32);
|
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* abs_time_to_str(nstime_t*);
|
2003-02-12 00:44:04 +00:00
|
|
|
extern gchar* abs_time_secs_to_str(time_t);
|
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 void display_signed_time(gchar *, int, gint32, gint32, time_res_t);
|
|
|
|
extern gchar* rel_time_to_str(nstime_t*);
|
|
|
|
extern gchar* rel_time_to_secs_str(nstime_t*);
|
2005-05-05 09:40:24 +00:00
|
|
|
extern gchar* oid_to_str(const guint8*, gint);
|
2005-08-20 02:33:33 +00:00
|
|
|
extern gchar* oid_to_str_buf(const guint8*, gint, gchar*, int);
|
2005-07-04 13:04:53 +00:00
|
|
|
extern gchar* guid_to_str(const guint8*);
|
2005-08-20 02:33:33 +00:00
|
|
|
extern gchar* guid_to_str_buf(const guint8*, gchar*, int);
|
2001-04-01 02:47:56 +00:00
|
|
|
|
|
|
|
|
2003-12-08 23:40:13 +00:00
|
|
|
extern char *other_decode_bitfield_value(char *buf, guint32 val, guint32 mask,
|
|
|
|
int width);
|
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 char *decode_bitfield_value(char *buf, guint32 val, guint32 mask,
|
|
|
|
int width);
|
|
|
|
extern const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width,
|
2001-04-01 02:47:56 +00:00
|
|
|
const char *truedesc, const char *falsedesc);
|
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 const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
|
2001-04-01 02:47:56 +00:00
|
|
|
const char *fmt);
|
|
|
|
|
|
|
|
#endif /* __TO_STR_H__ */
|