Make the resolution for time values be nanoseconds rather than
[obnox/wireshark/wip.git] / epan / to_str.h
1 /* to_str.h
2  * Definitions for utilities to convert various other types to strings.
3  *
4  * $Id: to_str.h,v 1.5 2001/09/14 07:10:10 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  * 
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  * 
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __TO_STR_H__
26 #define __TO_STR_H__
27
28 #include <glib.h>
29
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
32 #endif
33
34 #ifdef HAVE_NETINET_IN_H
35 # include <netinet/in.h>
36 #endif
37
38 #include "nstime.h"
39
40 /*
41  * Resolution of a time stamp.
42  */
43 typedef enum {
44         MSECS,  /* milliseconds */
45         USECS,  /* microseconds */
46         NSECS   /* nanoseconds */
47 } time_res_t;
48
49 /* 
50  * These are utility functions which convert various types to strings,
51  * but for which no more specific module applies.  
52  */
53
54 gchar*     ether_to_str(const guint8 *);
55 gchar*     ether_to_str_punct(const guint8 *, char);
56 gchar*     ip_to_str(const guint8 *);
57 void       ip_to_str_buf(const guint8 *, gchar *);
58 struct     e_in6_addr;
59 gchar*     ip6_to_str(struct e_in6_addr *);
60 gchar*     ipx_addr_to_str(guint32, const guint8 *);
61 gchar*     ipxnet_to_string(const guint8 *ad);
62 gchar*     ipxnet_to_str_punct(const guint32 ad, char punct);
63 gchar*     vines_addr_to_str(const guint8 *addrp);
64 gchar*     time_secs_to_str(guint32);
65 gchar*     time_msecs_to_str(guint32);
66 gchar*     abs_time_to_str(nstime_t*);
67 void       display_signed_time(gchar *, int, gint32, gint32, time_res_t);
68 gchar*     rel_time_to_str(nstime_t*);
69 gchar*     rel_time_to_secs_str(nstime_t*);
70
71
72 char * decode_bitfield_value(char *buf, guint32 val, guint32 mask, int width);
73 const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width,
74   const char *truedesc, const char *falsedesc);
75 const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
76   const char *fmt);
77
78 #endif /* __TO_STR_H__  */