Have abs_time_to_str() and abs_time_to_str_secs() take an additional
[metze/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$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
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 #include "nstime.h"
31 #include "time_fmt.h"
32 #include <epan/packet_info.h>
33
34 #define GUID_STR_LEN 37
35 #define MAX_IP_STR_LEN 16
36 #define MAX_ADDR_STR_LEN 256
37
38 /*
39  * These are utility functions which convert various types to strings,
40  * but for which no more specific module applies.
41  */
42
43 struct     e_in6_addr;
44
45 /* !!Deprecated!! - use ep_address_to_str() */
46 #define address_to_str ep_address_to_str
47 extern gchar*   ep_address_to_str(const address *);
48 extern gchar*   se_address_to_str(const address *);
49 extern void     address_to_str_buf(const address *addr, gchar *buf, int buf_len);
50 extern gchar*   bytestring_to_str(const guint8 *, const guint32, const char);
51 extern gchar*   ether_to_str(const guint8 *);
52 extern const gchar*     ip_to_str(const guint8 *);
53 extern void     ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);
54 extern gchar*   fc_to_str(const guint8 *);
55 extern gchar*   fcwwn_to_str (const guint8 *);
56 extern gchar*   ip6_to_str(const struct e_in6_addr *);
57 extern void     ip6_to_str_buf(const struct e_in6_addr *, gchar *);
58 extern gchar*   ipx_addr_to_str(const guint32, const guint8 *);
59 extern gchar*   ipxnet_to_string(const guint8 *ad);
60 extern gchar*   ipxnet_to_str_punct(const guint32 ad, const char punct);
61 extern gchar*   vines_addr_to_str(const guint8 *addrp);
62 extern gchar*   time_secs_to_str(const gint32 time_val);
63 extern gchar*   time_secs_to_str_unsigned(const guint32);
64 extern gchar*   time_msecs_to_str(gint32 time_val);
65 extern gchar*   abs_time_to_str(const nstime_t*, const absolute_time_display_e fmt,
66     gboolean show_zone);
67 extern gchar*   abs_time_secs_to_str(const time_t, const absolute_time_display_e fmt,
68     gboolean show_zone);
69 extern void     display_signed_time(gchar *, int, const gint32, gint32, const to_str_time_res_t);
70 extern void     display_epoch_time(gchar *, int, const time_t,  gint32, const to_str_time_res_t);
71
72 extern gchar*   guint32_to_str(const guint32 u);
73 extern void     guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
74
75 extern gchar*   rel_time_to_str(const nstime_t*);
76 extern gchar*   rel_time_to_secs_str(const nstime_t*);
77 extern gchar*   guid_to_str(const e_guid_t*);
78 extern gchar*   guid_to_str_buf(const e_guid_t*, gchar*, int);
79
80 extern char *decode_bits_in_field(const gint bit_offset, const gint no_of_bits, const guint64 value);
81
82 extern char     *other_decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
83     const int width);
84 extern char     *decode_bitfield_value(char *buf, const guint32 val, const guint32 mask,
85     const int width);
86 extern const char *decode_boolean_bitfield(const guint32 val, const guint32 mask, const int width,
87   const char *truedesc, const char *falsedesc);
88 extern const char *decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width,
89   const char *fmt);
90
91 #endif /* __TO_STR_H__  */