1ldns(25 Apr 2005) ldns(25 Apr 2005)
2
3
4
6 ldns_buffer, ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buf‐
7 fer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export
8
9
11 #ifdef HAVE_STDINT_H
12 #include <stdint.h>
13 #endif /* HAVE_STDINT_H */
14
15 #ifdef HAVE_STDBOOL_H
16 #include <stdbool.h>
17 #endif /* HAVE_STDBOOL_H */
18
19 #include <ldns/ldns.h>
20
21 ldns_buffer* ldns_buffer_new(size_t capacity);
22
23 void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t
24 size);
25
26 void ldns_buffer_clear(ldns_buffer *buffer);
27
28 int ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...);
29
30 void ldns_buffer_free(ldns_buffer *buffer);
31
32 void* ldns_buffer_export(ldns_buffer *buffer);
33
35 ldns_buffer
36 LDNS implementation of buffers to ease operations
37 struct ldns_struct_buffer
38 {
39 The current position used for reading/writing:
40 size_t _position;
41
42 The read/write limit:
43 size_t _limit;
44
45 The amount of data the buffer can contain:
46 size_t _capacity;
47
48 The data contained in the buffer:
49 uint8_t *_data;
50
51 If the buffer is fixed it cannot be resized:
52 unsigned _fixed : 1;
53
54 The current state of the buffer:
55 ldns_status _status;
56 };
57 typedef struct ldns_struct_buffer ldns_buffer;
58
59 ldns_buffer_new() creates a new buffer with the specified capacity.
60
61 capacity: the size (in bytes) to allocate for the buffer
62 Returns the created buffer
63
64 ldns_buffer_new_frm_data() creates a buffer with the specified data.
65 The data IS copied and MEMORY allocations are done. The buffer
66 is not fixed and can be resized using buffer_reserve().
67
68 buffer: pointer to the buffer to put the data in
69 data: the data to encapsulate in the buffer
70 size: the size of the data
71
72 ldns_buffer_clear() clears the buffer and make it ready for writing.
73 The buffer's limit is set to the capacity and the position is
74 set to 0.
75
76 ldns_buffer_printf() prints to the buffer, increasing the capacity if
77 required using buffer_reserve(). The buffer's position is set to
78 the terminating terminating '\0') or -1 on failure.
79
80 ldns_buffer_free() frees the buffer.
81 *buffer: the buffer to be freed
82 Returns void
83
84 ldns_buffer_export() Makes the buffer fixed and returns a pointer to
85 the data. The caller is responsible for free'ing the result.
86 *buffer: the buffer to be exported
87 Returns void
88
90 The ldns team at NLnet Labs. Which consists out of: Jelte Jansen, Erik
91 Rozendaal and Miek Gieben.
92
93
95 Please report bugs to ldns-team@nlnetlabs.nl or in our Bugzilla at
96 http://www.nlnetlabs.nl/bugs/index.html
97
98 Be sure to select ldns as the product.
99
100
102 Copyright (c) 2004, 2005 NLnet Labs. Licensed under the BSD License.
103 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
104 PARTICULAR PURPOSE.
105
107 perldoc Net::DNS, RFC1043, RFC1035, RFC4033, RFC4034 and RFC4035.
108
110 This manpage was automaticly generated from the ldns source code by use
111 of Doxygen and some perl.
112
113
114
115 ldns(25 Apr 2005)