Name: In C ndn_Name, added appendComponent, appendBlob and appendString.
diff --git a/src/c/name.c b/src/c/name.c
index 355636d..147d583 100644
--- a/src/c/name.c
+++ b/src/c/name.c
@@ -4,6 +4,7 @@
* See COPYING for copyright and distribution information.
*/
+#include <string.h>
#include "util/ndn_memory.h"
#include "name.h"
@@ -54,3 +55,18 @@
return 1;
}
+
+ndn_Error ndn_Name_appendComponent(struct ndn_Name *self, uint8_t* value, size_t valueLength)
+{
+ if (self->nComponents >= self->maxComponents)
+ return NDN_ERROR_attempt_to_add_a_component_past_the_maximum_number_of_components_allowed_in_the_name;
+ ndn_NameComponent_initialize(self->components + self->nComponents, value, valueLength);
+ ++self->nComponents;
+
+ return NDN_ERROR_success;
+}
+
+ndn_Error ndn_Name_appendString(struct ndn_Name *self, char* value)
+{
+ return ndn_Name_appendComponent(self, (uint8_t*)value, strlen(value));
+}