ForwardingFlags: Added ForwardingFlags class and use it in registerPrefix and ForwardingEntry instead of int flags.
diff --git a/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c b/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
index e8987db..8788cec 100644
--- a/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
+++ b/ndn-cpp/c/encoding/binary-xml-forwarding-entry.c
@@ -25,8 +25,9 @@
   if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
       (encoder, ndn_BinaryXml_DTag_FaceID, forwardingEntry->faceId)))
     return error;
-  if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
-      (encoder, ndn_BinaryXml_DTag_ForwardingFlags, forwardingEntry->forwardingFlags)))
+  if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
+      (encoder, ndn_BinaryXml_DTag_ForwardingFlags, 
+       ndn_ForwardingFlags_getForwardingEntryFlags(&forwardingEntry->forwardingFlags))))
     return error;
   if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
       (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, forwardingEntry->freshnessSeconds)))
@@ -54,9 +55,17 @@
   if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
       (decoder, ndn_BinaryXml_DTag_FaceID, &forwardingEntry->faceId)))
     return error;
+  
+  int forwardingEntryFlags;
   if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
-      (decoder, ndn_BinaryXml_DTag_ForwardingFlags, &forwardingEntry->forwardingFlags)))
+      (decoder, ndn_BinaryXml_DTag_ForwardingFlags, &forwardingEntryFlags)))
     return error;
+  if (forwardingEntryFlags >= 0)
+    ndn_ForwardingFlags_setForwardingEntryFlags(&forwardingEntry->forwardingFlags, forwardingEntryFlags);
+  else
+    // This sets the default flags.
+    ndn_ForwardingFlags_initialize(&forwardingEntry->forwardingFlags);
+  
   if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
       (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &forwardingEntry->freshnessSeconds)))
     return error;
diff --git a/ndn-cpp/c/forwarding-entry.h b/ndn-cpp/c/forwarding-entry.h
index a57429d..8fbfaa2 100644
--- a/ndn-cpp/c/forwarding-entry.h
+++ b/ndn-cpp/c/forwarding-entry.h
@@ -10,11 +10,23 @@
 #include "common.h"
 #include "name.h"
 #include "publisher-public-key-digest.h"
+#include "forwarding-flags.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef enum {
+  ndn_ForwardingEntryFlags_ACTIVE         = 1,
+  ndn_ForwardingEntryFlags_CHILD_INHERIT  = 2,
+  ndn_ForwardingEntryFlags_ADVERTISE      = 4,
+  ndn_ForwardingEntryFlags_LAST           = 8,
+  ndn_ForwardingEntryFlags_CAPTURE       = 16,
+  ndn_ForwardingEntryFlags_LOCAL         = 32,
+  ndn_ForwardingEntryFlags_TAP           = 64,
+  ndn_ForwardingEntryFlags_CAPTURE_OK   = 128
+} ndn_ForwardingEntryFlags;
+
 /**
  * An ndn_ForwardingEntry holds fields for a ForwardingEntry which is used to register a prefix with a hub.
  */
@@ -24,7 +36,7 @@
   struct ndn_Name prefix;
   struct ndn_PublisherPublicKeyDigest publisherPublicKeyDigest;
   int faceId;               /**< -1 for none. */
-  int forwardingFlags;      /**< -1 for none. */
+  struct ndn_ForwardingFlags forwardingFlags;
   int freshnessSeconds;     /**< -1 for none. */
 };
 
@@ -43,7 +55,7 @@
   ndn_Name_initialize(&self->prefix, prefixNameComponents, maxPrefixNameComponents);
   ndn_PublisherPublicKeyDigest_initialize(&self->publisherPublicKeyDigest);
   self->faceId = -1;
-  self->forwardingFlags = -1;
+  ndn_ForwardingFlags_initialize(&self->forwardingFlags);
   self->freshnessSeconds = -1;
 }
 
diff --git a/ndn-cpp/c/forwarding-flags.c b/ndn-cpp/c/forwarding-flags.c
new file mode 100644
index 0000000..e7477ed
--- /dev/null
+++ b/ndn-cpp/c/forwarding-flags.c
@@ -0,0 +1,56 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "forwarding-entry.h"
+#include "forwarding-flags.h"
+
+void ndn_ForwardingFlags_initialize(struct ndn_ForwardingFlags *self)
+{
+  self->active = 1;
+  self->childInherit = 1;
+  self->advertise = 0;
+  self->last = 0;
+  self->capture = 0;
+  self->local = 0;
+  self->tap = 0;
+  self->captureOk = 0;
+}
+
+int ndn_ForwardingFlags_getForwardingEntryFlags(struct ndn_ForwardingFlags *self)
+{
+  int result = 0;
+  
+  if (self->active)
+    result |= ndn_ForwardingEntryFlags_ACTIVE;
+  else if (self->childInherit)
+    result |= ndn_ForwardingEntryFlags_CHILD_INHERIT;
+  else if (self->advertise)
+    result |= ndn_ForwardingEntryFlags_ADVERTISE;
+  else if (self->last)
+    result |= ndn_ForwardingEntryFlags_LAST;
+  else if (self->capture)
+    result |= ndn_ForwardingEntryFlags_CAPTURE;
+  else if (self->local)
+    result |= ndn_ForwardingEntryFlags_LOCAL;
+  else if (self->tap)
+    result |= ndn_ForwardingEntryFlags_TAP;
+  else if (self->captureOk)
+    result |= ndn_ForwardingEntryFlags_CAPTURE_OK;
+  
+  return result;
+}
+
+void ndn_ForwardingFlags_setForwardingEntryFlags(struct ndn_ForwardingFlags *self, int forwardingEntryFlags)
+{
+  self->active = (forwardingEntryFlags & ndn_ForwardingEntryFlags_ACTIVE) ? 1 : 0;
+  self->childInherit = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CHILD_INHERIT) ? 1 : 0;
+  self->advertise = (forwardingEntryFlags & ndn_ForwardingEntryFlags_ADVERTISE) ? 1 : 0;
+  self->last = (forwardingEntryFlags & ndn_ForwardingEntryFlags_LAST) ? 1 : 0;
+  self->capture = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CAPTURE) ? 1 : 0;
+  self->local = (forwardingEntryFlags & ndn_ForwardingEntryFlags_LOCAL) ? 1 : 0;
+  self->tap = (forwardingEntryFlags & ndn_ForwardingEntryFlags_TAP) ? 1 : 0;
+  self->captureOk = (forwardingEntryFlags & ndn_ForwardingEntryFlags_CAPTURE_OK) ? 1 : 0;
+}
diff --git a/ndn-cpp/c/forwarding-flags.h b/ndn-cpp/c/forwarding-flags.h
new file mode 100644
index 0000000..ba6f6b5
--- /dev/null
+++ b/ndn-cpp/c/forwarding-flags.h
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_FORWARDING_FLAGS_H
+#define	NDN_FORWARDING_FLAGS_H
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/**
+ * An ndn_ForwardingFlags object holds the flags which specify how the forwarding daemon should forward an interest for
+ * a registered prefix.  We use a separate ForwardingFlags object to retain future compatibility if the daemon forwarding
+ * bits are changed, amended or deprecated.
+ */
+struct ndn_ForwardingFlags {
+  int active; /**< 1 if the flag is set, 0 if cleared. */
+  int childInherit;
+  int advertise;
+  int last;
+  int capture;
+  int local;
+  int tap;
+  int captureOk;  
+};
+
+/**
+ * Initialize an ndn_ForwardingFlags struct with the default with "active" and "childInherit" set and all other flags cleared.
+ * @param self A pointer to the ndn_ForwardingFlags struct.
+ */
+void ndn_ForwardingFlags_initialize(struct ndn_ForwardingFlags *self);
+
+/**
+ * Get an integer with the bits set according to the flags as used by the ForwardingEntry message.
+ * @param self A pointer to the ndn_ForwardingFlags struct.
+ * @return An integer with the bits set.
+ */
+int ndn_ForwardingFlags_getForwardingEntryFlags(struct ndn_ForwardingFlags *self);
+
+/**
+ * Set the flags according to the bits in forwardingEntryFlags as used by the ForwardingEntry message.
+ * @param self A pointer to the ndn_ForwardingFlags struct.
+ * @param flags An integer with the bits set.
+ */
+void ndn_ForwardingFlags_setForwardingEntryFlags(struct ndn_ForwardingFlags *self, int forwardingEntryFlags);
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif