24 #include <ndn-cpp/c/name-types.h>
25 #include <ndn-cpp/c/errors.h>
26 #include "util/blob.h"
38 static __inline
void ndn_NameComponent_initialize(
struct ndn_NameComponent *
self,
const uint8_t *value,
size_t valueLength)
40 ndn_Blob_initialize(&self->value, value, valueLength);
57 ndn_Error ndn_NameComponent_toNumberWithMarker
69 static __inline ndn_Error
70 ndn_NameComponent_toSegment
73 return ndn_NameComponent_toNumberWithMarker(
self, 0x00, result);
85 static __inline ndn_Error
86 ndn_NameComponent_toSegmentOffset
89 return ndn_NameComponent_toNumberWithMarker(
self, 0xFB, result);
103 static __inline ndn_Error
104 ndn_NameComponent_toVersion
107 return ndn_NameComponent_toNumberWithMarker(
self, 0xFD, result);
120 static __inline ndn_Error
121 ndn_NameComponent_toTimestamp
124 return ndn_NameComponent_toNumberWithMarker(
self, 0xFC, result);
136 static __inline ndn_Error
137 ndn_NameComponent_toSequenceNumber
140 return ndn_NameComponent_toNumberWithMarker(
self, 0xFE, result);
151 ndn_Error ndn_NameComponent_toNumberWithPrefix
153 size_t prefixLength, uint64_t *result);
163 ndn_NameComponent_hasPrefix
165 size_t prefixLength);
175 int ndn_NameComponent_compare
184 ndn_NameComponent_setFromNameComponent
203 ndn_NameComponent_setFromNumber
205 size_t bufferLength);
221 ndn_NameComponent_setFromNumberWithMarker
223 uint8_t *buffer,
size_t bufferLength);
238 static __inline ndn_Error
239 ndn_NameComponent_setSegment
243 return ndn_NameComponent_setFromNumberWithMarker
244 (
self, segment, 0x00, buffer, bufferLength);
260 static __inline ndn_Error
261 ndn_NameComponent_setSegmentOffset
265 return ndn_NameComponent_setFromNumberWithMarker
266 (
self, segmentOffset, 0xFB, buffer, bufferLength);
283 static __inline ndn_Error
284 ndn_NameComponent_setVersion
288 return ndn_NameComponent_setFromNumberWithMarker
289 (
self, version, 0xFD, buffer, bufferLength);
306 static __inline ndn_Error
307 ndn_NameComponent_setTimestamp
311 return ndn_NameComponent_setFromNumberWithMarker
312 (
self, timestamp, 0xFC, buffer, bufferLength);
328 static __inline ndn_Error
329 ndn_NameComponent_setSequenceNumber
333 return ndn_NameComponent_setFromNumberWithMarker
334 (
self, sequenceNumber, 0xFE, buffer, bufferLength);
343 static __inline
void ndn_Name_initialize(
struct ndn_Name *
self,
struct ndn_NameComponent *components,
size_t maxComponents)
345 self->components = components;
346 self->maxComponents = maxComponents;
347 self->nComponents = 0;
355 ndn_Name_clear(
struct ndn_Name *
self) {
self->nComponents = 0; }
365 int ndn_Name_equals(
const struct ndn_Name *
self,
const struct ndn_Name *name);
373 int ndn_Name_match(
const struct ndn_Name *
self,
const struct ndn_Name *name);
382 ndn_Error ndn_Name_appendComponent(
struct ndn_Name *
self,
const uint8_t* value,
size_t valueLength);
390 static __inline ndn_Error ndn_Name_appendBlob(
struct ndn_Name *
self,
struct ndn_Blob *value)
392 return ndn_Name_appendComponent(
self, value->
value, value->
length);
401 ndn_Error ndn_Name_appendString(
struct ndn_Name *
self,
const char * value);
size_t length
the number of bytes in value.
Definition: blob-types.h:35
Copyright (C) 2015 Regents of the University of California.
Definition: name-types.h:33
An ndn_Name holds an array of ndn_NameComponent.
Definition: name-types.h:40
const uint8_t * value
pointer to the pre-allocated buffer for the value.
Definition: blob-types.h:34
Copyright (C) 2015 Regents of the University of California.
Definition: blob-types.h:33