10 #ifndef __ZRTP_STRING_H__
11 #define __ZRTP_STRING_H__
13 #include "zrtp_config.h"
24 #define ZRTP_STRING8 12
25 #define ZRTP_STRING16 20
26 #define ZRTP_STRING32 36
27 #define ZRTP_STRING64 68
28 #define ZRTP_STRING128 132
29 #define ZRTP_STRING256 260
30 #define ZRTP_STRING1024 1028
33 #if ( ZRTP_PLATFORM != ZP_SYMBIAN )
48 char buffer[ZRTP_STRING8];
56 char buffer[ZRTP_STRING16];
63 char buffer[ZRTP_STRING32];
70 char buffer[ZRTP_STRING64];
77 char buffer[ZRTP_STRING128];
84 char buffer[ZRTP_STRING256];
91 char buffer[ZRTP_STRING1024];
94 #if ( ZRTP_PLATFORM != ZP_SYMBIAN )
133 #define ZSTR_GV(pstr) \
134 (zrtp_stringn_t*)((char*)pstr.buffer - sizeof(pstr.max_length) - sizeof(pstr.length))
142 #define ZSTR_GVP(pstr) \
143 (zrtp_stringn_t*)((char*)pstr->buffer - sizeof(pstr->max_length) - sizeof(pstr->length))
150 #define ZSTR_INIT_EMPTY(a) { 0, sizeof(a.buffer) - 1, { 0 }}
156 #define ZSTR_INIT_WITH_CONST_CSTRING(s) {sizeof(s) - 1, 0, s}
164 #define ZSTR_SET_EMPTY(a)\
165 { a.length = 0; a.max_length = sizeof(a.buffer) - 1; a.buffer[0] = 0; }
168 #if defined(__cplusplus)
250 int zrtp_memcmp(
const void* s1,
const void* s2, uint32_t n);
263 const char*
hex2str(
const char* bin,
int bin_size,
char* buff,
int buff_size);
275 char *
str2hex(
const char* buff,
int buff_size,
char* bin,
int bin_size);
277 #if defined(__cplusplus)
Definition: zrtp_string.h:73
Definition: zrtp_string.h:52
Definition: zrtp_string.h:87
int zrtp_memcmp(const void *s1, const void *s2, uint32_t n)
Compare two binary strings.
Definition: zrtp_string.h:37
void zrtp_wipe_zstring(zrtp_stringn_t *zstr)
Clear a zstring.
void zrtp_zstrncpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src, uint16_t size)
Copy first N bytes of zstring.
Definition: zrtp_string.h:66
Definition: zrtp_string.h:80
void zrtp_zstrncpyc(zrtp_stringn_t *dst, const char *src, uint16_t size)
Copy first N bytes of a c-string into a z-string.
void zrtp_zstrcpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src)
Copy a zstring.
Definition: zrtp_string.h:59
Definition: zrtp_string.h:44
void zrtp_zstrcat(zrtp_stringn_t *dst, const zrtp_stringn_t *src)
Concatenate two strings.
void zrtp_zstrcpyc(zrtp_stringn_t *dst, const char *src)
Copy a c-string into a z-string.
int zrtp_zstrcmp(const zrtp_stringn_t *left, const zrtp_stringn_t *right)
compare two zstrings
const char * hex2str(const char *bin, int bin_size, char *buff, int buff_size)
Converts binary data to the hex string representation.
char * str2hex(const char *buff, int buff_size, char *bin, int bin_size)
Converts hex string to the binary representation.