diff options
Diffstat (limited to 'lib/gnutls_str.h')
-rw-r--r-- | lib/gnutls_str.h | 110 |
1 files changed, 56 insertions, 54 deletions
diff --git a/lib/gnutls_str.h b/lib/gnutls_str.h index fde073291b..a99a6265c5 100644 --- a/lib/gnutls_str.h +++ b/lib/gnutls_str.h @@ -28,91 +28,93 @@ #include "gettext.h" #define _(String) dgettext (PACKAGE, String) -void _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src); -void _gnutls_mem_cpy (char *dest, size_t dest_tot_size, const char *src, - size_t src_size); -void _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src); - -typedef struct -{ - uint8_t *allocd; /* pointer to allocated data */ - uint8_t *data; /* API: pointer to data to copy from */ - size_t max_length; - size_t length; /* API: current length */ +void _gnutls_str_cpy(char *dest, size_t dest_tot_size, const char *src); +void _gnutls_mem_cpy(char *dest, size_t dest_tot_size, const char *src, + size_t src_size); +void _gnutls_str_cat(char *dest, size_t dest_tot_size, const char *src); + +typedef struct { + uint8_t *allocd; /* pointer to allocated data */ + uint8_t *data; /* API: pointer to data to copy from */ + size_t max_length; + size_t length; /* API: current length */ } gnutls_buffer_st; /* Initialize a buffer */ -void _gnutls_buffer_init (gnutls_buffer_st *); +void _gnutls_buffer_init(gnutls_buffer_st *); /* Free the data in a buffer */ -void _gnutls_buffer_clear (gnutls_buffer_st *); +void _gnutls_buffer_clear(gnutls_buffer_st *); /* Set the buffer data to be of zero length */ -inline static void _gnutls_buffer_reset (gnutls_buffer_st * buf) +inline static void _gnutls_buffer_reset(gnutls_buffer_st * buf) { - buf->data = buf->allocd; - buf->length = 0; + buf->data = buf->allocd; + buf->length = 0; } -int _gnutls_buffer_resize (gnutls_buffer_st *, size_t new_size); +int _gnutls_buffer_resize(gnutls_buffer_st *, size_t new_size); -int _gnutls_buffer_append_str (gnutls_buffer_st *, const char *str); -int _gnutls_buffer_append_data (gnutls_buffer_st *, const void *data, - size_t data_size); +int _gnutls_buffer_append_str(gnutls_buffer_st *, const char *str); +int _gnutls_buffer_append_data(gnutls_buffer_st *, const void *data, + size_t data_size); #include <gnutls_num.h> -void _gnutls_buffer_replace_data( gnutls_buffer_st * buf, gnutls_datum_t * data); +void _gnutls_buffer_replace_data(gnutls_buffer_st * buf, + gnutls_datum_t * data); -int _gnutls_buffer_append_prefix (gnutls_buffer_st * buf, int pfx_size, size_t data_size); +int _gnutls_buffer_append_prefix(gnutls_buffer_st * buf, int pfx_size, + size_t data_size); -int _gnutls_buffer_append_mpi (gnutls_buffer_st * buf, int pfx_size, bigint_t, int lz); +int _gnutls_buffer_append_mpi(gnutls_buffer_st * buf, int pfx_size, + bigint_t, int lz); -int _gnutls_buffer_append_data_prefix (gnutls_buffer_st * buf, int pfx_size, - const void *data, size_t data_size); -void _gnutls_buffer_pop_data (gnutls_buffer_st *, void *, size_t * size); -void _gnutls_buffer_pop_datum (gnutls_buffer_st *, gnutls_datum_t *, - size_t max_size); +int _gnutls_buffer_append_data_prefix(gnutls_buffer_st * buf, int pfx_size, + const void *data, size_t data_size); +void _gnutls_buffer_pop_data(gnutls_buffer_st *, void *, size_t * size); +void _gnutls_buffer_pop_datum(gnutls_buffer_st *, gnutls_datum_t *, + size_t max_size); -int _gnutls_buffer_pop_prefix (gnutls_buffer_st * buf, size_t * data_size, - int check); +int _gnutls_buffer_pop_prefix(gnutls_buffer_st * buf, size_t * data_size, + int check); -int _gnutls_buffer_pop_data_prefix (gnutls_buffer_st * buf, void *data, - size_t * data_size); +int _gnutls_buffer_pop_data_prefix(gnutls_buffer_st * buf, void *data, + size_t * data_size); -int _gnutls_buffer_pop_datum_prefix (gnutls_buffer_st * buf, - gnutls_datum_t * data); -int _gnutls_buffer_to_datum (gnutls_buffer_st * str, gnutls_datum_t * data); +int _gnutls_buffer_pop_datum_prefix(gnutls_buffer_st * buf, + gnutls_datum_t * data); +int _gnutls_buffer_to_datum(gnutls_buffer_st * str, gnutls_datum_t * data); -int _gnutls_buffer_escape (gnutls_buffer_st * dest, int all, - const char *const invalid_chars); -int _gnutls_buffer_unescape (gnutls_buffer_st * dest); +int _gnutls_buffer_escape(gnutls_buffer_st * dest, int all, + const char *const invalid_chars); +int _gnutls_buffer_unescape(gnutls_buffer_st * dest); #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#define __attribute__(Spec) /* empty */ +#define __attribute__(Spec) /* empty */ #endif #endif -int _gnutls_buffer_append_printf (gnutls_buffer_st * dest, const char *fmt, - ...) - __attribute__ ((format (printf, 2, 3))); +int _gnutls_buffer_append_printf(gnutls_buffer_st * dest, const char *fmt, + ...) + __attribute__ ((format(printf, 2, 3))); -void _gnutls_buffer_hexprint (gnutls_buffer_st * str, - const void *data, size_t len); -void _gnutls_buffer_hexdump (gnutls_buffer_st * str, const void *data, - size_t len, const char *spc); -void _gnutls_buffer_asciiprint (gnutls_buffer_st * str, - const char *data, size_t len); +void _gnutls_buffer_hexprint(gnutls_buffer_st * str, + const void *data, size_t len); +void _gnutls_buffer_hexdump(gnutls_buffer_st * str, const void *data, + size_t len, const char *spc); +void _gnutls_buffer_asciiprint(gnutls_buffer_st * str, + const char *data, size_t len); -char *_gnutls_bin2hex (const void *old, size_t oldlen, char *buffer, - size_t buffer_size, const char *separator); -int _gnutls_hex2bin (const char * hex_data, size_t hex_size, uint8_t * bin_data, - size_t * bin_size); +char *_gnutls_bin2hex(const void *old, size_t oldlen, char *buffer, + size_t buffer_size, const char *separator); +int _gnutls_hex2bin(const char *hex_data, size_t hex_size, + uint8_t * bin_data, size_t * bin_size); -int _gnutls_hostname_compare (const char *certname, size_t certnamesize, - const char *hostname, int level); +int _gnutls_hostname_compare(const char *certname, size_t certnamesize, + const char *hostname, int level); #define MAX_CN 256 #define MAX_DN 1024 |