18#ifndef CELLULAR_UTIL_H_
19#define CELLULAR_UTIL_H_
23#include "netsocket/nsapi_types.h"
25namespace mbed_cellular_util {
28#define EMPTY_CHECK(val) (val ## 1)
29#define EMPTY(val) (EMPTY_CHECK(val) == 1)
30#define _CELLULAR_STRINGIFY(a) #a
31#define CELLULAR_STRINGIFY(a) _CELLULAR_STRINGIFY(a)
33static const char hex_values[] =
"0123456789ABCDEF";
43nsapi_version_t convert_ipv6(
char *ip);
55void separate_ip_addresses(
char *orig,
char *ip,
size_t ip_size,
char *ip2,
size_t ip2_size);
64void prefer_ipv6(
char *ip,
size_t ip_size,
char *ip2,
size_t ip2_size);
71void int_to_hex_str(uint8_t num,
char *buf);
80int char_str_to_hex_str(
const char *str, uint16_t len,
char *buf,
bool omit_leading_zero =
false);
88int hex_str_to_int(
const char *hex_string,
int hex_string_length);
97int hex_str_to_char_str(
const char *str, uint16_t len,
char *buf);
104void hex_to_char(
const char *hex,
char &buf);
115void uint_to_binary_str(uint32_t num,
char *str,
int str_size,
int bit_cnt);
124uint32_t binary_str_to_uint(
const char *binary_string,
int binary_string_length);
130uint16_t get_dynamic_ip_port();