ccn_client.c File Reference

Support for ccn clients. More...

Go to the source code of this file.

Defines

#define CCN_FORW_WAITING_CCNDID   (1<<30)
#define NOTE_ERR(h, e)   (h->err = (e), h->errline = __LINE__, ccn_note_err(h))
#define NOTE_ERRNO(h)   NOTE_ERR(h, errno)
#define THIS_CANNOT_HAPPEN(h)   do { NOTE_ERR(h, -73); ccn_perror(h, "Can't happen");} while (0)
#define XXX   do { NOTE_ERR(h, -76); ccn_perror(h, "Please write some more code here"); } while (0)
#define CCN_MAX_KEY_LINK_CHAIN   7
 This is the maximum number of links in we are willing to traverse when resolving a key locator.

Functions

static void ccn_refresh_interest (struct ccn *, struct expressed_interest *)
static void ccn_initiate_prefix_reg (struct ccn *, const void *, size_t, struct interest_filter *)
static void finalize_pkey (struct hashtb_enumerator *e)
static void finalize_keystore (struct hashtb_enumerator *e)
static int ccn_pushout (struct ccn *h)
static int tv_earlier (const struct timeval *a, const struct timeval *b)
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.
static int ccn_note_err (struct ccn *h)
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.
static struct ccn_indexbufccn_indexbuf_obtain (struct ccn *h)
static void ccn_indexbuf_release (struct ccn *h, struct ccn_indexbuf *c)
static void ccn_replace_handler (struct ccn *h, struct ccn_closure **dstp, struct ccn_closure *src)
struct ccn * ccn_create (void)
 Create a client handle.
int ccn_defer_verification (struct ccn *h, int defer)
 Tell the library to defer verification.
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)
static void ccn_gripe (struct expressed_interest *i)
static void replace_interest_msg (struct expressed_interest *interest, struct ccn_charbuf *cb)
static struct expressed_interest * ccn_destroy_interest (struct ccn *h, struct expressed_interest *i)
void ccn_check_interests (struct expressed_interest *list)
void ccn_clean_interests_by_prefix (struct ccn *h, struct interests_by_prefix *entry)
void ccn_destroy (struct ccn **hp)
static int ccn_check_namebuf (struct ccn *h, struct ccn_charbuf *namebuf, int prefix_comps, int omit_possible_digest)
static void ccn_construct_interest (struct ccn *h, struct ccn_charbuf *name_prefix, struct ccn_charbuf *interest_template, struct expressed_interest *dest)
int ccn_express_interest (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action, struct ccn_charbuf *interest_template)
static void finalize_interest_filter (struct hashtb_enumerator *e)
int ccn_set_interest_filter_with_flags (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action, int forw_flags)
int ccn_set_interest_filter (struct ccn *h, struct ccn_charbuf *namebuf, struct ccn_closure *action)
int ccn_put (struct ccn *h, const void *p, size_t length)
int ccn_output_is_pending (struct ccn *h)
struct ccn_charbufccn_grab_buffered_output (struct ccn *h)
static int ccn_get_content_type (const unsigned char *ccnb, const struct ccn_parsed_ContentObject *pco)
static void ccn_digest_Content (const unsigned char *content_object, struct ccn_parsed_ContentObject *pc, unsigned char *digest, size_t digest_bytes)
 Compute the digest of just the Content portion of content_object.
static int ccn_cache_key (struct ccn *h, const unsigned char *ccnb, size_t size, struct ccn_parsed_ContentObject *pco)
static int ccn_locate_key (struct ccn *h, const unsigned char *msg, struct ccn_parsed_ContentObject *pco, struct ccn_pkey **pubkey)
 Examine a ContentObject and try to find the public key needed to verify it.
static int ccn_append_link_name (struct ccn_charbuf *name, const unsigned char *data, size_t data_size)
 Get the name out of a Link.
static enum ccn_upcall_res handle_key (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
 Called when we get an answer to a KeyLocator fetch issued by ccn_initiate_key_fetch.
static int ccn_initiate_key_fetch (struct ccn *h, unsigned char *msg, struct ccn_parsed_ContentObject *pco, struct expressed_interest *trigger_interest)
static void ccn_check_pub_arrival (struct ccn *h, struct expressed_interest *interest)
 If we were waiting for a key and it has arrived, refresh the interest.
void ccn_dispatch_message (struct ccn *h, unsigned char *msg, size_t size)
 Dispatch a message through the registered upcalls.
static int ccn_process_input (struct ccn *h)
static void ccn_update_refresh_us (struct ccn *h, struct timeval *tv)
static void ccn_age_interest (struct ccn *h, struct expressed_interest *interest, const unsigned char *key, size_t keysize)
static void ccn_clean_all_interests (struct ccn *h)
static void ccn_notify_ccndid_changed (struct ccn *h)
int ccn_process_scheduled_operations (struct ccn *h)
 Process any scheduled operations that are due.
int ccn_set_run_timeout (struct ccn *h, int timeout)
 Modify ccn_run timeout.
int ccn_run (struct ccn *h, int timeout)
 Run the ccn client event loop.
static enum ccn_upcall_res handle_simple_incoming_content (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
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.
static enum ccn_upcall_res handle_ccndid_response (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static void ccn_initiate_ccndid_fetch (struct ccn *h)
static enum ccn_upcall_res handle_prefix_reg_reply (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
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.
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_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_is_final_block (struct ccn_upcall_info *info)
 Check whether content described by info is final block.


Detailed Description

Support for ccn 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_client.c.


Define Documentation

#define CCN_FORW_WAITING_CCNDID   (1<<30)

Definition at line 99 of file ccn_client.c.

Referenced by ccn_initiate_prefix_reg(), and ccn_notify_ccndid_changed().

#define CCN_MAX_KEY_LINK_CHAIN   7

This is the maximum number of links in we are willing to traverse when resolving a key locator.

Definition at line 1091 of file ccn_client.c.

Referenced by ccn_initiate_key_fetch().

#define NOTE_ERR ( h,
 )     (h->err = (e), h->errline = __LINE__, ccn_note_err(h))

#define NOTE_ERRNO (  )     NOTE_ERR(h, errno)

#define THIS_CANNOT_HAPPEN (  )     do { NOTE_ERR(h, -73); ccn_perror(h, "Can't happen");} while (0)

Definition at line 109 of file ccn_client.c.

Referenced by ccn_locate_key().

#define XXX   do { NOTE_ERR(h, -76); ccn_perror(h, "Please write some more code here"); } while (0)

Definition at line 112 of file ccn_client.c.

Referenced by ccn_locate_key(), and handle_prefix_reg_reply().


Function Documentation

static void ccn_age_interest ( struct ccn *  h,
struct expressed_interest *  interest,
const unsigned char *  key,
size_t  keysize 
) [static]

Definition at line 1378 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().

static int ccn_append_link_name ( struct ccn_charbuf name,
const unsigned char *  data,
size_t  data_size 
) [static]

Get the name out of a Link.

XXX - this needs a better home.

Definition at line 990 of file ccn_client.c.

Referenced by handle_key().

static int ccn_cache_key ( struct ccn *  h,
const unsigned char *  ccnb,
size_t  size,
struct ccn_parsed_ContentObject pco 
) [static]

Definition at line 832 of file ccn_client.c.

Referenced by ccn_dispatch_message().

void ccn_check_interests ( struct expressed_interest *  list  ) 

static int ccn_check_namebuf ( struct ccn *  h,
struct ccn_charbuf namebuf,
int  prefix_comps,
int  omit_possible_digest 
) [static]

Definition at line 496 of file ccn_client.c.

Referenced by ccn_express_interest(), and ccn_set_interest_filter_with_flags().

static void ccn_check_pub_arrival ( struct ccn *  h,
struct expressed_interest *  interest 
) [static]

If we were waiting for a key and it has arrived, refresh the interest.

Definition at line 1170 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().

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 2142 of file ccn_client.c.

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

static void ccn_clean_all_interests ( struct ccn *  h  )  [static]

Definition at line 1448 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().

void ccn_clean_interests_by_prefix ( struct ccn *  h,
struct interests_by_prefix *  entry 
)

Definition at line 431 of file ccn_client.c.

Referenced by ccn_clean_all_interests().

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 322 of file ccn_client.c.

Referenced by ccn_fetch_new(), ccn_get(), existingRootOp(), getFile(), main(), putFile(), r_init_create(), and sendSlice().

static void ccn_construct_interest ( struct ccn *  h,
struct ccn_charbuf name_prefix,
struct ccn_charbuf interest_template,
struct expressed_interest *  dest 
) [static]

Definition at line 532 of file ccn_client.c.

Referenced by ccn_express_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 240 of file ccn_client.c.

Referenced by ccn_fetch_new(), ccn_get(), ccnd_internal_client_start(), ccnr_direct_client_start(), ccnr_internal_client_start(), existingRootOp(), getFile(), main(), putFile(), and sendSlice().

int ccn_defer_verification ( struct ccn *  h,
int  defer 
)

Tell the library to defer verification.

For some specialized applications (performance testing being an example), the normal verification done within the library may be undesirable. Setting the "defer validation" flag will cause the library to pass content to the application without attempting to verify it. In this case, the CCN_UPCALL_CONTENT_RAW upcall kind will be passed instead of CCN_UPCALL_CONTENT, and CCN_UPCALL_CONTENT_KEYMISSING instead of CCN_UPCALL_CONTENT_UNVERIFIED. If the application wants do still do key fetches, it may use the CCN_UPCALL_RESULT_FETCHKEY response instead of CCN_UPCALL_RESULT_VERIFY.

Calling this while there are interests outstanding is not recommended.

This call is available beginning with CCN_API_VERSION 4004.

Parameters:
defer is 0 to verify, 1 to defer, -1 to leave unchanged.
Returns:
previous value, or -1 in case of error.

Definition at line 302 of file ccn_client.c.

Referenced by getFile(), main(), r_init_create(), and SyncInit().

void ccn_destroy ( struct ccn **  hp  ) 

static struct expressed_interest* ccn_destroy_interest ( struct ccn *  h,
struct expressed_interest *  i 
) [static, read]

Definition at line 403 of file ccn_client.c.

Referenced by ccn_clean_interests_by_prefix(), and ccn_destroy().

static void ccn_digest_Content ( const unsigned char *  content_object,
struct ccn_parsed_ContentObject pc,
unsigned char *  digest,
size_t  digest_bytes 
) [static]

Compute the digest of just the Content portion of content_object.

Definition at line 804 of file ccn_client.c.

Referenced by ccn_cache_key().

int ccn_disconnect ( struct ccn *  h  ) 

void ccn_dispatch_message ( struct ccn *  h,
unsigned char *  msg,
size_t  size 
)

Dispatch a message through the registered upcalls.

This is not used by normal ccn clients, but is made available for use when ccnd needs to communicate with its internal client.

Parameters:
h is the ccn handle.
msg is the ccnb-encoded Interest or ContentObject.
size is its size in bytes.

Definition at line 1191 of file ccn_client.c.

Referenced by ccn_process_input(), ccnd_send(), and r_io_send().

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

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 1697 of file ccn_client.c.

Referenced by ccn_get_header(), ccn_resolve_version(), create_face(), existingRootOp(), get_ccndid(), getFile(), localStore(), main(), putFile(), and register_unregister_prefix().

int ccn_get_connection_fd ( struct ccn *  h  ) 

static int ccn_get_content_type ( const unsigned char *  ccnb,
const struct ccn_parsed_ContentObject pco 
) [static]

Definition at line 782 of file ccn_client.c.

Referenced by ccn_cache_key(), ccn_dispatch_message(), and handle_key().

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 2090 of file ccn_client.c.

Referenced by ccnd_init_service_ccnb(), ccnr_init_policy_cob(), ccnr_init_policy_link_cob(), and ccnr_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 187 of file ccn_client.c.

struct ccn_charbuf* ccn_grab_buffered_output ( struct ccn *  h  )  [read]

static void ccn_gripe ( struct expressed_interest *  i  )  [static]

static struct ccn_indexbuf* ccn_indexbuf_obtain ( struct ccn *  h  )  [static, read]

Definition at line 195 of file ccn_client.c.

Referenced by ccn_age_interest(), and ccn_dispatch_message().

static void ccn_indexbuf_release ( struct ccn *  h,
struct ccn_indexbuf c 
) [static]

Definition at line 206 of file ccn_client.c.

Referenced by ccn_age_interest(), and ccn_dispatch_message().

static void ccn_initiate_ccndid_fetch ( struct ccn *  h  )  [static]

Definition at line 1805 of file ccn_client.c.

Referenced by ccn_initiate_prefix_reg().

static int ccn_initiate_key_fetch ( struct ccn *  h,
unsigned char *  msg,
struct ccn_parsed_ContentObject pco,
struct expressed_interest *  trigger_interest 
) [static]

Definition at line 1095 of file ccn_client.c.

Referenced by ccn_dispatch_message().

static void ccn_initiate_prefix_reg ( struct ccn *  h,
const void *  prefix,
size_t  prefix_size,
struct interest_filter i 
) [static]

Definition at line 1881 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().

int ccn_is_final_block ( struct ccn_upcall_info info  ) 

Check whether content described by info is final block.

Parameters:
info - the ccn_upcall_info describing the ContentObject
Returns:
1 for final block, 0 for not final, -1 if an error occurs

Definition at line 2391 of file ccn_client.c.

Referenced by r_proto_expect_content().

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 2052 of file ccn_client.c.

Referenced by ccnd_init_internal_keystore(), and ccnr_init_repo_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 1987 of file ccn_client.c.

Referenced by ccn_chk_signing_params(), and ccn_load_default_key().

static int ccn_locate_key ( struct ccn *  h,
const unsigned char *  msg,
struct ccn_parsed_ContentObject pco,
struct ccn_pkey **  pubkey 
) [static]

Examine a ContentObject and try to find the public key needed to verify it.

It might be present in our cache of keys, or in the object itself; in either of these cases, we can satisfy the request right away. Or there may be an indirection (a KeyName), in which case return without the key. The final possibility is that there is no key locator we can make sense of.

Returns:
negative for error, 0 when pubkey is filled in, or 1 if the key needs to be requested.

Definition at line 899 of file ccn_client.c.

Referenced by ccn_dispatch_message(), and ccn_verify_content().

static int ccn_note_err ( struct ccn *  h  )  [static]

Definition at line 156 of file ccn_client.c.

Referenced by ccn_seterror().

static void ccn_notify_ccndid_changed ( struct ccn *  h  )  [static]

Definition at line 1465 of file ccn_client.c.

Referenced by handle_ccndid_response().

int ccn_output_is_pending ( struct ccn *  h  ) 

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 141 of file ccn_client.c.

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

static int ccn_process_input ( struct ccn *  h  )  [static]

Definition at line 1314 of file ccn_client.c.

Referenced by ccn_run().

int ccn_process_scheduled_operations ( struct ccn *  h  ) 

Process any scheduled operations that are due.

This is not used by normal ccn clients, but is made available for use by ccnd to run its internal client.

Parameters:
h is the ccn handle.
Returns:
the number of microseconds until the next thing needs to happen.

Definition at line 1489 of file ccn_client.c.

Referenced by ccn_run(), ccnd_internal_client_refresh(), ccnr_direct_client_refresh(), ccnr_internal_client_refresh(), and r_dispatch_run().

static int ccn_pushout ( struct ccn *  h  )  [static]

Definition at line 680 of file ccn_client.c.

Referenced by ccn_disconnect(), ccn_put(), and ccn_run().

int ccn_put ( struct ccn *  h,
const void *  p,
size_t  length 
)

static void ccn_refresh_interest ( struct ccn *  h,
struct expressed_interest *  interest 
) [static]

static void ccn_replace_handler ( struct ccn *  h,
struct ccn_closure **  dstp,
struct ccn_closure src 
) [static]

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 1566 of file ccn_client.c.

Referenced by ccn_dump_names(), ccn_fetch_poll(), ccn_get(), getFile(), main(), putFile(), r_dispatch_process_input(), and r_link_do_deferred_write().

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 
)

Definition at line 641 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 1550 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 170 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 2301 of file ccn_client.c.

Referenced by ccn_initiate_prefix_reg(), ccnd_answer_req(), ccnd_init_service_ccnb(), ccnr_answer_req(), ccnr_init_policy_cob(), ccnr_init_policy_link_cob(), ccnr_init_service_ccnb(), create_face(), localStore(), main(), r_proto_bulk_import(), r_proto_continue_enumeration(), r_proto_start_write(), r_proto_start_write_checked(), register_unregister_prefix(), seqw_next_cob(), storeHandler(), and SyncSignBuf().

static void ccn_update_refresh_us ( struct ccn *  h,
struct timeval *  tv 
) [static]

Definition at line 1362 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().

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 1958 of file ccn_client.c.

Referenced by ccnd_answer_req(), ccnr_answer_req(), handle_ccndid_response(), handle_prefix_reg_reply(), and SyncLocalRepoFetch().

static void finalize_interest_filter ( struct hashtb_enumerator e  )  [static]

Definition at line 631 of file ccn_client.c.

Referenced by ccn_set_interest_filter_with_flags().

static void finalize_keystore ( struct hashtb_enumerator e  )  [static]

Definition at line 2074 of file ccn_client.c.

Referenced by ccn_create().

static void finalize_pkey ( struct hashtb_enumerator e  )  [static]

Definition at line 881 of file ccn_client.c.

Referenced by ccn_create().

static enum ccn_upcall_res handle_ccndid_response ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Definition at line 1758 of file ccn_client.c.

Referenced by ccn_initiate_ccndid_fetch().

static enum ccn_upcall_res handle_key ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Called when we get an answer to a KeyLocator fetch issued by ccn_initiate_key_fetch.

This does not really have to do much, since the main content handling logic picks up the keys as they go by.

Definition at line 1019 of file ccn_client.c.

Referenced by ccn_initiate_key_fetch().

static enum ccn_upcall_res handle_prefix_reg_reply ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Definition at line 1819 of file ccn_client.c.

Referenced by ccn_initiate_prefix_reg().

static enum ccn_upcall_res handle_simple_incoming_content ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Definition at line 1634 of file ccn_client.c.

Referenced by ccn_get().

static void replace_interest_msg ( struct expressed_interest *  interest,
struct ccn_charbuf cb 
) [static]

static int tv_earlier ( const struct timeval *  a,
const struct timeval *  b 
) [static]

Definition at line 124 of file ccn_client.c.

Referenced by ccn_process_scheduled_operations().


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