ccn_name_util.c File Reference

Support for manipulating ccnb-encoded Names. More...

Go to the source code of this file.

Functions

int ccn_name_init (struct ccn_charbuf *c)
 Reset charbuf to represent an empty Name in binary format.
int ccn_name_append (struct ccn_charbuf *c, const void *component, size_t n)
 Add a Component to a Name.
int ccn_name_append_str (struct ccn_charbuf *c, const char *s)
 Add a Component that is a NUL-terminated string.
int ccn_name_append_numeric (struct ccn_charbuf *c, enum ccn_marker marker, uintmax_t value)
 Add a binary Component to a ccnb-encoded Name.
int ccn_name_append_nonce (struct ccn_charbuf *c)
 Add nonce Component to ccnb-encoded Name.
int ccn_name_append_components (struct ccn_charbuf *c, const unsigned char *ccnb, size_t start, size_t stop)
 Add sequence of ccnb-encoded Components to a ccnb-encoded Name.
int ccn_name_comp_get (const unsigned char *data, const struct ccn_indexbuf *indexbuf, unsigned int i, const unsigned char **comp, size_t *size)
 Extract a pointer to and size of component at given index i.
int ccn_name_comp_strcmp (const unsigned char *data, const struct ccn_indexbuf *indexbuf, unsigned int i, const char *val)
int ccn_name_split (const struct ccn_charbuf *c, struct ccn_indexbuf *components)
 Find Component boundaries in a ccnb-encoded Name.
int ccn_name_chop (struct ccn_charbuf *c, struct ccn_indexbuf *components, int n)
 Chop the name down to n components.
int ccn_name_next_sibling (struct ccn_charbuf *c)
 Advance the last Component of a Name to the next possible value.


Detailed Description

Support for manipulating ccnb-encoded Names.

Part of the CCNx C Library.

Copyright (C) 2008-2010 Palo Alto Research Center, Inc.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Definition in file ccn_name_util.c.


Function Documentation

int ccn_name_append ( struct ccn_charbuf c,
const void *  component,
size_t  n 
)

int ccn_name_append_components ( struct ccn_charbuf c,
const unsigned char *  ccnb,
size_t  start,
size_t  stop 
)

int ccn_name_append_nonce ( struct ccn_charbuf c  ) 

Add nonce Component to ccnb-encoded Name.

Uses C1.N namespace.

Returns:
0, or -1 for error see doc/technical/NameConventions.html

Definition at line 114 of file ccn_name_util.c.

Referenced by localStore(), main(), and putFile().

int ccn_name_append_numeric ( struct ccn_charbuf c,
enum ccn_marker  marker,
uintmax_t  value 
)

Add a binary Component to a ccnb-encoded Name.

These are special components used for marking versions, fragments, etc.

Returns:
0, or -1 for error see doc/technical/NameConventions.html

Definition at line 90 of file ccn_name_util.c.

Referenced by incoming_content(), load_policy(), localStore(), main(), r_proto_continue_enumeration(), r_proto_expect_content(), r_proto_policy_update(), r_proto_start_write(), sequenced_name(), seqw_next_cob(), storeHandler(), storeStablePoint(), SyncCacheEntryStore(), and SyncInterestArrived().

int ccn_name_append_str ( struct ccn_charbuf c,
const char *  s 
)

Add a Component that is a NUL-terminated string.

The component added consists of the bytes of the string without the NUL. This function is convenient for those applications that construct component names from simple strings.

Returns:
0, or -1 for error.

Definition at line 77 of file ccn_name_util.c.

Referenced by ccn_get_header(), ccn_initiate_prefix_reg(), ccnd_start_notice(), constructCommandPrefix(), create_face(), encode_message(), existingRootOp(), fetchStablePoint(), main(), register_unregister_prefix(), sendSlice(), storeStablePoint(), and SyncNameForLocalNode().

int ccn_name_chop ( struct ccn_charbuf c,
struct ccn_indexbuf components,
int  n 
)

Chop the name down to n components.

Parameters:
c contains a ccnb-encoded Name
components may be NULL; if provided it must be consistent with some prefix of the name, and is updated accordingly.
n is the number or components to leave, or, if negative, specifies how many components to remove, e.g. -1 will remove just the last component.
Returns:
-1 for error, otherwise the new number of Components

Definition at line 226 of file ccn_name_util.c.

Referenced by ccn_name_chop(), ccn_name_next_sibling(), load_policy(), main(), and r_proto_policy_update().

int ccn_name_comp_get ( const unsigned char *  data,
const struct ccn_indexbuf indexbuf,
unsigned int  i,
const unsigned char **  comp,
size_t *  size 
)

int ccn_name_comp_strcmp ( const unsigned char *  data,
const struct ccn_indexbuf indexbuf,
unsigned int  i,
const char *  val 
)

Definition at line 182 of file ccn_name_util.c.

Referenced by decode_message().

int ccn_name_init ( struct ccn_charbuf c  ) 

int ccn_name_next_sibling ( struct ccn_charbuf c  ) 

Advance the last Component of a Name to the next possible value.

Parameters:
c contains a ccnb-encoded Name to be updated.
Returns:
-1 for error, otherwise the number of Components

Definition at line 262 of file ccn_name_util.c.

Referenced by main(), next_child_at_level(), and r_store_next_child_at_level().

int ccn_name_split ( const struct ccn_charbuf c,
struct ccn_indexbuf components 
)

Find Component boundaries in a ccnb-encoded Name.

Thin veneer over ccn_parse_Name(). components arg may be NULL to just do a validity check

Returns:
-1 for error, otherwise the number of Components.

Definition at line 207 of file ccn_name_util.c.

Referenced by ccn_create_version(), ccn_name_chop(), ccn_name_next_sibling(), ccn_resolve_version(), ccn_sign_content(), ccnd_req_prefix_or_self_reg(), ccnd_req_unreg(), ccnd_uri_listen(), ccnr_uri_listen(), load_policy(), r_match_match_interests(), r_proto_check_exclude(), and SyncNotifyContent().


Generated on Thu Feb 16 00:44:23 2012 for Content-Centric Networking in C by  doxygen 1.5.6