Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Author: Jeff Thompson |
| 3 | * |
| 4 | * BSD license, See the LICENSE file for more information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_NAME_H |
| 8 | #define NDN_NAME_H |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
Jeff Thompson | b0fd64f | 2013-06-27 16:02:36 -0700 | [diff] [blame] | 14 | struct ndn_NameComponent { |
Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 15 | unsigned char *value; |
Jeff Thompson | b0fd64f | 2013-06-27 16:02:36 -0700 | [diff] [blame] | 16 | unsigned int valueLength; |
Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 17 | }; |
| 18 | |
Jeff Thompson | b0fd64f | 2013-06-27 16:02:36 -0700 | [diff] [blame] | 19 | static inline void ndn_NameComponent_init(struct ndn_NameComponent *self, unsigned char *value, unsigned int valueLength) |
| 20 | { |
| 21 | self->value = value; |
| 22 | self->valueLength = valueLength; |
| 23 | } |
| 24 | |
Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 25 | enum { |
| 26 | ndn_Name_MAX_COMPONENTS = 100 |
| 27 | }; |
| 28 | |
| 29 | struct ndn_Name { |
Jeff Thompson | b0fd64f | 2013-06-27 16:02:36 -0700 | [diff] [blame] | 30 | struct ndn_NameComponent components[ndn_Name_MAX_COMPONENTS]; |
Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 31 | unsigned int nComponents; |
| 32 | }; |
| 33 | |
Jeff Thompson | b0fd64f | 2013-06-27 16:02:36 -0700 | [diff] [blame] | 34 | static inline void ndn_Name_init(struct ndn_Name *self) |
| 35 | { |
| 36 | self->nComponents = 0; |
| 37 | } |
Jeff Thompson | 5d89cb9 | 2013-06-27 15:57:15 -0700 | [diff] [blame] | 38 | |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #endif /* NAME_H */ |
| 44 | |