Version 1.7.10.
[gnutls.git] / lib / gnutls_str.h
blobad7c1159a70b0ea9a76439b8a50abe87ae68a1a9
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
4 * Author: Nikos Mavroyanopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA
25 #ifndef GNUTLS_STR_H
26 # define GNUTLS_STR_H
28 #include <gnutls_int.h>
30 void _gnutls_str_cpy (char *dest, size_t dest_tot_size, const char *src);
31 void _gnutls_mem_cpy (char *dest, size_t dest_tot_size, const char *src,
32 size_t src_size);
33 void _gnutls_str_cat (char *dest, size_t dest_tot_size, const char *src);
35 typedef struct
37 opaque *data;
38 size_t max_length;
39 size_t length;
40 gnutls_realloc_function realloc_func;
41 gnutls_alloc_function alloc_func;
42 gnutls_free_function free_func;
43 } gnutls_string;
45 void _gnutls_string_init (gnutls_string *, gnutls_alloc_function,
46 gnutls_realloc_function, gnutls_free_function);
47 void _gnutls_string_clear (gnutls_string *);
49 /* Beware, do not clear the string, after calling this
50 * function
52 gnutls_datum_t _gnutls_string2datum (gnutls_string * str);
54 int _gnutls_string_copy_str (gnutls_string * dest, const char *src);
55 int _gnutls_string_append_str (gnutls_string *, const char *str);
56 int _gnutls_string_append_data (gnutls_string *, const void *data,
57 size_t data_size);
58 int _gnutls_string_append_printf (gnutls_string * dest, const char *fmt, ...);
60 char *_gnutls_bin2hex (const void *old, size_t oldlen, char *buffer,
61 size_t buffer_size);
62 int _gnutls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data,
63 size_t * bin_size);
65 #endif