ccn_buf_decoder.c File Reference

Support for Interest and ContentObject decoding. More...

Go to the source code of this file.

Functions

struct ccn_buf_decoderccn_buf_decoder_start (struct ccn_buf_decoder *d, const unsigned char *buf, size_t size)
void ccn_buf_advance (struct ccn_buf_decoder *d)
int ccn_buf_match_dtag (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_buf_match_some_dtag (struct ccn_buf_decoder *d)
int ccn_buf_match_some_blob (struct ccn_buf_decoder *d)
int ccn_buf_match_blob (struct ccn_buf_decoder *d, const unsigned char **bufp, size_t *sizep)
int ccn_buf_match_udata (struct ccn_buf_decoder *d, const char *s)
int ccn_buf_match_attr (struct ccn_buf_decoder *d, const char *s)
void ccn_buf_check_close (struct ccn_buf_decoder *d)
 Enter an error state if element closer not found.
int ccn_buf_advance_past_element (struct ccn_buf_decoder *d)
int ccn_parse_required_tagged_BLOB (struct ccn_buf_decoder *d, enum ccn_dtag dtag, int minlen, int maxlen)
int ccn_parse_optional_tagged_BLOB (struct ccn_buf_decoder *d, enum ccn_dtag dtag, int minlen, int maxlen)
uintmax_t ccn_parse_required_tagged_binary_number (struct ccn_buf_decoder *d, enum ccn_dtag dtag, int minlen, int maxlen)
uintmax_t ccn_parse_optional_tagged_binary_number (struct ccn_buf_decoder *d, enum ccn_dtag dtag, int minlen, int maxlen, uintmax_t default_value)
int ccn_parse_required_tagged_UDATA (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_parse_optional_tagged_UDATA (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_parse_tagged_string (struct ccn_buf_decoder *d, enum ccn_dtag dtag, struct ccn_charbuf *store)
 Parses a ccnb-encoded element expected to contain a UDATA string.
int ccn_parse_Name (struct ccn_buf_decoder *d, struct ccn_indexbuf *components)
 Parses a ccnb-encoded name.
int ccn_parse_PublisherID (struct ccn_buf_decoder *d, struct ccn_parsed_interest *pi)
static int ccn_parse_optional_Any_or_Bloom (struct ccn_buf_decoder *d)
int ccn_parse_Exclude (struct ccn_buf_decoder *d)
int ccn_parse_nonNegativeInteger (struct ccn_buf_decoder *d)
int ccn_parse_uintmax (struct ccn_buf_decoder *d, uintmax_t *result)
 Parse a potentially large non-negative integer.
int ccn_parse_timestamp (struct ccn_buf_decoder *d)
int ccn_parse_required_tagged_timestamp (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_parse_optional_tagged_nonNegativeInteger (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_fetch_tagged_nonNegativeInteger (enum ccn_dtag tt, const unsigned char *buf, size_t start, size_t stop)
int ccn_parse_interest (const unsigned char *msg, size_t size, struct ccn_parsed_interest *interest, struct ccn_indexbuf *components)
static int ccn_parse_KeyName (struct ccn_buf_decoder *d, struct parsed_KeyName *x)
static int ccn_parse_Signature (struct ccn_buf_decoder *d, struct ccn_parsed_ContentObject *x)
static int ccn_parse_SignedInfo (struct ccn_buf_decoder *d, struct ccn_parsed_ContentObject *x)
int ccn_parse_ContentObject (const unsigned char *msg, size_t size, struct ccn_parsed_ContentObject *x, struct ccn_indexbuf *components)
int ccn_ref_tagged_BLOB (enum ccn_dtag tt, const unsigned char *buf, size_t start, size_t stop, const unsigned char **presult, size_t *psize)
static struct ccn_buf_decoderccn_buf_decoder_start_at_components (struct ccn_buf_decoder *d, const unsigned char *buf, size_t buflen)
int ccn_content_get_value (const unsigned char *data, size_t data_size, const struct ccn_parsed_ContentObject *content, const unsigned char **value, size_t *value_size)
int ccn_compare_names (const unsigned char *a, size_t asize, const unsigned char *b, size_t bsize)
int ccn_parse_LinkAuthenticator (struct ccn_buf_decoder *d, struct ccn_parsed_Link *pl)
int ccn_parse_Link (struct ccn_buf_decoder *d, struct ccn_parsed_Link *link, struct ccn_indexbuf *components)
int ccn_parse_Collection_start (struct ccn_buf_decoder *d)
int ccn_parse_Collection_next (struct ccn_buf_decoder *d, struct ccn_parsed_Link *link, struct ccn_indexbuf *components)


Detailed Description

Support for Interest and ContentObject decoding.

Part of the CCNx C Library.

Copyright (C) 2008, 2009, 2010, 2011 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_buf_decoder.c.


Function Documentation

void ccn_buf_advance ( struct ccn_buf_decoder d  ) 

Definition at line 40 of file ccn_buf_decoder.c.

Referenced by appendExclusions(), ccn_append_link_name(), ccn_btree_match_interest(), ccn_buf_advance_past_element(), ccn_buf_check_close(), ccn_buf_decoder_start_at_components(), ccn_check_namebuf(), ccn_chk_signing_params(), ccn_compare_names(), ccn_content_matches_interest(), ccn_face_instance_parse(), ccn_fetch_tagged_nonNegativeInteger(), ccn_flatname_append_from_ccnb(), ccn_forwarding_entry_parse(), ccn_header_parse(), ccn_name_comp_get(), ccn_name_last_component_offset(), ccn_parse_Collection_start(), ccn_parse_ContentObject(), ccn_parse_Exclude(), ccn_parse_interest(), ccn_parse_KeyName(), ccn_parse_Link(), ccn_parse_LinkAuthenticator(), ccn_parse_Name(), ccn_parse_nonNegativeInteger(), ccn_parse_optional_Any_or_Bloom(), ccn_parse_optional_tagged_nonNegativeInteger(), ccn_parse_PublisherID(), ccn_parse_required_tagged_binary_number(), ccn_parse_required_tagged_BLOB(), ccn_parse_required_tagged_timestamp(), ccn_parse_required_tagged_UDATA(), ccn_parse_Signature(), ccn_parse_SignedInfo(), ccn_parse_tagged_required_uintmax(), ccn_parse_tagged_string(), ccn_parse_timestamp(), ccn_parse_uintmax(), ccn_pubid_matches(), ccn_ref_tagged_BLOB(), ccn_uri_append(), fetchStablePoint(), find_first_match_candidate(), make_template(), r_proto_check_exclude(), r_proto_initiate_key_fetch(), r_proto_parse_policy(), r_store_find_first_match_candidate(), reportExclude(), SyncAppendAllComponents(), SyncAppendElementInner(), SyncCmpNamesInner(), SyncComponentCount(), SyncComponentMatch(), SyncGetComponentPtr(), SyncGetHashPtr(), SyncParseComposite(), SyncParseName(), SyncParseUnsigned(), SyncPatternMatch(), SyncPrefixMatch(), and SyncRootDecodeAndAdd().

int ccn_buf_advance_past_element ( struct ccn_buf_decoder d  ) 

void ccn_buf_check_close ( struct ccn_buf_decoder d  ) 

Enter an error state if element closer not found.

Definition at line 108 of file ccn_buf_decoder.c.

Referenced by ccn_append_link_name(), ccn_btree_match_interest(), ccn_buf_advance_past_element(), ccn_check_namebuf(), ccn_chk_signing_params(), ccn_compare_names(), ccn_content_matches_interest(), ccn_face_instance_parse(), ccn_fetch_tagged_nonNegativeInteger(), ccn_flatname_append_from_ccnb(), ccn_forwarding_entry_parse(), ccn_header_parse(), ccn_name_comp_get(), ccn_name_last_component_offset(), ccn_parse_Collection_next(), ccn_parse_ContentObject(), ccn_parse_Exclude(), ccn_parse_interest(), ccn_parse_KeyName(), ccn_parse_Link(), ccn_parse_LinkAuthenticator(), ccn_parse_Name(), ccn_parse_optional_Any_or_Bloom(), ccn_parse_optional_tagged_nonNegativeInteger(), ccn_parse_PublisherID(), ccn_parse_required_tagged_binary_number(), ccn_parse_required_tagged_BLOB(), ccn_parse_required_tagged_timestamp(), ccn_parse_required_tagged_UDATA(), ccn_parse_Signature(), ccn_parse_SignedInfo(), ccn_parse_tagged_required_uintmax(), ccn_parse_tagged_string(), ccn_ref_tagged_BLOB(), ccn_uri_append(), find_first_match_candidate(), make_template(), r_proto_check_exclude(), r_proto_initiate_key_fetch(), r_proto_parse_policy(), r_store_find_first_match_candidate(), reportExclude(), SyncAppendAllComponents(), SyncAppendElementInner(), SyncCmpNamesInner(), SyncComponentCount(), SyncComponentMatch(), SyncGetComponentPtr(), SyncGetHashPtr(), SyncParseComposite(), SyncParseName(), SyncParseUnsigned(), SyncPatternMatch(), SyncPrefixMatch(), and SyncRootDecodeAndAdd().

struct ccn_buf_decoder* ccn_buf_decoder_start ( struct ccn_buf_decoder d,
const unsigned char *  buf,
size_t  size 
) [read]

static struct ccn_buf_decoder* ccn_buf_decoder_start_at_components ( struct ccn_buf_decoder d,
const unsigned char *  buf,
size_t  buflen 
) [static, read]

Definition at line 861 of file ccn_buf_decoder.c.

Referenced by ccn_compare_names().

int ccn_buf_match_attr ( struct ccn_buf_decoder d,
const char *  s 
)

Definition at line 98 of file ccn_buf_decoder.c.

int ccn_buf_match_blob ( struct ccn_buf_decoder d,
const unsigned char **  bufp,
size_t *  sizep 
)

int ccn_buf_match_dtag ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag 
)

Definition at line 48 of file ccn_buf_decoder.c.

Referenced by appendExclusions(), ccn_append_link_name(), ccn_btree_match_interest(), ccn_buf_decoder_start_at_components(), ccn_check_namebuf(), ccn_chk_signing_params(), ccn_compare_names(), ccn_content_matches_interest(), ccn_face_instance_parse(), ccn_fetch_tagged_nonNegativeInteger(), ccn_flatname_append_from_ccnb(), ccn_forwarding_entry_parse(), ccn_header_parse(), ccn_locate_key(), ccn_name_comp_get(), ccn_name_last_component_offset(), ccn_parse_Collection_next(), ccn_parse_Collection_start(), ccn_parse_ContentObject(), ccn_parse_Exclude(), ccn_parse_interest(), ccn_parse_KeyName(), ccn_parse_Link(), ccn_parse_LinkAuthenticator(), ccn_parse_Name(), ccn_parse_optional_Any_or_Bloom(), ccn_parse_optional_tagged_binary_number(), ccn_parse_optional_tagged_BLOB(), ccn_parse_optional_tagged_nonNegativeInteger(), ccn_parse_optional_tagged_UDATA(), ccn_parse_PublisherID(), ccn_parse_required_tagged_binary_number(), ccn_parse_required_tagged_BLOB(), ccn_parse_required_tagged_timestamp(), ccn_parse_required_tagged_UDATA(), ccn_parse_Signature(), ccn_parse_SignedInfo(), ccn_parse_tagged_required_uintmax(), ccn_parse_tagged_string(), ccn_ref_tagged_BLOB(), ccn_uri_append(), fetchStablePoint(), find_first_match_candidate(), main(), make_template(), r_proto_check_exclude(), r_proto_initiate_key_fetch(), r_proto_parse_policy(), r_store_find_first_match_candidate(), reportExclude(), SyncAppendAllComponents(), SyncAppendElementInner(), SyncCmpNamesInner(), SyncComponentCount(), SyncComponentMatch(), SyncExtractName(), SyncGetComponentPtr(), SyncGetHashPtr(), SyncIsName(), SyncParseComposite(), SyncParseName(), SyncParseUnsigned(), SyncPatternMatch(), SyncPrefixMatch(), and SyncRootDecodeAndAdd().

int ccn_buf_match_some_blob ( struct ccn_buf_decoder d  ) 

int ccn_buf_match_some_dtag ( struct ccn_buf_decoder d  ) 

Definition at line 56 of file ccn_buf_decoder.c.

int ccn_buf_match_udata ( struct ccn_buf_decoder d,
const char *  s 
)

Definition at line 88 of file ccn_buf_decoder.c.

int ccn_compare_names ( const unsigned char *  a,
size_t  asize,
const unsigned char *  b,
size_t  bsize 
)

int ccn_content_get_value ( const unsigned char *  data,
size_t  data_size,
const struct ccn_parsed_ContentObject content,
const unsigned char **  value,
size_t *  value_size 
)

int ccn_fetch_tagged_nonNegativeInteger ( enum ccn_dtag  tt,
const unsigned char *  buf,
size_t  start,
size_t  stop 
)

Definition at line 539 of file ccn_buf_decoder.c.

Referenced by r_store_set_content_timer(), and set_content_timer().

int ccn_parse_Collection_next ( struct ccn_buf_decoder d,
struct ccn_parsed_Link link,
struct ccn_indexbuf components 
)

Definition at line 1045 of file ccn_buf_decoder.c.

Referenced by main().

int ccn_parse_Collection_start ( struct ccn_buf_decoder d  ) 

Definition at line 1031 of file ccn_buf_decoder.c.

Referenced by main().

int ccn_parse_ContentObject ( const unsigned char *  msg,
size_t  size,
struct ccn_parsed_ContentObject x,
struct ccn_indexbuf components 
)

int ccn_parse_Exclude ( struct ccn_buf_decoder d  ) 

Definition at line 368 of file ccn_buf_decoder.c.

Referenced by ccn_parse_interest().

int ccn_parse_interest ( const unsigned char *  msg,
size_t  size,
struct ccn_parsed_interest interest,
struct ccn_indexbuf components 
)

static int ccn_parse_KeyName ( struct ccn_buf_decoder d,
struct parsed_KeyName *  x 
) [static]

Definition at line 682 of file ccn_buf_decoder.c.

Referenced by ccn_parse_SignedInfo().

int ccn_parse_Link ( struct ccn_buf_decoder d,
struct ccn_parsed_Link link,
struct ccn_indexbuf components 
)

Definition at line 988 of file ccn_buf_decoder.c.

Referenced by ccn_parse_Collection_next(), ccn_parse_Link(), load_policy(), and main().

int ccn_parse_LinkAuthenticator ( struct ccn_buf_decoder d,
struct ccn_parsed_Link pl 
)

Definition at line 929 of file ccn_buf_decoder.c.

Referenced by ccn_parse_Link().

int ccn_parse_Name ( struct ccn_buf_decoder d,
struct ccn_indexbuf components 
)

Parses a ccnb-encoded name.

Parameters:
d is the decoder
components may be NULL, otherwise is filled in with the Component boundary offsets
Returns:
the number of Components in the Name, or -1 if there is an error.

Definition at line 288 of file ccn_buf_decoder.c.

Referenced by ccn_append_link_name(), ccn_forwarding_entry_parse(), ccn_name_split(), ccn_parse_ContentObject(), ccn_parse_interest(), ccn_parse_KeyName(), ccn_parse_Link(), ccnd_reg_uri(), and r_proto_initiate_key_fetch().

int ccn_parse_nonNegativeInteger ( struct ccn_buf_decoder d  ) 

static int ccn_parse_optional_Any_or_Bloom ( struct ccn_buf_decoder d  )  [static]

Definition at line 351 of file ccn_buf_decoder.c.

Referenced by ccn_parse_Exclude().

uintmax_t ccn_parse_optional_tagged_binary_number ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag,
int  minlen,
int  maxlen,
uintmax_t  default_value 
)

int ccn_parse_optional_tagged_BLOB ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag,
int  minlen,
int  maxlen 
)

int ccn_parse_optional_tagged_nonNegativeInteger ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag 
)

int ccn_parse_optional_tagged_UDATA ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag 
)

Definition at line 234 of file ccn_buf_decoder.c.

Referenced by ccn_parse_Link(), and ccn_parse_Signature().

int ccn_parse_PublisherID ( struct ccn_buf_decoder d,
struct ccn_parsed_interest pi 
)

Definition at line 316 of file ccn_buf_decoder.c.

Referenced by ccn_parse_interest(), and ccn_parse_KeyName().

uintmax_t ccn_parse_required_tagged_binary_number ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag,
int  minlen,
int  maxlen 
)

int ccn_parse_required_tagged_BLOB ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag,
int  minlen,
int  maxlen 
)

int ccn_parse_required_tagged_timestamp ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag 
)

Definition at line 508 of file ccn_buf_decoder.c.

Referenced by ccn_parse_LinkAuthenticator(), and ccn_parse_SignedInfo().

int ccn_parse_required_tagged_UDATA ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag 
)

Definition at line 213 of file ccn_buf_decoder.c.

Referenced by ccn_parse_optional_tagged_UDATA().

static int ccn_parse_Signature ( struct ccn_buf_decoder d,
struct ccn_parsed_ContentObject x 
) [static]

static int ccn_parse_SignedInfo ( struct ccn_buf_decoder d,
struct ccn_parsed_ContentObject x 
) [static]

Definition at line 734 of file ccn_buf_decoder.c.

Referenced by ccn_parse_ContentObject().

int ccn_parse_tagged_string ( struct ccn_buf_decoder d,
enum ccn_dtag  dtag,
struct ccn_charbuf store 
)

Parses a ccnb-encoded element expected to contain a UDATA string.

Parameters:
d is the decoder
dtag is the expected dtag value
store - on success, the string value is appended to store, with null termination.
Returns:
the offset into the store buffer of the copied value, or -1 for error. If a parse error occurs, d->decoder.state is set to a negative value. If the element is not present, -1 is returned but no parse error is indicated.

Definition at line 253 of file ccn_buf_decoder.c.

Referenced by ccn_face_instance_parse(), ccn_forwarding_entry_parse(), and r_proto_parse_policy().

int ccn_parse_timestamp ( struct ccn_buf_decoder d  ) 

Definition at line 464 of file ccn_buf_decoder.c.

Referenced by ccn_parse_required_tagged_timestamp().

int ccn_parse_uintmax ( struct ccn_buf_decoder d,
uintmax_t *  result 
)

Parse a potentially large non-negative integer.

Returns:
0 for success, and the value is place in *result; for an error a negative value is returned and *result is unchanged.

Definition at line 429 of file ccn_buf_decoder.c.

Referenced by ccn_parse_tagged_required_uintmax(), and SyncParseUnsigned().

int ccn_ref_tagged_BLOB ( enum ccn_dtag  tt,
const unsigned char *  buf,
size_t  start,
size_t  stop,
const unsigned char **  presult,
size_t *  psize 
)


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