packet-ldap: fix regression for SASL handling
[wireshark-sm.git] / epan / to_str-int.h
blob6294613abc8e144c2665d93dbff1bc1acddfd27f
1 /* to_str-int.h
2 * Definitions for utilities to convert various other types to strings.
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #ifndef __TO_STR_INT_H__
12 #define __TO_STR_INT_H__
14 #include <glib.h>
16 /**
17 * word_to_hex_punct()
19 * Output guint16 hex represetation to 'out', and return pointer after last character.
20 * Each byte will be separated with punct character (cannot be NUL).
21 * It always output full representation (padded with 0).
23 * String is not NUL terminated by this routine.
24 * There needs to be at least 5 bytes in the buffer.
26 char *word_to_hex_punct(char *out, guint16 word, char punct);
28 /**
29 * word_to_hex_npad()
31 * Output guint16 hex represetation to 'out', and return pointer after last character.
32 * Value is not padded.
34 * String is not NUL terminated by this routine.
35 * There needs to be at least 4 bytes in the buffer.
37 char *word_to_hex_npad(char *out, guint16 word);
39 /**
40 * dword_to_hex_punct()
42 * Output guint32 hex represetation to 'out', and return pointer after last character.
43 * Each byte will be separated with punct character (cannot be NUL).
44 * It always output full representation (padded with 0).
46 * String is not NUL terminated by this routine.
47 * There needs to be at least 11 bytes in the buffer.
49 char *dword_to_hex_punct(char *out, guint32 dword, char punct);
51 /**
52 * qword_to_hex()
54 * Output guint64 hex represetation to 'out', and return pointer after last character.
55 * It always output full representation (padded with 0).
57 * String is not NUL terminated by this routine.
58 * There needs to be at least 16 bytes in the buffer.
60 char *qword_to_hex(char *out, guint64 qword);
62 /**
63 * qword_to_hex_punct()
65 * Output guint64 hex represetation to 'out', and return pointer after last character.
66 * Each byte will be separated with punct character (cannot be NUL).
67 * It always output full representation (padded with 0).
69 * String is not NUL terminated by this routine.
70 * There needs to be at least 22 bytes in the buffer.
72 char *qword_to_hex_punct(char *out, guint64 qword, char punct);
74 /**
75 * bytes_to_hexstr_punct()
77 * Output hex represetation of guint8 ad array, and return pointer after last character.
78 * Each byte will be separated with punct character (cannot be NUL).
79 * It always output full representation (padded with 0).
81 * String is not NUL terminated by this routine.
82 * There needs to be at least len * 3 - 1 bytes in the buffer.
84 char *bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct);
86 /**
87 * oct_to_str_back()
89 * Output guint32 octal representation backward (last character will be written on ptr - 1),
90 * and return pointer to first character.
92 * String is not NUL terminated by this routine.
93 * There needs to be at least 12 bytes in the buffer.
95 char *oct_to_str_back(char *ptr, guint32 value);
97 /**
98 * oct64_to_str_back()
100 * Output guint64 octal representation backward (last character will be written on ptr - 1),
101 * and return pointer to first character.
103 * String is not NUL terminated by this routine.
104 * There needs to be at least 12 bytes in the buffer.
106 char *oct64_to_str_back(char *ptr, guint64 value);
109 * hex_to_str_back()
111 * Output guint32 hex representation backward (last character will be written on ptr - 1),
112 * and return pointer to first character.
113 * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
115 * String is not NUL terminated by this routine.
116 * There needs to be at least 2 + MAX(8, len) bytes in the buffer.
118 char *hex_to_str_back(char *ptr, int len, guint32 value);
121 * hex64_to_str_back()
123 * Output guint64 hex representation backward (last character will be written on ptr - 1),
124 * and return pointer to first character.
125 * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
127 * String is not NUL terminated by this routine.
128 * There needs to be at least 2 + MAX(16, len) bytes in the buffer.
130 char *hex64_to_str_back(char *ptr, int len, guint64 value);
133 * uint64_str_back()
135 * Output guint64 decimal representation backward (last character will be written on ptr - 1),
136 * and return pointer to first character.
138 * String is not NUL terminated by this routine.
139 * There needs to be at least 20 bytes in the buffer.
141 char *uint64_to_str_back(char *ptr, guint64 value);
144 * uint_to_str_back_len()
146 * Output guint32 decimal representation backward (last character will be written on ptr - 1),
147 * and return pointer to first character.
148 * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
150 * String is not NUL terminated by this routine.
151 * There needs to be at least MAX(10, len) bytes in the buffer.
153 char *uint_to_str_back_len(char *ptr, guint32 value, int len);
156 * uint64_to_str_back_len()
158 * Output guint64 decimal representation backward (last character will be written on ptr - 1),
159 * and return pointer to first character.
160 * This routine will output for sure (can output more) 'len' decimal characters (number padded with '0').
162 * String is not NUL terminated by this routine.
163 * There needs to be at least MAX(20, len) bytes in the buffer.
165 char *uint64_to_str_back_len(char *ptr, guint64 value, int len);
168 * int_to_str_back()
170 * Output gint32 decimal representation backward (last character will be written on ptr - 1),
171 * and return pointer to first character.
173 * String is not NUL terminated by this routine.
174 * There needs to be at least 11 bytes in the buffer.
176 char *int_to_str_back(char *ptr, gint32 value);
179 * int64_to_str_back()
181 * Output gint64 decimal representation backward (last character will be written on ptr - 1),
182 * and return pointer to first character.
184 * String is not NUL terminated by this routine.
185 * There needs to be at least 21 bytes in the buffer.
187 char *int64_to_str_back(char *ptr, gint64 value);
189 #endif /* __TO_STR_INT_H__ */