blob: e606deeafb3d0a756c517900468abb93c65287ee [file] [log] [blame]
Jeff Thompsonc8963652013-06-28 20:17:43 -07001/*
2 * Author: Jeff Thompson
3 *
4 * BSD license, See the LICENSE file for more information.
5 */
6
7#ifndef NDN_BINARYXMLENCODER_H
8#define NDN_BINARYXMLENCODER_H
9
10#include "../util/DynamicUCharArray.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16struct ndn_BinaryXMLEncoder {
17 struct ndn_DynamicUCharArray output; /**< receives the encoded output */
18 unsigned int offset; /**< the offset into output.array for the next encoding */
19};
20
21/**
22 * Initialize an ndn_BinaryXMLEncoder_init struct with the arguments for initializing the ndn_DynamicUCharArray.
23 * @param self pointer to the ndn_BinaryXMLEncoder struct
24 * @param outputArray the allocated array buffer to receive the encoding
25 * @param outputArrayLength the length of outputArray
26 * @param reallocFunction the realloc function used by ndn_DynamicUCharArray_ensureLength. If outputArrayLength
27 * is large enough to receive the entire encoding, this can be 0.
28 */
29static inline void ndn_BinaryXMLEncoder_init
30 (struct ndn_BinaryXMLEncoder *self, unsigned char *outputArray, unsigned int outputArrayLength,
31 unsigned char (*reallocFunction)(unsigned char *, unsigned int))
32{
33 ndn_DynamicUCharArray_init(&self->output, outputArray, outputArrayLength, reallocFunction);
34 self->offset = 0;
35}
36
Jeff Thompson433e6da2013-07-01 15:09:00 -070037char *ndn_BinaryXMLEncoder_encodeTypeAndValue(struct ndn_BinaryXMLEncoder *self, unsigned int type, unsigned int value);
38
Jeff Thompsonc8963652013-06-28 20:17:43 -070039#ifdef __cplusplus
40}
41#endif
42
43#endif
44