Wireshark  4.3.0
The Wireshark network protocol analyzer
to_str.h
Go to the documentation of this file.
1 
12 #ifndef __WSUTIL_TO_STR_H__
13 #define __WSUTIL_TO_STR_H__
14 
15 #include <wireshark.h>
16 
17 #include <wsutil/wmem/wmem.h>
18 #include <wsutil/inet_addr.h>
19 #include <wsutil/nstime.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
34 WS_DLL_PUBLIC char *guint8_to_hex(char *out, uint8_t val);
35 
45 WS_DLL_PUBLIC char *word_to_hex(char *out, uint16_t word);
46 
57 WS_DLL_PUBLIC char *word_to_hex_punct(char *out, uint16_t word, char punct);
58 
68 WS_DLL_PUBLIC char *word_to_hex_npad(char *out, uint16_t word);
69 
79 WS_DLL_PUBLIC char *dword_to_hex(char *out, uint32_t dword);
80 
91 WS_DLL_PUBLIC char *dword_to_hex_punct(char *out, uint32_t dword, char punct);
92 
102 WS_DLL_PUBLIC char *qword_to_hex(char *out, uint64_t qword);
103 
114 WS_DLL_PUBLIC char *qword_to_hex_punct(char *out, uint64_t qword, char punct);
115 
125 WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const uint8_t *ad, size_t len);
126 
137 WS_DLL_PUBLIC char *bytes_to_hexstr_punct(char *out, const uint8_t *ad, size_t len, char punct);
138 
149 WS_DLL_PUBLIC char *bytes_to_str_punct_maxlen(wmem_allocator_t *scope,
150  const uint8_t *buf, size_t buf_size,
151  char punct, size_t max_bytes_len);
152 
153 #define bytes_to_str_punct(scope, buf, buf_size, punct) \
154  bytes_to_str_punct_maxlen(scope, buf, buf_size, punct, 24)
155 
164 WS_DLL_PUBLIC char *bytes_to_str_maxlen(wmem_allocator_t *scope,
165  const uint8_t *buf, size_t buf_size,
166  size_t max_bytes_len);
167 
168 #define bytes_to_str(scope, buf, buf_size) \
169  bytes_to_str_maxlen(scope, buf, buf_size, 36)
170 
180 WS_DLL_PUBLIC char *oct_to_str_back(char *ptr, uint32_t value);
181 
191 WS_DLL_PUBLIC char *oct64_to_str_back(char *ptr, uint64_t value);
192 
203 WS_DLL_PUBLIC char *hex_to_str_back_len(char *ptr, uint32_t value, int len);
204 
215 WS_DLL_PUBLIC char *hex64_to_str_back_len(char *ptr, uint64_t value, int len);
216 
226 WS_DLL_PUBLIC char *uint_to_str_back(char *ptr, uint32_t value);
227 
237 WS_DLL_PUBLIC char *uint64_to_str_back(char *ptr, uint64_t value);
238 
249 WS_DLL_PUBLIC char *uint_to_str_back_len(char *ptr, uint32_t value, int len);
250 
261 WS_DLL_PUBLIC char *uint64_to_str_back_len(char *ptr, uint64_t value, int len);
262 
272 WS_DLL_PUBLIC char *int_to_str_back(char *ptr, int32_t value);
273 
283 WS_DLL_PUBLIC char *int64_to_str_back(char *ptr, int64_t value);
284 
285 WS_DLL_PUBLIC void guint32_to_str_buf(uint32_t u, char *buf, size_t buf_len);
286 
287 WS_DLL_PUBLIC void guint64_to_str_buf(uint64_t u, char *buf, size_t buf_len);
288 
289 WS_DEPRECATED_X("Use ip_num_to_str_buf() or ip_addr_to_str() instead")
290 WS_DLL_PUBLIC void ip_to_str_buf(const uint8_t *ad, char *buf, const int buf_len);
291 
292 WS_DEPRECATED_X("Use ip_num_to_str() or ip_addr_to_str() instead")
293 WS_DLL_PUBLIC char *ip_to_str(wmem_allocator_t *scope, const uint8_t *ad);
294 
295 /* Host byte order */
296 WS_DLL_PUBLIC void ip_num_to_str_buf(uint32_t ad, char *buf, const int buf_len);
297 
298 /* Host byte order */
299 WS_DLL_PUBLIC char *ip_num_to_str(wmem_allocator_t *scope, uint32_t ad);
300 
301 WS_DLL_PUBLIC void ip_addr_to_str_buf(const ws_in4_addr *ad, char *buf, const int buf_len);
302 
303 WS_DLL_PUBLIC char *ip_addr_to_str(wmem_allocator_t *scope, const ws_in4_addr *ad);
304 
305 WS_DLL_PUBLIC void ip6_to_str_buf(const ws_in6_addr *ad, char *buf, size_t buf_size);
306 
307 WS_DLL_PUBLIC char *ip6_to_str(wmem_allocator_t *scope, const ws_in6_addr *ad);
308 
309 WS_DLL_PUBLIC char *ipxnet_to_str_punct(wmem_allocator_t *scope, const uint32_t ad, const char punct);
310 
311 WS_DLL_PUBLIC char *eui64_to_str(wmem_allocator_t *scope, const uint64_t ad);
312 
313 WS_DLL_PUBLIC int format_fractional_part_nsecs(char *, size_t, uint32_t, const char *, int);
314 
315 WS_DLL_PUBLIC void display_epoch_time(char *, size_t, const nstime_t *, int);
316 
317 WS_DLL_PUBLIC void display_signed_time(char *, size_t, const nstime_t *, int);
318 
319 WS_DLL_PUBLIC void format_nstime_as_iso8601(char *, size_t, const nstime_t *, char *, bool, int);
320 
321 #ifdef __cplusplus
322 }
323 #endif /* __cplusplus */
324 
325 #endif /* __TO_STR_H__ */
Definition: wmem_allocator.h:27
Definition: inet_addr.h:21
Definition: nstime.h:26
WS_DLL_PUBLIC char * int64_to_str_back(char *ptr, int64_t value)
Definition: to_str.c:467
WS_DLL_PUBLIC char * uint_to_str_back_len(char *ptr, uint32_t value, int len)
Definition: to_str.c:415
WS_DLL_PUBLIC char * uint64_to_str_back_len(char *ptr, uint64_t value, int len)
Definition: to_str.c:435
WS_DLL_PUBLIC char * qword_to_hex(char *out, uint64_t qword)
Definition: to_str.c:151
WS_DLL_PUBLIC char * oct_to_str_back(char *ptr, uint32_t value)
Definition: to_str.c:300
WS_DLL_PUBLIC char * word_to_hex_npad(char *out, uint16_t word)
Definition: to_str.c:121
WS_DLL_PUBLIC char * dword_to_hex(char *out, uint32_t dword)
Definition: to_str.c:134
WS_DLL_PUBLIC char * guint8_to_hex(char *out, uint8_t val)
Definition: to_str.c:98
WS_DLL_PUBLIC char * bytes_to_hexstr(char *out, const uint8_t *ad, size_t len)
Definition: to_str.c:176
WS_DLL_PUBLIC char * hex_to_str_back_len(char *ptr, uint32_t value, int len)
Definition: to_str.c:324
WS_DLL_PUBLIC char * int_to_str_back(char *ptr, int32_t value)
Definition: to_str.c:455
WS_DLL_PUBLIC char * dword_to_hex_punct(char *out, uint32_t dword, char punct)
Definition: to_str.c:142
WS_DLL_PUBLIC char * bytes_to_str_punct_maxlen(wmem_allocator_t *scope, const uint8_t *buf, size_t buf_size, char punct, size_t max_bytes_len)
Definition: to_str.c:218
WS_DLL_PUBLIC char * word_to_hex(char *out, uint16_t word)
Definition: to_str.c:104
WS_DLL_PUBLIC char * word_to_hex_punct(char *out, uint16_t word, char punct)
Definition: to_str.c:112
WS_DLL_PUBLIC char * uint_to_str_back(char *ptr, uint32_t value)
Definition: to_str.c:366
WS_DLL_PUBLIC char * bytes_to_hexstr_punct(char *out, const uint8_t *ad, size_t len, char punct)
Definition: to_str.c:196
WS_DLL_PUBLIC char * bytes_to_str_maxlen(wmem_allocator_t *scope, const uint8_t *buf, size_t buf_size, size_t max_bytes_len)
Definition: to_str.c:260
WS_DLL_PUBLIC char * uint64_to_str_back(char *ptr, uint64_t value)
Definition: to_str.c:390
WS_DLL_PUBLIC char * oct64_to_str_back(char *ptr, uint64_t value)
Definition: to_str.c:312
WS_DLL_PUBLIC char * hex64_to_str_back_len(char *ptr, uint64_t value, int len)
Definition: to_str.c:345
WS_DLL_PUBLIC char * qword_to_hex_punct(char *out, uint64_t qword, char punct)
Definition: to_str.c:159