From Douglas Pratley with trivial changes and documentation changes
[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$
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 "epan/packet_info.h"
32
33 #define MAX_OID_STR_LEN 256
34 #define GUID_STR_LEN 37
35
36 /*
37  * Resolution of a time stamp.
38  */
39 typedef enum {
40         SECS,   /* seconds */
41         DSECS,  /* deciseconds */
42         CSECS,  /* centiseconds */
43         MSECS,  /* milliseconds */
44         USECS,  /* microseconds */
45         NSECS   /* nanoseconds */
46 } time_res_t;
47
48 /*
49  * These are utility functions which convert various types to strings,
50  * but for which no more specific module applies.
51  */
52
53 struct     e_in6_addr;
54
55 extern gchar*   address_to_str(const address *);
56 extern void     address_to_str_buf(const address *addr, gchar *buf, int buf_len);
57 extern gchar*   bytestring_to_str(const guint8 *, guint32, char);
58 extern gchar*   ether_to_str(const guint8 *);
59 extern gchar*   ip_to_str(const guint8 *);
60 extern void     ip_to_str_buf(const guint8 *, gchar *);
61 extern gchar*   fc_to_str(const guint8 *);
62 extern gchar*   fcwwn_to_str (const guint8 *);
63 extern gchar*   ip6_to_str(const struct e_in6_addr *);
64 extern void     ip6_to_str_buf(const struct e_in6_addr *, gchar *);
65 extern gchar*   ipx_addr_to_str(guint32, const guint8 *);
66 extern gchar*   ipxnet_to_string(const guint8 *ad);
67 extern gchar*   ipxnet_to_str_punct(const guint32 ad, char punct);
68 extern gchar*   vines_addr_to_str(const guint8 *addrp);
69 extern void     vines_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len);
70 extern gchar*   time_secs_to_str(gint32);
71 extern gchar*   time_msecs_to_str(gint32);
72 extern gchar*   abs_time_to_str(nstime_t*);
73 extern gchar*   abs_time_secs_to_str(time_t);
74 extern void     display_signed_time(gchar *, int, gint32, gint32, time_res_t);
75 extern void     display_epoch_time(gchar *, int, time_t,  gint32, time_res_t);
76
77 extern gchar*   rel_time_to_str(nstime_t*);
78 extern gchar*   rel_time_to_secs_str(nstime_t*);
79 extern gchar*   oid_to_str(const guint8*, gint);
80 extern gchar*   oid_to_str_buf(const guint8*, gint, gchar*, int);
81 extern gchar*   guid_to_str(const e_guid_t*);
82 extern gchar*   guid_to_str_buf(const e_guid_t*, gchar*, int);
83
84 void tipc_addr_to_str_buf( const guint8 *data, gchar *buf, int buf_len);
85
86 extern char     *other_decode_bitfield_value(char *buf, guint32 val, guint32 mask,
87     int width);
88 extern char     *decode_bitfield_value(char *buf, guint32 val, guint32 mask,
89     int width);
90 extern const char *decode_boolean_bitfield(guint32 val, guint32 mask, int width,
91   const char *truedesc, const char *falsedesc);
92 extern const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width,
93   const char *fmt);
94
95 #endif /* __TO_STR_H__  */