blob: 07ce7d7ba004d6203395a3bbee1847faf0e9916a [file] [log] [blame]
Jeff Thompson8dc775b2013-08-29 17:16:42 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_BLOB_H
7#define NDN_BLOB_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/**
14 * An ndn_Blob holds a pointer to a read-only pre-allocated buffer and its length.
15 */
16struct ndn_Blob {
17 unsigned char *value; /**< pointer to the pre-allocated buffer for the value. Must be treated as read only. */
18 unsigned int valueLength; /**< the number of bytes in value. */
19};
20
21/**
22 * Initialize the ndn_Blob struct with the given value.
23 * @param self pointer to the ndn_Blob struct.
24 * @param value The pre-allocated buffer for the value, or 0 for none.
25 * @param valueLength The number of bytes in value.
26 */
27static inline void ndn_Blob_initialize(struct ndn_Blob *self, unsigned char *value, unsigned int valueLength)
28{
29 self->value = value;
30 self->valueLength = valueLength;
31}
32
33#ifdef __cplusplus
34}
35#endif
36
37#endif