Warning, file /include/nettle/buffer.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef NETTLE_BUFFER_H_INCLUDED
0035 #define NETTLE_BUFFER_H_INCLUDED
0036
0037 #include "realloc.h"
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043 struct nettle_buffer
0044 {
0045 uint8_t *contents;
0046
0047 size_t alloc;
0048
0049 void *realloc_ctx;
0050 nettle_realloc_func *realloc;
0051
0052
0053 size_t size;
0054 };
0055
0056
0057 void
0058 nettle_buffer_init(struct nettle_buffer *buffer);
0059
0060 void
0061 nettle_buffer_init_realloc(struct nettle_buffer *buffer,
0062 void *realloc_ctx,
0063 nettle_realloc_func *realloc);
0064
0065
0066 void
0067 nettle_buffer_init_size(struct nettle_buffer *buffer,
0068 size_t length, uint8_t *space);
0069
0070 void
0071 nettle_buffer_clear(struct nettle_buffer *buffer);
0072
0073
0074 void
0075 nettle_buffer_reset(struct nettle_buffer *buffer);
0076
0077 int
0078 nettle_buffer_grow(struct nettle_buffer *buffer,
0079 size_t length);
0080
0081 #define NETTLE_BUFFER_PUTC(buffer, c) \
0082 ( (((buffer)->size < (buffer)->alloc) || nettle_buffer_grow((buffer), 1)) \
0083 && ((buffer)->contents[(buffer)->size++] = (c), 1) )
0084
0085 int
0086 nettle_buffer_write(struct nettle_buffer *buffer,
0087 size_t length, const uint8_t *data);
0088
0089
0090
0091
0092
0093 uint8_t *
0094 nettle_buffer_space(struct nettle_buffer *buffer,
0095 size_t length);
0096
0097
0098 int
0099 nettle_buffer_copy(struct nettle_buffer *dst,
0100 const struct nettle_buffer *src);
0101
0102 #ifdef __cplusplus
0103 }
0104 #endif
0105
0106 #endif