delegation-set.h
1 
21 #ifndef NDN_DELEGATION_SET_H
22 #define NDN_DELEGATION_SET_H
23 
24 #include <ndn-cpp/c/delegation-set-types.h>
25 #include "name.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
39 static __inline void ndn_DelegationSet_Delegation_initialize
40  (struct ndn_DelegationSet_Delegation *self,
41  struct ndn_NameComponent *nameComponents, size_t maxNameComponents)
42 {
43  self->preference = 0;
44  ndn_Name_initialize(&self->name, nameComponents, maxNameComponents);
45 }
46 
56 static __inline ndn_Error
57 ndn_DelegationSet_Delegation_setFromDelegationSet_Delegation
58  (struct ndn_DelegationSet_Delegation *self,
59  const struct ndn_DelegationSet_Delegation *other)
60 {
61  ndn_Error error;
62 
63  if (other == self)
64  // Setting to itself. Do nothing.
65  return NDN_ERROR_success;
66 
67  self->preference = other->preference;
68  if ((error = ndn_Name_setFromName(&self->name, &other->name)))
69  return error;
70 
71  return NDN_ERROR_success;
72 }
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
Copyright (C) 2015-2016 Regents of the University of California.
Definition: name-types.h:33
Copyright (C) 2016 Regents of the University of California.
Definition: delegation-set-types.h:33