ccn.h File Reference

This is the low-level interface for CCNx clients. More...

Go to the source code of this file.

Data Structures

struct  ccn_closure
 Handle for upcalls that allow clients receive notifications of incoming interests and content. More...
struct  ccn_upcall_info
 Additional information provided in the upcall. More...
struct  ccn_buf_decoder
struct  ccn_parsed_interest
struct  ccn_parsed_ContentObject
struct  ccn_signing_params
 Parameters for creating signed content objects. More...

Defines

#define CCN_API_VERSION   4000
 A macro that clients may use to cope with an evolving API.
#define CCN_INTEREST_LIFETIME_SEC   4
 Interest lifetime default.
#define CCN_INTEREST_LIFETIME_MICROSEC   (CCN_INTEREST_LIFETIME_SEC * 1000000)
#define CCN_GET_NOKEYWAIT   1
#define CCN_AOK_CS   0x1
#define CCN_AOK_NEW   0x2
#define CCN_AOK_DEFAULT   (CCN_AOK_CS | CCN_AOK_NEW)
#define CCN_AOK_STALE   0x4
#define CCN_AOK_EXPIRE   0x10
#define CCN_SIGNING_PARAMS_INIT   { CCN_API_VERSION, 0, NULL, {0}, CCN_CONTENT_DATA, -1 }
#define CCN_SP_TEMPL_TIMESTAMP   0x0001
#define CCN_SP_TEMPL_FINAL_BLOCK_ID   0x0002
#define CCN_SP_TEMPL_FRESHNESS   0x0004
#define CCN_SP_TEMPL_KEY_LOCATOR   0x0008
#define CCN_SP_FINAL_BLOCK   0x0010
#define CCN_SP_OMIT_KEY_LOCATOR   0x0020
#define CCN_V_REPLACE   1
 Versioning.
#define CCN_V_LOW   2
 look for early version
#define CCN_V_HIGH   4
 look for newer version
#define CCN_V_EST   8
 look for extreme
#define CCN_V_LOWEST   (2|8)
#define CCN_V_HIGHEST   (4|8)
#define CCN_V_NEXT   (4|1)
#define CCN_V_PREV   (2|1)
#define CCN_V_NOW   16
 use current time
#define CCN_V_NESTOK   32
 version within version is ok

Typedefs

typedef enum ccn_upcall_res(* ccn_handler )(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
 ccn_handler This is the procedure type for the closure's implementation.

Enumerations

enum  ccn_upcall_kind {
  CCN_UPCALL_FINAL, CCN_UPCALL_INTEREST, CCN_UPCALL_CONSUMED_INTEREST, CCN_UPCALL_CONTENT,
  CCN_UPCALL_INTEREST_TIMED_OUT, CCN_UPCALL_CONTENT_UNVERIFIED, CCN_UPCALL_CONTENT_BAD
}
 

This tells what kind of event the upcall is handling.

More...
enum  ccn_upcall_res {
  CCN_UPCALL_RESULT_ERR = -1, CCN_UPCALL_RESULT_OK = 0, CCN_UPCALL_RESULT_REEXPRESS = 1, CCN_UPCALL_RESULT_INTEREST_CONSUMED = 2,
  CCN_UPCALL_RESULT_VERIFY = 3
}
 

Upcalls return one of these values.

More...
enum  ccn_marker {
  CCN_MARKER_NONE = -1, CCN_MARKER_SEQNUM = 0x00, CCN_MARKER_CONTROL = 0xC1, CCN_MARKER_OSEQNUM = 0xF8,
  CCN_MARKER_BLKID = 0xFB, CCN_MARKER_VERSION = 0xFD
}
enum  ccn_content_type {
  CCN_CONTENT_DATA = 0x0C04C0, CCN_CONTENT_ENCR = 0x10D091, CCN_CONTENT_GONE = 0x18E344, CCN_CONTENT_KEY = 0x28463F,
  CCN_CONTENT_LINK = 0x2C834A, CCN_CONTENT_NACK = 0x34008A
}
enum  ccn_parsed_interest_offsetid {
  CCN_PI_B_Name, CCN_PI_B_Component0, CCN_PI_B_LastPrefixComponent, CCN_PI_E_LastPrefixComponent,
  CCN_PI_E_ComponentLast = CCN_PI_E_LastPrefixComponent, CCN_PI_E_Name, CCN_PI_B_MinSuffixComponents, CCN_PI_E_MinSuffixComponents,
  CCN_PI_B_MaxSuffixComponents, CCN_PI_E_MaxSuffixComponents, CCN_PI_B_PublisherID, CCN_PI_B_PublisherIDKeyDigest,
  CCN_PI_E_PublisherIDKeyDigest, CCN_PI_E_PublisherID, CCN_PI_B_Exclude, CCN_PI_E_Exclude,
  CCN_PI_B_ChildSelector, CCN_PI_E_ChildSelector, CCN_PI_B_AnswerOriginKind, CCN_PI_E_AnswerOriginKind,
  CCN_PI_B_Scope, CCN_PI_E_Scope, CCN_PI_B_InterestLifetime, CCN_PI_E_InterestLifetime,
  CCN_PI_B_Nonce, CCN_PI_E_Nonce, CCN_PI_B_OTHER, CCN_PI_E_OTHER,
  CCN_PI_E
}
enum  ccn_parsed_content_object_offsetid {
  CCN_PCO_B_Signature, CCN_PCO_B_DigestAlgorithm, CCN_PCO_E_DigestAlgorithm, CCN_PCO_B_Witness,
  CCN_PCO_E_Witness, CCN_PCO_B_SignatureBits, CCN_PCO_E_SignatureBits, CCN_PCO_E_Signature,
  CCN_PCO_B_Name, CCN_PCO_B_Component0, CCN_PCO_E_ComponentN, CCN_PCO_E_ComponentLast = CCN_PCO_E_ComponentN,
  CCN_PCO_E_Name, CCN_PCO_B_SignedInfo, CCN_PCO_B_PublisherPublicKeyDigest, CCN_PCO_E_PublisherPublicKeyDigest,
  CCN_PCO_B_Timestamp, CCN_PCO_E_Timestamp, CCN_PCO_B_Type, CCN_PCO_E_Type,
  CCN_PCO_B_FreshnessSeconds, CCN_PCO_E_FreshnessSeconds, CCN_PCO_B_FinalBlockID, CCN_PCO_E_FinalBlockID,
  CCN_PCO_B_KeyLocator, CCN_PCO_B_Key_Certificate_KeyName, CCN_PCO_B_KeyName_Name, CCN_PCO_E_KeyName_Name,
  CCN_PCO_B_KeyName_Pub, CCN_PCO_E_KeyName_Pub, CCN_PCO_E_Key_Certificate_KeyName, CCN_PCO_E_KeyLocator,
  CCN_PCO_E_SignedInfo, CCN_PCO_B_Content, CCN_PCO_E_Content, CCN_PCO_E
}

Functions

struct ccn * ccn_create (void)
 Create a client handle.
int ccn_connect (struct ccn *h, const char *name)
 Connect to local ccnd.
int ccn_get_connection_fd (struct ccn *h)
int ccn_disconnect (struct ccn *h)
void ccn_destroy (struct ccn **hp)
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_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_append_numeric (struct ccn_charbuf *c, enum ccn_marker tag, 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_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_express_interest (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action, struct ccn_charbuf *interest_template)
int ccn_set_interest_filter (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action)
int ccn_set_interest_filter_with_flags (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action, int forw_flags)
int ccn_put (struct ccn *h, const void *p, size_t length)
int ccn_output_is_pending (struct ccn *h)
int ccn_run (struct ccn *h, int timeout)
 Run the ccn client event loop.
int ccn_set_run_timeout (struct ccn *h, int timeout)
 Modify ccn_run timeout.
int ccn_get (struct ccn *h, struct ccn_charbuf *name, struct ccn_charbuf *interest_template, int timeout_ms, struct ccn_charbuf *resultbuf, struct ccn_parsed_ContentObject *pcobuf, struct ccn_indexbuf *compsbuf, int flags)
 Get a single matching ContentObject This is a convenience for getting a single matching ContentObject.
int ccn_verify_content (struct ccn *h, const unsigned char *msg, struct ccn_parsed_ContentObject *pco)
 Verify a ContentObject using the public key from either the object itself or our cache of keys.
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_advance_past_element (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)
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)
int ccn_parse_nonNegativeInteger (struct ccn_buf_decoder *d)
int ccn_parse_optional_tagged_nonNegativeInteger (struct ccn_buf_decoder *d, enum ccn_dtag dtag)
int ccn_parse_uintmax (struct ccn_buf_decoder *d, uintmax_t *result)
 Parse a potentially large non-negative integer.
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.
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)
void ccn_buf_check_close (struct ccn_buf_decoder *d)
 Enter an error state if element closer not found.
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)
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)
intmax_t ccn_interest_lifetime (const unsigned char *msg, const struct ccn_parsed_interest *pi)
int ccn_interest_lifetime_seconds (const unsigned char *msg, const struct ccn_parsed_interest *pi)
int ccn_parse_ContentObject (const unsigned char *msg, size_t size, struct ccn_parsed_ContentObject *x, struct ccn_indexbuf *components)
void ccn_digest_ContentObject (const unsigned char *msg, struct ccn_parsed_ContentObject *pc)
 Compute the digest of the entire ContentObject if necessary, caching the result in pc->digest, pc->digest_bytes.
int ccn_parse_Name (struct ccn_buf_decoder *d, struct ccn_indexbuf *components)
 Parses a ccnb-encoded name.
int ccn_compare_names (const unsigned char *a, size_t asize, const unsigned char *b, size_t bsize)
int ccn_name_comp_strcmp (const unsigned char *data, const struct ccn_indexbuf *indexbuf, unsigned int i, const char *val)
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_next_sibling (struct ccn_charbuf *c)
 Advance the last Component of a Name to the next possible value.
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 *size)
int ccn_sign_content (struct ccn *h, struct ccn_charbuf *resultbuf, const struct ccn_charbuf *name_prefix, const struct ccn_signing_params *params, const void *data, size_t size)
 Create a signed ContentObject.
int ccn_load_private_key (struct ccn *h, const char *keystore_path, const char *keystore_passphrase, struct ccn_charbuf *pubid_out)
 Load a private key from a keystore file.
int ccn_load_default_key (struct ccn *h, const char *keystore_path, const char *keystore_passphrase)
 Load the handle's default signing key from a keystore.
int ccn_get_public_key (struct ccn *h, const struct ccn_signing_params *params, struct ccn_charbuf *digest_result, struct ccn_charbuf *result)
 Place the public key associated with the params into result buffer, and its digest into digest_result.
int ccn_chk_signing_params (struct ccn *h, const struct ccn_signing_params *params, struct ccn_signing_params *result, struct ccn_charbuf **ptimestamp, struct ccn_charbuf **pfinalblockid, struct ccn_charbuf **pkeylocator)
 This is mostly for use within the library, but may be useful for some clients.
int ccn_signed_info_create (struct ccn_charbuf *c, const void *publisher_key_id, size_t publisher_key_id_size, const struct ccn_charbuf *timestamp, enum ccn_content_type type, int freshness, const struct ccn_charbuf *finalblockid, const struct ccn_charbuf *key_locator)
 Create SignedInfo.
int ccn_encode_ContentObject (struct ccn_charbuf *buf, const struct ccn_charbuf *Name, const struct ccn_charbuf *SignedInfo, const void *data, size_t size, const char *digest_algorithm, const struct ccn_pkey *private_key)
 Encode and sign a ContentObject.
int ccn_content_matches_interest (const unsigned char *content_object, size_t content_object_size, int implicit_content_digest, struct ccn_parsed_ContentObject *pc, const unsigned char *interest_msg, size_t interest_msg_size, const struct ccn_parsed_interest *pi)
 Test for a match between a ContentObject and an Interest.
int ccn_encode_StatusResponse (struct ccn_charbuf *buf, int errcode, const char *errtext)
void ccn_perror (struct ccn *h, const char *s)
 Produce message on standard error output describing the last error encountered during a call using the given handle.
int ccn_seterror (struct ccn *h, int error_code)
 Set the error code in a ccn handle.
int ccn_geterror (struct ccn *h)
 Recover last error code.
int ccn_charbuf_append_tt (struct ccn_charbuf *c, size_t val, enum ccn_tt tt)
 Append a ccnb start marker.
int ccn_charbuf_append_closer (struct ccn_charbuf *c)
 Append a CCN_CLOSE.
int ccnb_append_number (struct ccn_charbuf *c, int nni)
 Append a non-negative integer as a UDATA.
int ccnb_append_timestamp_blob (struct ccn_charbuf *c, enum ccn_marker marker, intmax_t secs, int nsecs)
 Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction).
int ccnb_append_now_blob (struct ccn_charbuf *c, enum ccn_marker marker)
 Append a binary timestamp, using the current time.
int ccnb_element_begin (struct ccn_charbuf *c, enum ccn_dtag dtag)
 Append a start-of-element marker.
int ccnb_element_end (struct ccn_charbuf *c)
 Append an end-of-element marker.
int ccnb_append_tagged_blob (struct ccn_charbuf *c, enum ccn_dtag dtag, const void *data, size_t size)
 Append a tagged BLOB.
int ccnb_tagged_putf (struct ccn_charbuf *c, enum ccn_dtag dtag, const char *fmt,...)
 Append a tagged UDATA string, with printf-style formatting.
int ccn_resolve_version (struct ccn *h, struct ccn_charbuf *name, int versioning_flags, int timeout_ms)
 Resolve the version, based on existing ccn content.
int ccn_create_version (struct ccn *h, struct ccn_charbuf *name, int versioning_flags, intmax_t secs, int nsecs)
 Extend a Name with a new version stamp.

Detailed Description

This is the low-level interface for CCNx clients.

Part of the CCNx C Library.

Copyright (C) 2008-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.h.


Define Documentation

#define CCN_AOK_CS   0x1

Definition at line 512 of file ccn.h.

Referenced by answer_passive(), ccn_parse_interest(), and process_incoming_interest().

#define CCN_AOK_DEFAULT   (CCN_AOK_CS | CCN_AOK_NEW)

Definition at line 514 of file ccn.h.

Referenced by ccn_parse_interest(), local_scope_rm_template(), main(), and make_template().

#define CCN_AOK_EXPIRE   0x10

Definition at line 516 of file ccn.h.

Referenced by ccn_parse_interest(), local_scope_rm_template(), and process_incoming_interest().

#define CCN_AOK_NEW   0x2

Definition at line 513 of file ccn.h.

Referenced by ccn_parse_interest(), ccnd_answer_req(), and incoming_interest().

#define CCN_AOK_STALE   0x4

Definition at line 515 of file ccn.h.

Referenced by answer_passive(), main(), make_template(), and process_incoming_interest().

#define CCN_API_VERSION   4000

A macro that clients may use to cope with an evolving API.

The decimal digits of this use the pattern MMVVXXX, where MM is the major release number and VV is the minor version level. XXX will be bumped when an API change is made, but it will not be directly tied to the patch level in a release number. Thus CCN_API_VERSION=1000 would have corresponded to the first public release (0.1.0), but that version did not have this macro defined.

Definition at line 40 of file ccn.h.

Referenced by collect_stats_html(), and collect_stats_xml().

#define CCN_GET_NOKEYWAIT   1

Definition at line 373 of file ccn.h.

Referenced by ccn_get(), ccn_resolve_version(), and handle_simple_incoming_content().

#define CCN_INTEREST_LIFETIME_MICROSEC   (CCN_INTEREST_LIFETIME_SEC * 1000000)
#define CCN_INTEREST_LIFETIME_SEC   4

Interest lifetime default.

If the interest lifetime is not explicit, this is the default value.

Definition at line 47 of file ccn.h.

Referenced by ccn_interest_lifetime(), and ccn_update_refresh_us().

#define CCN_SIGNING_PARAMS_INIT   { CCN_API_VERSION, 0, NULL, {0}, CCN_CONTENT_DATA, -1 }
#define CCN_SP_FINAL_BLOCK   0x0010
#define CCN_SP_OMIT_KEY_LOCATOR   0x0020

Definition at line 719 of file ccn.h.

Referenced by ccn_chk_signing_params(), and ccn_sign_content().

#define CCN_SP_TEMPL_FINAL_BLOCK_ID   0x0002

Definition at line 715 of file ccn.h.

Referenced by ccn_chk_signing_params().

#define CCN_SP_TEMPL_FRESHNESS   0x0004

Definition at line 716 of file ccn.h.

Referenced by ccn_chk_signing_params(), and main().

#define CCN_SP_TEMPL_KEY_LOCATOR   0x0008

Definition at line 717 of file ccn.h.

Referenced by ccn_chk_signing_params(), ccnd_init_service_ccnb(), and main().

#define CCN_SP_TEMPL_TIMESTAMP   0x0001

Definition at line 714 of file ccn.h.

Referenced by ccn_chk_signing_params(), and main().

#define CCN_V_EST   8

look for extreme

Definition at line 882 of file ccn.h.

Referenced by ccn_resolve_version().

#define CCN_V_HIGH   4

look for newer version

Definition at line 881 of file ccn.h.

Referenced by ccn_create_version(), ccn_resolve_version(), and main().

#define CCN_V_HIGHEST   (4|8)

Definition at line 884 of file ccn.h.

Referenced by ccn_get_header(), and main().

#define CCN_V_LOW   2

look for early version

Definition at line 880 of file ccn.h.

#define CCN_V_LOWEST   (2|8)

Definition at line 883 of file ccn.h.

#define CCN_V_NESTOK   32

version within version is ok

Definition at line 888 of file ccn.h.

Referenced by ccn_create_version(), and ccn_resolve_version().

#define CCN_V_NEXT   (4|1)

Definition at line 885 of file ccn.h.

#define CCN_V_NOW   16

use current time

Definition at line 887 of file ccn.h.

Referenced by ccn_create_version(), ccn_seqw_create(), and main().

#define CCN_V_PREV   (2|1)

Definition at line 886 of file ccn.h.

#define CCN_V_REPLACE   1

Versioning.

if last component is version, replace it

Definition at line 879 of file ccn.h.

Referenced by ccn_create_version(), and main().


Typedef Documentation

typedef enum ccn_upcall_res(* ccn_handler)(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)

ccn_handler This is the procedure type for the closure's implementation.

Definition at line 94 of file ccn.h.


Enumeration Type Documentation

Enumerator:
CCN_CONTENT_DATA 
CCN_CONTENT_ENCR 
CCN_CONTENT_GONE 
CCN_CONTENT_KEY 
CCN_CONTENT_LINK 
CCN_CONTENT_NACK 

Definition at line 265 of file ccn.h.

enum ccn_marker
Enumerator:
CCN_MARKER_NONE 
CCN_MARKER_SEQNUM 

consecutive block sequence numbers

CCN_MARKER_CONTROL 

commands, etc.

CCN_MARKER_OSEQNUM 

deprecated

CCN_MARKER_BLKID 

nonconsecutive block ids

CCN_MARKER_VERSION 

timestamp-based versioning

Definition at line 214 of file ccn.h.

Enumerator:
CCN_PCO_B_Signature 
CCN_PCO_B_DigestAlgorithm 
CCN_PCO_E_DigestAlgorithm 
CCN_PCO_B_Witness 
CCN_PCO_E_Witness 
CCN_PCO_B_SignatureBits 
CCN_PCO_E_SignatureBits 
CCN_PCO_E_Signature 
CCN_PCO_B_Name 
CCN_PCO_B_Component0 
CCN_PCO_E_ComponentN 
CCN_PCO_E_ComponentLast 
CCN_PCO_E_Name 
CCN_PCO_B_SignedInfo 
CCN_PCO_B_PublisherPublicKeyDigest 
CCN_PCO_E_PublisherPublicKeyDigest 
CCN_PCO_B_Timestamp 
CCN_PCO_E_Timestamp 
CCN_PCO_B_Type 
CCN_PCO_E_Type 
CCN_PCO_B_FreshnessSeconds 
CCN_PCO_E_FreshnessSeconds 
CCN_PCO_B_FinalBlockID 
CCN_PCO_E_FinalBlockID 
CCN_PCO_B_KeyLocator 
CCN_PCO_B_Key_Certificate_KeyName 
CCN_PCO_B_KeyName_Name 
CCN_PCO_E_KeyName_Name 
CCN_PCO_B_KeyName_Pub 
CCN_PCO_E_KeyName_Pub 
CCN_PCO_E_Key_Certificate_KeyName 
CCN_PCO_E_KeyLocator 
CCN_PCO_E_SignedInfo 
CCN_PCO_B_Content 
CCN_PCO_E_Content 
CCN_PCO_E 

Definition at line 546 of file ccn.h.

Enumerator:
CCN_PI_B_Name 
CCN_PI_B_Component0 
CCN_PI_B_LastPrefixComponent 
CCN_PI_E_LastPrefixComponent 
CCN_PI_E_ComponentLast 
CCN_PI_E_Name 
CCN_PI_B_MinSuffixComponents 
CCN_PI_E_MinSuffixComponents 
CCN_PI_B_MaxSuffixComponents 
CCN_PI_E_MaxSuffixComponents 
CCN_PI_B_PublisherID 
CCN_PI_B_PublisherIDKeyDigest 
CCN_PI_E_PublisherIDKeyDigest 
CCN_PI_E_PublisherID 
CCN_PI_B_Exclude 
CCN_PI_E_Exclude 
CCN_PI_B_ChildSelector 
CCN_PI_E_ChildSelector 
CCN_PI_B_AnswerOriginKind 
CCN_PI_E_AnswerOriginKind 
CCN_PI_B_Scope 
CCN_PI_E_Scope 
CCN_PI_B_InterestLifetime 
CCN_PI_E_InterestLifetime 
CCN_PI_B_Nonce 
CCN_PI_E_Nonce 
CCN_PI_B_OTHER 
CCN_PI_E_OTHER 
CCN_PI_E 

Definition at line 466 of file ccn.h.

This tells what kind of event the upcall is handling.

Enumerator:
CCN_UPCALL_FINAL 

handler is about to be deregistered

CCN_UPCALL_INTEREST 

incoming interest

CCN_UPCALL_CONSUMED_INTEREST 

incoming interest, someone has answered

CCN_UPCALL_CONTENT 

incoming verified content

CCN_UPCALL_INTEREST_TIMED_OUT 

interest timed out

CCN_UPCALL_CONTENT_UNVERIFIED 

content that has not been verified

CCN_UPCALL_CONTENT_BAD 

verification failed

Definition at line 69 of file ccn.h.

Upcalls return one of these values.

Enumerator:
CCN_UPCALL_RESULT_ERR 

upcall detected an error

CCN_UPCALL_RESULT_OK 

normal upcall return

CCN_UPCALL_RESULT_REEXPRESS 

reexpress the same interest again

CCN_UPCALL_RESULT_INTEREST_CONSUMED 

upcall claims to consume interest

CCN_UPCALL_RESULT_VERIFY 

force an unverified result to be verified

Definition at line 82 of file ccn.h.


Function Documentation

void ccn_buf_advance ( struct ccn_buf_decoder d  ) 
int ccn_buf_advance_past_element ( struct ccn_buf_decoder d  ) 
void ccn_buf_check_close ( struct ccn_buf_decoder d  ) 
struct ccn_buf_decoder* ccn_buf_decoder_start ( struct ccn_buf_decoder d,
const unsigned char *  buf,
size_t  size 
) [read]
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 
)
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_charbuf_append_closer ( struct ccn_charbuf c  ) 
int ccn_charbuf_append_tt ( struct ccn_charbuf c,
size_t  val,
enum ccn_tt  tt 
)
int ccn_chk_signing_params ( struct ccn *  h,
const struct ccn_signing_params params,
struct ccn_signing_params result,
struct ccn_charbuf **  ptimestamp,
struct ccn_charbuf **  pfinalblockid,
struct ccn_charbuf **  pkeylocator 
)

This is mostly for use within the library, but may be useful for some clients.

Definition at line 2051 of file ccn_client.c.

Referenced by ccn_get_public_key(), ccn_sign_content(), and ccnd_init_internal_keystore().

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

Definition at line 890 of file ccn_buf_decoder.c.

Referenced by content_skiplist_findbefore(), and namecompare().

int ccn_connect ( struct ccn *  h,
const char *  name 
)

Connect to local ccnd.

Parameters:
h is a ccn library handle
name is the name of the unix-domain socket to connect to; use NULL to get the default.
Returns:
the fd for the connection, or -1 for error.

Definition at line 288 of file ccn_client.c.

Referenced by ccn_fetch_new(), ccn_get(), and main().

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 *  size 
)
int ccn_content_matches_interest ( const unsigned char *  content_object,
size_t  content_object_size,
int  implicit_content_digest,
struct ccn_parsed_ContentObject pc,
const unsigned char *  interest_msg,
size_t  interest_msg_size,
const struct ccn_parsed_interest pi 
)

Test for a match between a ContentObject and an Interest.

Parameters:
content_object ccnb-encoded ContentObject
content_object_size its size in bytes
implicit_content_digest boolean indicating whether the final name component is implicit (as in the on-wire format) or explicit (as within ccnd's content store).
pc Valid parse information may be provided to speed things up. If NULL it will be reconstructed internally.
interest_msg ccnb-encoded Interest
interest_msg_size its size in bytes
pi see _pc_
Returns:
1 if the ccnb-encoded content_object matches the ccnb-encoded interest_msg, otherwise 0.

Definition at line 110 of file ccn_match.c.

Referenced by ccn_dispatch_message(), ccnd_answer_req(), consume_matching_interests(), incoming_interest(), interest_handler(), process_incoming_interest(), and seqw_incoming_interest().

struct ccn* ccn_create ( void   )  [read]

Create a client handle.

The new handle is not yet connected. On error, returns NULL and sets errno. Errors: ENOMEM

Definition at line 239 of file ccn_client.c.

Referenced by ccn_fetch_new(), ccn_get(), ccnd_internal_client_start(), and main().

int ccn_create_version ( struct ccn *  h,
struct ccn_charbuf name,
int  versioning_flags,
intmax_t  secs,
int  nsecs 
)

Extend a Name with a new version stamp.

Parameters:
h is the the ccn handle. May be NULL. This procedure does not use the connection.
name is a ccnb-encoded Name prefix. By default it gets extended in-place with one additional Component that conforms to the versioning profile and is based on the supplied time, unless a version component is already present.
versioning_flags modifies the default behavior: CCN_V_REPLACE causes the last component to be replaced if it appears to be a version stamp. If CCN_V_HIGH is set as well, an attempt will be made to generate a new version stamp that is later than the existing one, or to return an error. CCN_V_NOW bases the version on the current time rather than the supplied time. CCN_V_NESTOK will allow the new version component to be appended even if there is one there (this makes no difference if CCN_V_REPLACE is also set).
secs is the desired time, in seconds since epoch (ignored if CCN_V_NOW is set).
nsecs is the number of nanoseconds.
Returns:
-1 for error, 0 for success.

Definition at line 215 of file ccn_versioning.c.

Referenced by ccn_seqw_create(), ccnd_init_service_ccnb(), and main().

void ccn_destroy ( struct ccn **  hp  ) 
void ccn_digest_ContentObject ( const unsigned char *  msg,
struct ccn_parsed_ContentObject pc 
)

Compute the digest of the entire ContentObject if necessary, caching the result in pc->digest, pc->digest_bytes.

Definition at line 33 of file ccn_match.c.

Referenced by ccn_content_matches_interest(), incoming_content(), and process_incoming_content().

int ccn_disconnect ( struct ccn *  h  ) 

Definition at line 323 of file ccn_client.c.

Referenced by ccn_destroy(), ccn_fetch_destroy(), ccn_process_input(), ccn_run(), and main().

int ccn_encode_ContentObject ( struct ccn_charbuf buf,
const struct ccn_charbuf Name,
const struct ccn_charbuf SignedInfo,
const void *  data,
size_t  size,
const char *  digest_algorithm,
const struct ccn_pkey *  private_key 
)

Encode and sign a ContentObject.

Parameters:
buf is the output buffer where encoded object is written.
Name is the ccnb-encoded name from ccn_name_init and friends.
SignedInfo is the ccnb-encoded info from ccn_signed_info_create.
data pintes to the raw data to be encoded.
size is the size, in bytes, of the raw data to be encoded.
digest_algorithm may be NULL for default.
private_key is the private key to use for signing.
Returns:
0 for success or -1 for error.

Definition at line 160 of file ccn_buf_encoder.c.

Referenced by ccn_sign_content(), encode_message(), and main().

int ccn_encode_StatusResponse ( struct ccn_charbuf buf,
int  errcode,
const char *  errtext 
)

Definition at line 231 of file ccn_buf_encoder.c.

Referenced by ccnd_nack().

int ccn_express_interest ( struct ccn *  h,
struct ccn_charbuf namebuf,
struct ccn_closure action,
struct ccn_charbuf interest_template 
)
int ccn_fetch_tagged_nonNegativeInteger ( enum ccn_dtag  tt,
const unsigned char *  buf,
size_t  start,
size_t  stop 
)

Definition at line 540 of file ccn_buf_decoder.c.

Referenced by set_content_timer().

int ccn_get ( struct ccn *  h,
struct ccn_charbuf name,
struct ccn_charbuf interest_template,
int  timeout_ms,
struct ccn_charbuf resultbuf,
struct ccn_parsed_ContentObject pcobuf,
struct ccn_indexbuf compsbuf,
int  flags 
)

Get a single matching ContentObject This is a convenience for getting a single matching ContentObject.

Blocks until a matching ContentObject arrives or there is a timeout.

Parameters:
h is the ccn handle. If NULL or ccn_get is called from inside an upcall, a new connection will be used and upcalls from other requests will not be processed while ccn_get is active.
name holds a ccnb-encoded Name
interest_template conveys other fields to be used in the interest (may be NULL).
timeout_ms limits the time spent waiting for an answer (milliseconds).
resultbuf is updated to contain the ccnb-encoded ContentObject.
pcobuf may be supplied to save the client the work of re-parsing the ContentObject; may be NULL if this information is not actually needed.
compsbuf works similarly.
flags - CCN_GET_NOKEYWAIT means that it is permitted to return unverified data.
Returns:
0 for success, -1 for an error.

Definition at line 1618 of file ccn_client.c.

Referenced by ccn_get_header(), ccn_resolve_version(), create_face(), get_ccndid(), main(), and register_unregister_prefix().

int ccn_get_connection_fd ( struct ccn *  h  ) 

Definition at line 317 of file ccn_client.c.

Referenced by main().

int ccn_get_public_key ( struct ccn *  h,
const struct ccn_signing_params params,
struct ccn_charbuf digest_result,
struct ccn_charbuf result 
)

Place the public key associated with the params into result buffer, and its digest into digest_result.

This is for one of our signing keys, not just any key. Result buffers may be NULL if the corresponding result is not wanted.

Returns:
0 for success, negative for error

Definition at line 1999 of file ccn_client.c.

Referenced by ccnd_init_service_ccnb().

int ccn_geterror ( struct ccn *  h  ) 

Recover last error code.

Parameters:
h is the ccn handle - may be NULL.
Returns:
the most recently set error code, or 0 if h is NULL.

Definition at line 186 of file ccn_client.c.

intmax_t ccn_interest_lifetime ( const unsigned char *  msg,
const struct ccn_parsed_interest pi 
)
Returns:
the lifetime of the interest in units of 2**(-12) seconds (the same units as timestamps).

Definition at line 32 of file ccn_interest.c.

Referenced by ccn_construct_interest(), ccn_interest_lifetime_seconds(), main(), process_incoming_interest(), and propagate_interest().

int ccn_interest_lifetime_seconds ( const unsigned char *  msg,
const struct ccn_parsed_interest pi 
)
Returns:
the lifetime of the interest in units of seconds; any fractional part is truncated. Not useful for short-lived interests.

Definition at line 56 of file ccn_interest.c.

Referenced by main(), and process_incoming_interest().

int ccn_load_default_key ( struct ccn *  h,
const char *  keystore_path,
const char *  keystore_passphrase 
)

Load the handle's default signing key from a keystore.

This call is only required for applications that use something other than the user's default signing key as the handle's default. It should be called early and at most once.

Parameters:
h is the ccn handle
keystore_path is the pathname of the keystore file
keystore_passphrase is the passphase needed to unlock the keystore
Returns:
is 0 for success, negative for error.

Definition at line 1961 of file ccn_client.c.

Referenced by ccnd_init_internal_keystore().

int ccn_load_private_key ( struct ccn *  h,
const char *  keystore_path,
const char *  keystore_passphrase,
struct ccn_charbuf pubid_out 
)

Load a private key from a keystore file.

This call is only required for applications that use something other than the user's default signing key.

Parameters:
h is the ccn handle
keystore_path is the pathname of the keystore file
keystore_passphrase is the passphase needed to unlock the keystore
pubid_out,if not NULL, is loaded with the digest of the public key
Returns:
is 0 for success, negative for error.

Definition at line 1896 of file ccn_client.c.

Referenced by ccn_chk_signing_params(), and ccn_load_default_key().

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 
)

Add sequence of ccnb-encoded Components to a ccnb-encoded Name.

start and stop are offsets from ccnb

Returns:
0, or -1 for obvious error

Definition at line 131 of file ccn_name_util.c.

Referenced by age_forwarding(), ccn_initiate_prefix_reg(), ccnd_reg_prefix(), collect_forwarding_html(), collect_forwarding_xml(), incoming_content(), and next_child_at_level().

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.

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(), main(), sequenced_name(), and seqw_next_cob().

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(), create_face(), encode_message(), main(), and register_unregister_prefix().

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(), and main().

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.

The first component is index 0.

Returns:
0, or -1 for error.

Definition at line 152 of file ccn_name_util.c.

Referenced by ccn_name_comp_strcmp(), ccn_resolve_version(), ccn_sign_content(), ccnd_answer_req(), and ccnd_uri_listen().

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(), and 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(), and ccnd_uri_listen().

int ccn_output_is_pending ( struct ccn *  h  ) 
int ccn_parse_ContentObject ( const unsigned char *  msg,
size_t  size,
struct ccn_parsed_ContentObject x,
struct ccn_indexbuf components 
)
int ccn_parse_interest ( const unsigned char *  msg,
size_t  size,
struct ccn_parsed_interest interest,
struct ccn_indexbuf components 
)
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 289 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(), and ccnd_reg_uri().

int ccn_parse_nonNegativeInteger ( struct ccn_buf_decoder d  ) 
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 
)

Definition at line 204 of file ccn_buf_decoder.c.

Referenced by ccn_interest_lifetime(), and ccn_parse_SignedInfo().

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 
)
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_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(), and ccn_forwarding_entry_parse().

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 430 of file ccn_buf_decoder.c.

Referenced by ccn_parse_tagged_required_uintmax().

void ccn_perror ( struct ccn *  h,
const char *  s 
)

Produce message on standard error output describing the last error encountered during a call using the given handle.

Parameters:
h is the ccn handle - may not be NULL.
s is a client-supplied message; if NULL a message will be supplied where available.

Definition at line 140 of file ccn_client.c.

Referenced by ccn_create(), ccn_note_err(), ccn_resolve_version(), and main().

int ccn_put ( struct ccn *  h,
const void *  p,
size_t  length 
)
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 
)
int ccn_resolve_version ( struct ccn *  h,
struct ccn_charbuf name,
int  versioning_flags,
int  timeout_ms 
)

Resolve the version, based on existing ccn content.

Parameters:
h is the the ccn handle; it may be NULL, but it is preferable to use the handle that the client probably already has.
name is a ccnb-encoded Name prefix. It gets extended in-place with one additional Component such that it names highest extant version that can be found, subject to the supplied timeout.
versioning_flags presently must be CCN_V_HIGH or CCN_V_HIGHEST, possibly combined with CCN_V_NESTOK. If CCN_V_NESTOK is not present and the ending component appears to be a version, the routine returns 0 immediately, on the assumption that an explicit version has already been provided.
timeout_ms is a time value in milliseconds. This is applied per fetch attempt, so the total time may be longer by a factor that depends on the number of (ccn) hops to the source(s).
Returns:
-1 for error, 0 if name could not be extended, 1 if was.

Definition at line 124 of file ccn_versioning.c.

Referenced by ccn_fetch_open(), ccn_get_header(), and main().

int ccn_run ( struct ccn *  h,
int  timeout 
)

Run the ccn client event loop.

This may serve as the main event loop for simple apps by passing a timeout value of -1.

Parameters:
h is the ccn handle.
timeout is in milliseconds.
Returns:
a negative value for error, zero for success.

Definition at line 1491 of file ccn_client.c.

Referenced by ccn_dump_names(), ccn_fetch_poll(), ccn_get(), and main().

int ccn_set_interest_filter ( struct ccn *  h,
struct ccn_charbuf namebuf,
struct ccn_closure action 
)

Definition at line 638 of file ccn_client.c.

Referenced by ccn_seqw_close(), ccn_seqw_create(), ccnd_uri_listen(), and main().

int ccn_set_interest_filter_with_flags ( struct ccn *  h,
struct ccn_charbuf namebuf,
struct ccn_closure action,
int  forw_flags 
)

Definition at line 607 of file ccn_client.c.

Referenced by ccn_set_interest_filter(), and main().

int ccn_set_run_timeout ( struct ccn *  h,
int  timeout 
)

Modify ccn_run timeout.

This may be called from an upcall to change the timeout value. Most often this will be used to set the timeout to zero so that ccn_run will return control to the client.

Parameters:
h is the ccn handle.
timeout is in milliseconds.
Returns:
old timeout value.

Definition at line 1475 of file ccn_client.c.

Referenced by CallMe(), handle_simple_incoming_content(), incoming_content(), and incoming_interest().

int ccn_seterror ( struct ccn *  h,
int  error_code 
)

Set the error code in a ccn handle.

Parameters:
h is the ccn handle - may be NULL.
error_code is the code to set.
Returns:
-1 in all cases.

Definition at line 169 of file ccn_client.c.

Referenced by ccn_resolve_version(), and ccn_seqw_write().

int ccn_sign_content ( struct ccn *  h,
struct ccn_charbuf resultbuf,
const struct ccn_charbuf name_prefix,
const struct ccn_signing_params params,
const void *  data,
size_t  size 
)

Create a signed ContentObject.

Parameters:
h is the ccn handle
resultbuf - result buffer to which the ContentObject will be appended
name_prefix contains the ccnb-encoded name
params describe the ancillary information needed
data points to the raw content
size is the size of the raw content, in bytes
Returns:
0 for success, -1 for error

Definition at line 2210 of file ccn_client.c.

Referenced by ccn_initiate_prefix_reg(), ccnd_answer_req(), ccnd_init_service_ccnb(), create_face(), main(), register_unregister_prefix(), and seqw_next_cob().

int ccn_signed_info_create ( struct ccn_charbuf c,
const void *  publisher_key_id,
size_t  publisher_key_id_size,
const struct ccn_charbuf timestamp,
enum ccn_content_type  type,
int  freshness,
const struct ccn_charbuf finalblockid,
const struct ccn_charbuf key_locator 
)

Create SignedInfo.

Parameters:
c is used to hold the result.
publisher_key_id points to the digest of the publisher key id.
publisher_key_id_size is the size in bytes(32) of the pub key digest
timestamp holds the timestamp, as a ccnb-encoded blob, or is NULL to use the current time.
type indicates the Type of the ContentObject.
freshness is the FreshnessSeconds value, or -1 to omit.
finalblockid holds the FinalBlockID, as a ccnb-encoded blob, or is NULL to omit.
key_locator is the ccnb-encoded KeyLocator element, or NULL to omit.
Returns:
0 for success or -1 for error.

Definition at line 48 of file ccn_buf_encoder.c.

Referenced by ccn_sign_content(), and main().

int ccn_verify_content ( struct ccn *  h,
const unsigned char *  msg,
struct ccn_parsed_ContentObject pco 
)

Verify a ContentObject using the public key from either the object itself or our cache of keys.

This routine does not attempt to fetch the public key if it is not at hand.

Returns:
negative for error, 0 verification success, or 1 if the key needs to be requested.

Definition at line 1867 of file ccn_client.c.

Referenced by ccnd_answer_req().

int ccnb_append_now_blob ( struct ccn_charbuf c,
enum ccn_marker  marker 
)

Append a binary timestamp, using the current time.

Like ccnb_append_timestamp_blob() but uses current time

Parameters:
c is the buffer to append to.
marker - see ccnb_append_timestamp_blob()
Returns:
0 for success or -1 for error.

Definition at line 355 of file ccn_buf_encoder.c.

Referenced by ccn_create_version(), and ccn_signed_info_create().

int ccnb_append_number ( struct ccn_charbuf c,
int  nni 
)

Append a non-negative integer as a UDATA.

Parameters:
c is the buffer to append to.
nni is a non-negative value.
Returns:
0 for success or -1 for error.

Definition at line 288 of file ccn_buf_encoder.c.

Referenced by main(), make_data_template(), and make_template().

int ccnb_append_tagged_blob ( struct ccn_charbuf c,
enum ccn_dtag  dtag,
const void *  data,
size_t  size 
)

Append a tagged BLOB.

This is a ccnb-encoded element with containing the BLOB as content

Parameters:
c is the buffer to append to.
dtag is the element's dtab
data points to the binary data
size is the size of the data, in bytes
Returns:
0 for success or -1 for error.

Definition at line 395 of file ccn_buf_encoder.c.

Referenced by ccn_encode_ContentObject(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), ccnb_append_header(), ccnd_append_debug_nonce(), and main().

int ccnb_append_timestamp_blob ( struct ccn_charbuf c,
enum ccn_marker  marker,
intmax_t  secs,
int  nsecs 
)

Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction).

Parameters:
c is the buffer to append to.
marker If marker >= 0, the low-order byte is used as a marker byte, useful for some content naming conventions (versioning, in particular).
secs - seconds since epoch
nsecs - nanoseconds
Returns:
0 for success or -1 for error.

Definition at line 316 of file ccn_buf_encoder.c.

Referenced by ccn_create_version(), and ccnb_append_now_blob().

int ccnb_element_begin ( struct ccn_charbuf c,
enum ccn_dtag  dtag 
)

Append a start-of-element marker.

Definition at line 369 of file ccn_buf_encoder.c.

Referenced by ccnb_append_face_instance(), ccnb_append_forwarding_entry(), and ccnb_append_header().

int ccnb_element_end ( struct ccn_charbuf c  ) 

Append an end-of-element marker.

This is the same as ccn_charbuf_append_closer()

Definition at line 379 of file ccn_buf_encoder.c.

Referenced by ccn_append_link_stuff(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), and ccnb_append_header().

int ccnb_tagged_putf ( struct ccn_charbuf c,
enum ccn_dtag  dtag,
const char *  fmt,
  ... 
)

Append a tagged UDATA string, with printf-style formatting.

This is a ccnb-encoded element with containing UDATA as content.

Parameters:
c is the buffer to append to.
dtag is the element's dtab.
fmt is a printf-style format string, followed by its values
Returns:
0 for success or -1 for error.

Definition at line 421 of file ccn_buf_encoder.c.

Referenced by answer_highest(), answer_passive(), ccn_encode_StatusResponse(), ccn_signed_info_create(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), ccnb_append_header(), initialize_global_data(), local_scope_rm_template(), main(), make_template(), and stuff_link_check().

Generated on Fri May 13 16:27:14 2011 for Content-Centric Networking in C by  doxygen 1.6.3