Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
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
22extern "C" {
23#endif /* __cplusplus */
24
34WS_DLL_PUBLIC char *uint8_to_hex(char *out, uint8_t val);
35
36WS_DEPRECATED_X("Use uint8_to_hex instead")
37static inline char *guint8_to_hex(char *out, uint8_t val) { return uint8_to_hex(out, val); }
38
48WS_DLL_PUBLIC char *word_to_hex(char *out, uint16_t word);
49
60WS_DLL_PUBLIC char *word_to_hex_punct(char *out, uint16_t word, char punct);
61
71WS_DLL_PUBLIC char *word_to_hex_npad(char *out, uint16_t word);
72
82WS_DLL_PUBLIC char *dword_to_hex(char *out, uint32_t dword);
83
94WS_DLL_PUBLIC char *dword_to_hex_punct(char *out, uint32_t dword, char punct);
95
105WS_DLL_PUBLIC char *qword_to_hex(char *out, uint64_t qword);
106
117WS_DLL_PUBLIC char *qword_to_hex_punct(char *out, uint64_t qword, char punct);
118
128WS_DLL_PUBLIC char *bytes_to_hexstr(char *out, const uint8_t *ad, size_t len);
129
140WS_DLL_PUBLIC char *bytes_to_hexstr_punct(char *out, const uint8_t *ad, size_t len, char punct);
141
152WS_DLL_PUBLIC char *bytes_to_str_punct_maxlen(wmem_allocator_t *scope,
153 const uint8_t *buf, size_t buf_size,
154 char punct, size_t max_bytes_len);
155
156#define bytes_to_str_punct(scope, buf, buf_size, punct) \
157 bytes_to_str_punct_maxlen(scope, buf, buf_size, punct, 24)
158
167WS_DLL_PUBLIC char *bytes_to_str_maxlen(wmem_allocator_t *scope,
168 const uint8_t *buf, size_t buf_size,
169 size_t max_bytes_len);
170
171#define bytes_to_str(scope, buf, buf_size) \
172 bytes_to_str_maxlen(scope, buf, buf_size, 36)
173
183WS_DLL_PUBLIC char *oct_to_str_back(char *ptr, uint32_t value);
184
194WS_DLL_PUBLIC char *oct64_to_str_back(char *ptr, uint64_t value);
195
206WS_DLL_PUBLIC char *hex_to_str_back_len(char *ptr, uint32_t value, int len);
207
218WS_DLL_PUBLIC char *hex64_to_str_back_len(char *ptr, uint64_t value, int len);
219
229WS_DLL_PUBLIC char *uint_to_str_back(char *ptr, uint32_t value);
230
240WS_DLL_PUBLIC char *uint64_to_str_back(char *ptr, uint64_t value);
241
252WS_DLL_PUBLIC char *uint_to_str_back_len(char *ptr, uint32_t value, int len);
253
264WS_DLL_PUBLIC char *uint64_to_str_back_len(char *ptr, uint64_t value, int len);
265
275WS_DLL_PUBLIC char *int_to_str_back(char *ptr, int32_t value);
276
286WS_DLL_PUBLIC char *int64_to_str_back(char *ptr, int64_t value);
287
288WS_DLL_PUBLIC void uint32_to_str_buf(uint32_t u, char *buf, size_t buf_len);
289
290WS_DEPRECATED_X("Use uint32_to_str_buf instead")
291static inline void guint32_to_str_buf(uint32_t u, char *buf, size_t buf_len) { uint32_to_str_buf(u, buf, buf_len); }
292
293WS_DLL_PUBLIC void uint64_to_str_buf(uint64_t u, char *buf, size_t buf_len);
294
295WS_DEPRECATED_X("Use uint64_to_str_buf instead")
296static inline void guint64_to_str_buf(uint64_t u, char *buf, size_t buf_len) { uint64_to_str_buf(u, buf, buf_len); }
297
298WS_DEPRECATED_X("Use ip_num_to_str_buf() or ip_addr_to_str() instead")
299WS_DLL_PUBLIC void ip_to_str_buf(const uint8_t *ad, char *buf, const int buf_len);
300
301WS_DEPRECATED_X("Use ip_num_to_str() or ip_addr_to_str() instead")
302WS_DLL_PUBLIC char *ip_to_str(wmem_allocator_t *scope, const uint8_t *ad);
303
304/* Host byte order */
305WS_DLL_PUBLIC void ip_num_to_str_buf(uint32_t ad, char *buf, const int buf_len);
306
307/* Host byte order */
308WS_DLL_PUBLIC char *ip_num_to_str(wmem_allocator_t *scope, uint32_t ad);
309
310WS_DLL_PUBLIC void ip_addr_to_str_buf(const ws_in4_addr *ad, char *buf, const int buf_len);
311
312WS_DLL_PUBLIC char *ip_addr_to_str(wmem_allocator_t *scope, const ws_in4_addr *ad);
313
314WS_DLL_PUBLIC void ip6_to_str_buf(const ws_in6_addr *ad, char *buf, size_t buf_size);
315
316WS_DLL_PUBLIC char *ip6_to_str(wmem_allocator_t *scope, const ws_in6_addr *ad);
317
318WS_DLL_PUBLIC char *ipxnet_to_str_punct(wmem_allocator_t *scope, const uint32_t ad, const char punct);
319
320WS_DLL_PUBLIC char *eui64_to_str(wmem_allocator_t *scope, const uint64_t ad);
321
322WS_DLL_PUBLIC int format_fractional_part_nsecs(char *, size_t, uint32_t, const char *, int);
323
324WS_DLL_PUBLIC void display_epoch_time(char *, size_t, const nstime_t *, int);
325
326WS_DLL_PUBLIC void display_signed_time(char *, size_t, const nstime_t *, int);
327
328WS_DLL_PUBLIC void format_nstime_as_iso8601(char *, size_t, const nstime_t *, char *, bool, int);
329
330#ifdef __cplusplus
331}
332#endif /* __cplusplus */
333
334#endif /* __TO_STR_H__ */
Definition wmem_allocator.h:27
Definition inet_addr.h:21
Definition nstime.h:26
WS_DLL_PUBLIC char * word_to_hex_punct(char *out, uint16_t word, char punct)
Definition to_str.c:112
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 * bytes_to_hexstr(char *out, const uint8_t *ad, size_t len)
Definition to_str.c:176
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 * hex_to_str_back_len(char *ptr, uint32_t value, int len)
Definition to_str.c:324
WS_DLL_PUBLIC char * word_to_hex_npad(char *out, uint16_t word)
Definition to_str.c:121
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 * qword_to_hex_punct(char *out, uint64_t qword, char punct)
Definition to_str.c:159
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 * oct64_to_str_back(char *ptr, uint64_t value)
Definition to_str.c:312
WS_DLL_PUBLIC char * qword_to_hex(char *out, uint64_t qword)
Definition to_str.c:151
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 * dword_to_hex_punct(char *out, uint32_t dword, char punct)
Definition to_str.c:142
WS_DLL_PUBLIC char * dword_to_hex(char *out, uint32_t dword)
Definition to_str.c:134
WS_DLL_PUBLIC char * uint64_to_str_back(char *ptr, uint64_t value)
Definition to_str.c:390
WS_DLL_PUBLIC char * int_to_str_back(char *ptr, int32_t value)
Definition to_str.c:455
WS_DLL_PUBLIC char * word_to_hex(char *out, uint16_t word)
Definition to_str.c:104
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 * oct_to_str_back(char *ptr, uint32_t value)
Definition to_str.c:300
WS_DLL_PUBLIC char * uint_to_str_back(char *ptr, uint32_t value)
Definition to_str.c:366
WS_DLL_PUBLIC char * uint8_to_hex(char *out, uint8_t val)
Definition to_str.c:98
WS_DLL_PUBLIC char * int64_to_str_back(char *ptr, int64_t value)
Definition to_str.c:467