12#ifndef __WSUTIL_TO_STR_H__
13#define __WSUTIL_TO_STR_H__
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); }
50WS_DLL_PUBLIC
char *
word_to_hex(
char *out, uint16_t word);
91WS_DLL_PUBLIC
char *
dword_to_hex(
char *out, uint32_t dword);
119WS_DLL_PUBLIC
char *
qword_to_hex(
char *out, uint64_t qword);
148WS_DLL_PUBLIC
char *
bytes_to_hexstr(
char *out,
const uint8_t *ad,
size_t len);
180 const uint8_t *buf,
size_t buf_size,
181 char punct,
size_t max_bytes_len);
183#define bytes_to_str_punct(scope, buf, buf_size, punct) \
184 bytes_to_str_punct_maxlen(scope, buf, buf_size, punct, 24)
196 const uint8_t *buf,
size_t buf_size,
197 size_t max_bytes_len);
199#define bytes_to_str(scope, buf, buf_size) \
200 bytes_to_str_maxlen(scope, buf, buf_size, 36)
354WS_DEPRECATED_X(
"Use uint32_to_str_buf instead")
355static inline
void guint32_to_str_buf(uint32_t u,
char *buf,
size_t buf_len) {
uint32_to_str_buf(u, buf, buf_len); }
370WS_DEPRECATED_X(
"Use uint64_to_str_buf instead")
371static inline
void guint64_to_str_buf(uint64_t u,
char *buf,
size_t buf_len) {
uint64_to_str_buf(u, buf, buf_len); }
373WS_DEPRECATED_X(
"Use ip_num_to_str_buf() or ip_addr_to_str() instead")
374WS_DLL_PUBLIC
void ip_to_str_buf(const uint8_t *ad,
char *buf, const
int buf_len);
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
WS_DLL_PUBLIC char * word_to_hex_punct(char *out, uint16_t word, char punct)
Converts a 16-bit word to a hexadecimal string with byte-level punctuation.
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)
Turn an array of bytes into a string showing the bytes in hex.
Definition to_str.c:263
WS_DLL_PUBLIC char * bytes_to_hexstr(char *out, const uint8_t *ad, size_t len)
Converts a byte array to a hexadecimal string.
Definition to_str.c:176
WS_DLL_PUBLIC char * hex64_to_str_back_len(char *ptr, uint64_t value, int len)
Converts a 64-bit unsigned integer to hex string in reverse with fixed length.
Definition to_str.c:351
WS_DLL_PUBLIC char * hex_to_str_back_len(char *ptr, uint32_t value, int len)
Converts a 32-bit unsigned integer to hex string in reverse with fixed length.
Definition to_str.c:330
WS_DLL_PUBLIC char * word_to_hex_npad(char *out, uint16_t word)
Converts a 16-bit word to a hexadecimal string without padding.
Definition to_str.c:121
WS_DLL_PUBLIC int format_fractional_part_nsecs(char *buf, size_t buflen, uint32_t nsecs, const char *decimal_point, int precision)
Formats the fractional part of a timestamp in nanoseconds.
Definition to_str.c:700
WS_DLL_PUBLIC char * ip_addr_to_str(wmem_allocator_t *scope, const ws_in4_addr *ad)
Converts a ws_in4_addr structure to a string using memory scope.
Definition to_str.c:600
WS_DLL_PUBLIC void uint32_to_str_buf(uint32_t u, char *buf, size_t buf_len)
Converts a 32-bit unsigned integer to a decimal string.
Definition to_str.c:502
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)
Turn an array of bytes into a string showing the bytes in hex, separated by a punctuation character.
Definition to_str.c:218
WS_DLL_PUBLIC void uint64_to_str_buf(uint64_t u, char *buf, size_t buf_len)
Converts a 64-bit unsigned integer to a decimal string.
Definition to_str.c:544
WS_DLL_PUBLIC char * qword_to_hex_punct(char *out, uint64_t qword, char punct)
Converts a 64-bit word to a hexadecimal string with punctuation.
Definition to_str.c:159
WS_DLL_PUBLIC char * bytes_to_hexstr_punct(char *out, const uint8_t *ad, size_t len, char punct)
Converts a byte array to a hexadecimal string with punctuation.
Definition to_str.c:196
WS_DLL_PUBLIC char * oct64_to_str_back(char *ptr, uint64_t value)
Converts a 64-bit unsigned integer to octal string in reverse.
Definition to_str.c:318
WS_DLL_PUBLIC char * ip6_to_str(wmem_allocator_t *scope, const ws_in6_addr *ad)
Converts a ws_in6_addr structure to a string using memory scope.
Definition to_str.c:647
WS_DLL_PUBLIC char * qword_to_hex(char *out, uint64_t qword)
Converts a 64-bit word to a fixed-width hexadecimal string.
Definition to_str.c:151
WS_DLL_PUBLIC void format_nstime_as_iso8601(char *buf, size_t buf_size, const nstime_t *nstime, char *frac_buf, bool include_tz, int precision)
Formats an nstime_t value as an ISO 8601 timestamp.
Definition to_str.c:965
WS_DLL_PUBLIC char * uint64_to_str_back_len(char *ptr, uint64_t value, int len)
Converts a 64-bit unsigned integer to a zero-padded decimal string in reverse.
Definition to_str.c:441
WS_DLL_PUBLIC char * dword_to_hex_punct(char *out, uint32_t dword, char punct)
Converts a 32-bit word to a hexadecimal string with punctuation.
Definition to_str.c:142
WS_DLL_PUBLIC void ip_num_to_str_buf(uint32_t ad, char *buf, const int buf_len)
Converts a 32-bit IPv4 address to string format.
Definition to_str.c:610
WS_DLL_PUBLIC char * dword_to_hex(char *out, uint32_t dword)
Converts a 32-bit word to a fixed-width hexadecimal string.
Definition to_str.c:134
WS_DLL_PUBLIC void ip6_to_str_buf(const ws_in6_addr *ad, char *buf, size_t buf_size)
Converts a ws_in6_addr structure to string format.
Definition to_str.c:637
WS_DLL_PUBLIC char * uint64_to_str_back(char *ptr, uint64_t value)
Converts a 64-bit unsigned integer to a decimal string in reverse.
Definition to_str.c:396
WS_DLL_PUBLIC char * int_to_str_back(char *ptr, int32_t value)
Converts a 32-bit signed integer to a decimal string in reverse.
Definition to_str.c:461
WS_DLL_PUBLIC char * ipxnet_to_str_punct(wmem_allocator_t *scope, const uint32_t ad, const char punct)
Converts an IPX network address to a string with punctuation.
Definition to_str.c:657
WS_DLL_PUBLIC char * word_to_hex(char *out, uint16_t word)
Converts a 16-bit word to a fixed-width hexadecimal string.
Definition to_str.c:104
WS_DLL_PUBLIC char * uint_to_str_back_len(char *ptr, uint32_t value, int len)
Converts a 32-bit unsigned integer to a zero-padded decimal string in reverse.
Definition to_str.c:421
WS_DLL_PUBLIC void display_epoch_time(char *buf, size_t buflen, const nstime_t *ns, int precision)
Formats an epoch time value for display.
Definition to_str.c:888
WS_DLL_PUBLIC void ip_addr_to_str_buf(const ws_in4_addr *ad, char *buf, const int buf_len)
Converts a ws_in4_addr structure to string format.
Definition to_str.c:562
WS_DLL_PUBLIC char * eui64_to_str(wmem_allocator_t *scope, const uint64_t ad)
Converts a 64-bit EUI-64 address to string format.
Definition to_str.c:668
WS_DLL_PUBLIC char * oct_to_str_back(char *ptr, uint32_t value)
Converts a 32-bit unsigned integer to octal string in reverse.
Definition to_str.c:306
WS_DLL_PUBLIC void display_signed_time(char *buf, size_t buf_size, const nstime_t *nstime, int precision)
Formats a signed time value for display.
Definition to_str.c:894
WS_DLL_PUBLIC char * uint_to_str_back(char *ptr, uint32_t value)
Converts a 32-bit unsigned integer to decimal string in reverse.
Definition to_str.c:372
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)
Converts a 64-bit signed integer to a decimal string in reverse.
Definition to_str.c:473
WS_DLL_PUBLIC char * ip_num_to_str(wmem_allocator_t *scope, uint32_t ad)
Converts a 32-bit IPv4 address to a string using memory scope.
Definition to_str.c:618