2001-04-01 02:47:56 +00:00
|
|
|
/* to_str.h
|
|
|
|
* Definitions for utilities to convert various other types to strings.
|
|
|
|
*
|
2001-09-14 07:10:13 +00:00
|
|
|
* $Id: to_str.h,v 1.5 2001/09/14 07:10:10 guy Exp $
|
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
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
2001-09-14 07:10:13 +00:00
|
|
|
#include "nstime.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Resolution of a time stamp.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
MSECS, /* milliseconds */
|
|
|
|
USECS, /* microseconds */
|
|
|
|
NSECS /* nanoseconds */
|
|
|
|
} time_res_t;
|
|
|
|
|
2001-04-01 02:47:56 +00:00
|
|
|
/*
|
|
|
|
* These are utility functions which convert various types to strings,
|
|
|
|
* but for which no more specific module applies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
gchar* ether_to_str(const guint8 *);
|
|
|
|
gchar* ether_to_str_punct(const guint8 *, char);
|
|
|
|
gchar* ip_to_str(const guint8 *);
|
|
|
|
void ip_to_str_buf(const guint8 *, gchar *);
|
|
|
|
struct e_in6_addr;
|
|
|
|
gchar* ip6_to_str(struct e_in6_addr *);
|
|
|
|
gchar* ipx_addr_to_str(guint32, const guint8 *);
|
|
|
|
gchar* ipxnet_to_string(const guint8 *ad);
|
|
|
|
gchar* ipxnet_to_str_punct(const guint32 ad, char punct);
|
2001-04-01 06:32:10 +00:00
|
|
|
gchar* vines_addr_to_str(const guint8 *addrp);
|
2001-04-01 02:47:56 +00:00
|
|
|
gchar* time_secs_to_str(guint32);
|
2001-07-13 00:27:51 +00:00
|
|
|
gchar* time_msecs_to_str(guint32);
|
2001-09-14 07:10:13 +00:00
|
|
|
gchar* abs_time_to_str(nstime_t*);
|
|
|
|
void display_signed_time(gchar *, int, gint32, gint32, time_res_t);
|
|
|
|
gchar* rel_time_to_str(nstime_t*);
|
|
|
|
gchar* rel_time_to_secs_str(nstime_t*);
|
2001-04-01 02:47:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
char * decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width);
|
|
|
|
const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width,
|
|
|
|
const char *truedesc, const char *falsedesc);
|
|
|
|
const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
|
|
|
|
const char *fmt);
|
|
|
|
|
|
|
|
#endif /* __TO_STR_H__ */
|