lsquic_util.h revision 55cd0b38
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_util.h -- Utility functions 450aadb33SDmitri Tikhonov */ 550aadb33SDmitri Tikhonov 650aadb33SDmitri Tikhonov#ifndef LSQUIC_UTIL_H 750aadb33SDmitri Tikhonov#define LSQUIC_UTIL_H 1 850aadb33SDmitri Tikhonov 950aadb33SDmitri Tikhonov#ifdef __cplusplus 1050aadb33SDmitri Tikhonovextern "C" { 1150aadb33SDmitri Tikhonov#endif 1250aadb33SDmitri Tikhonov 1350aadb33SDmitri Tikhonovlsquic_time_t 1450aadb33SDmitri Tikhonovlsquic_time_now (void); 1550aadb33SDmitri Tikhonov 1683287402SDmitri Tikhonovvoid 1783287402SDmitri Tikhonovlsquic_init_timers (void); 1883287402SDmitri Tikhonov 1950aadb33SDmitri Tikhonov/* Returns 1 if `buf' contains only zero bytes, 0 otherwise. 2050aadb33SDmitri Tikhonov */ 2150aadb33SDmitri Tikhonovint 2250aadb33SDmitri Tikhonovlsquic_is_zero (const void *buf, size_t bufsz); 2350aadb33SDmitri Tikhonov 2450aadb33SDmitri Tikhonov 2550aadb33SDmitri Tikhonov 2650aadb33SDmitri Tikhonovchar * get_bin_str(const void *s, size_t len, size_t max_display_len); 2750aadb33SDmitri Tikhonov 2855cd0b38SDmitri Tikhonovsize_t 2955cd0b38SDmitri Tikhonovlsquic_hex_encode (const void *src, size_t src_sz, void *dst, size_t dst_sz); 3050aadb33SDmitri Tikhonov 3150aadb33SDmitri Tikhonov/* `out_sz' is assumed to be at least 1. `out' is always NUL-terminated. */ 3250aadb33SDmitri Tikhonovsize_t 3350aadb33SDmitri Tikhonovhexdump (const void *src, size_t src_sz, char *out, size_t out_sz); 3450aadb33SDmitri Tikhonov 3550aadb33SDmitri Tikhonov#ifdef __cplusplus 3650aadb33SDmitri Tikhonov} 3750aadb33SDmitri Tikhonov#endif 3850aadb33SDmitri Tikhonov 3950aadb33SDmitri Tikhonov 4050aadb33SDmitri Tikhonov#endif 41