GNU Radio's GSM Package
utils.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  value_string
 

Macros

#define ARRAY_SIZE(x)   (sizeof(x) / sizeof((x)[0]))
 
#define OSMO_MAX(a, b)   ((a) >= (b) ? (a) : (b))
 
#define OSMO_MIN(a, b)   ((a) >= (b) ? (b) : (a))
 
#define OSMO_STRINGIFY(x)   #x
 
#define OSMO_STRINGIFY_VAL(x)   OSMO_STRINGIFY(x)
 
#define OSMO_VALUE_STRING(x)   { x, #x }
 
#define OSMO_BYTES_FOR_BITS(BITS)   ((BITS + 8 - 1) / 8)
 
#define osmo_static_assert(exp, name)   typedef int dummy##name [(exp) ? 1 : -1] __attribute__((__unused__));
 
#define OSMO_SNPRINTF_RET(ret, rem, offset, len)
 
#define OSMO_ASSERT(exp)
 

Functions

const char * get_value_string_or_null (const struct value_string *vs, uint32_t val)
 
int get_string_value (const struct value_string *vs, const char *str)
 
char osmo_bcd2char (uint8_t bcd)
 
uint8_t osmo_char2bcd (char c)
 
char * osmo_ubit_dump (const uint8_t *bits, unsigned int len)
 
char * osmo_hexdump (const unsigned char *buf, int len)
 
char * osmo_hexdump_nospc (const unsigned char *buf, int len)
 
char * osmo_osmo_hexdump_nospc (const unsigned char *buf, int len) __attribute__((__deprecated__))
 
void osmo_str2lower (char *out, const char *in)
 
void osmo_str2upper (char *out, const char *in)
 
int osmo_constant_time_cmp (const uint8_t *exp, const uint8_t *rel, const int count)
 
uint64_t osmo_decode_big_endian (const uint8_t *data, size_t data_len)
 
uint8_t * osmo_encode_big_endian (uint64_t value, size_t data_len)
 
size_t osmo_strlcpy (char *dst, const char *src, size_t siz)
 
bool osmo_is_hexstr (const char *str, int min_digits, int max_digits, bool require_even)
 
bool osmo_identifier_valid (const char *str)
 
bool osmo_separated_identifiers_valid (const char *str, const char *sep_chars)
 
const char * osmo_escape_str (const char *str, int len)
 
const char * osmo_escape_str_buf (const char *str, int in_len, char *buf, size_t bufsize)