blob: 464fc74aeeb6964df61d15c2894c068644c354a5 [file] [log] [blame]
Lev Walkind9221842017-08-22 01:44:56 -07001#ifndef ASN1_BUFFER_H
2#define ASN1_BUFFER_H
3
4/*
5 * Your typical dynamic character string buffer.
6 */
7typedef struct {
8 const char *buffer;
9 size_t length;
10 size_t size;
11} abuf;
12
13/*
14 * Create and destroy the buffer.
15 */
16abuf *abuf_new(void);
17void abuf_free(abuf *);
18
19/*
20 * Erase contents of the buffer (without destroying it).
21 */
22void abuf_clear(abuf *);
23
24/*
25 * Add characters to the buffer.
26 */
27void abuf_str(abuf *, const char *str);
28void abuf_buf(abuf *, const abuf *);
29void abuf_printf(abuf *, const char *fmt, ...)
30 __attribute__((format(printf, 2, 3)));
31
32#endif /* ASN1_BUFFER_H */