buffer.pod revision 291721
1=pod
2
3=head1 NAME
4
5BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow - simple
6character array structure
7
8BUF_strdup, BUF_strndup, BUF_memdup, BUF_strlcpy, BUF_strlcat -
9standard C library equivalents
10
11=head1 SYNOPSIS
12
13 #include <openssl/buffer.h>
14
15 BUF_MEM *BUF_MEM_new(void);
16
17 void	BUF_MEM_free(BUF_MEM *a);
18
19 int	BUF_MEM_grow(BUF_MEM *str, int len);
20
21 char *BUF_strdup(const char *str);
22
23 char *BUF_strndup(const char *str, size_t siz);
24
25 void *BUF_memdup(const void *data, size_t siz);
26
27 size_t BUF_strlcpy(char *dst, const char *src, size_t size);
28
29 size_t BUF_strlcat(char *dst, const char *src, size_t size);
30
31=head1 DESCRIPTION
32
33The buffer library handles simple character arrays. Buffers are used for
34various purposes in the library, most notably memory BIOs.
35
36BUF_MEM_new() allocates a new buffer of zero size.
37
38BUF_MEM_free() frees up an already existing buffer. The data is zeroed
39before freeing up in case the buffer contains sensitive data.
40
41BUF_MEM_grow() changes the size of an already existing buffer to
42B<len>. Any data already in the buffer is preserved if it increases in
43size.
44
45BUF_strdup(), BUF_strndup(), BUF_memdup(), BUF_strlcpy() and
46BUF_strlcat() are equivalents of the standard C library functions. The
47dup() functions use OPENSSL_malloc() underneath and so should be used
48in preference to the standard library for memory leak checking or
49replacing the malloc() function.
50
51Memory allocated from these functions should be freed up using the
52OPENSSL_free() function.
53
54BUF_strndup makes the explicit guarantee that it will never read past
55the first B<siz> bytes of B<str>.
56
57=head1 RETURN VALUES
58
59BUF_MEM_new() returns the buffer or NULL on error.
60
61BUF_MEM_free() has no return value.
62
63BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>).
64
65=head1 SEE ALSO
66
67L<bio(3)|bio(3)>
68
69=head1 HISTORY
70
71BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all
72versions of SSLeay and OpenSSL. BUF_strdup() was added in SSLeay 0.8.
73
74=cut
75