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_indexbuf * | ccn_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_charbuf * | ccn_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. |
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 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, | |||
e | ) | (h->err = (e), h->errline = __LINE__, ccn_note_err(h)) |
Definition at line 106 of file ccn_client.c.
Referenced by ccn_chk_signing_params(), ccn_connect(), ccn_construct_interest(), ccn_get_public_key(), ccn_load_default_key(), ccn_locate_key(), ccn_put(), ccn_run(), ccn_sign_content(), handle_ccndid_response(), handle_key(), and handle_prefix_reg_reply().
#define NOTE_ERRNO | ( | h | ) | NOTE_ERR(h, errno) |
Definition at line 107 of file ccn_client.c.
Referenced by ccn_cache_key(), ccn_chk_signing_params(), ccn_connect(), ccn_create(), ccn_disconnect(), ccn_express_interest(), ccn_initiate_key_fetch(), ccn_initiate_prefix_reg(), ccn_load_private_key(), ccn_locate_key(), ccn_process_input(), ccn_pushout(), ccn_put(), ccn_run(), ccn_set_interest_filter_with_flags(), and handle_ccndid_response().
#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) |
Definition at line 112 of file ccn_client.c.
Referenced by ccn_locate_key(), and handle_prefix_reg_reply().
static void ccn_age_interest | ( | struct ccn * | h, | |
struct expressed_interest * | interest, | |||
const unsigned char * | key, | |||
size_t | keysize | |||
) | [static] |
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] |
void ccn_check_interests | ( | struct expressed_interest * | list | ) |
Definition at line 419 of file ccn_client.c.
Referenced by ccn_clean_interests_by_prefix(), and ccn_process_scheduled_operations().
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] |
void ccn_clean_interests_by_prefix | ( | struct ccn * | h, | |
struct interests_by_prefix * | entry | |||
) |
int ccn_connect | ( | struct ccn * | h, | |
const char * | name | |||
) |
Connect to local ccnd.
h | is a ccn library handle | |
name | is the name of the unix-domain socket to connect to; use NULL to get the default. |
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] |
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.
defer | is 0 to verify, 1 to defer, -1 to leave unchanged. |
Definition at line 302 of file ccn_client.c.
Referenced by getFile(), main(), r_init_create(), and SyncInit().
void ccn_destroy | ( | struct ccn ** | hp | ) |
Definition at line 452 of file ccn_client.c.
Referenced by ccn_fetch_destroy(), ccn_fetch_new(), ccn_get(), ccnd_internal_client_start(), ccnd_internal_client_stop(), ccnr_direct_client_start(), ccnr_direct_client_stop(), ccnr_internal_client_start(), ccnr_internal_client_stop(), existingRootOp(), getFile(), main(), putFile(), and sendSlice().
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 | ) |
Definition at line 357 of file ccn_client.c.
Referenced by ccn_destroy(), ccn_fetch_destroy(), ccn_process_input(), ccn_run(), main(), r_init_create(), and r_io_shutdown_client_fd().
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.
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 | |||
) |
Definition at line 574 of file ccn_client.c.
Referenced by ask_more(), ccn_get(), ccn_initiate_ccndid_fetch(), ccn_initiate_key_fetch(), ccn_initiate_prefix_reg(), express_bulkdata_interest(), express_my_interest(), fill_holes(), handle_key(), incoming_content(), main(), NeedSegment(), r_proto_expect_content(), r_proto_initiate_key_fetch(), r_proto_start_write(), SyncSendRootAdviseInterest(), SyncStartContentFetch(), and SyncStartNodeFetch().
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.
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. |
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 | ) |
Definition at line 351 of file ccn_client.c.
Referenced by ccnr_direct_client_refresh(), main(), r_dispatch_run(), r_init_create(), r_proto_answer_req(), r_proto_expect_content(), and r_sync_upcall_store().
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.
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.
h | is the ccn handle - may be NULL. |
Definition at line 187 of file ccn_client.c.
struct ccn_charbuf* ccn_grab_buffered_output | ( | struct ccn * | h | ) | [read] |
Definition at line 752 of file ccn_client.c.
Referenced by process_internal_client_buffer(), and r_dispatch_process_internal_client_buffer().
static void ccn_gripe | ( | struct expressed_interest * | i | ) | [static] |
Definition at line 376 of file ccn_client.c.
Referenced by ccn_age_interest(), ccn_check_interests(), ccn_destroy_interest(), ccn_dispatch_message(), ccn_refresh_interest(), and replace_interest_msg().
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] |
static int ccn_initiate_key_fetch | ( | struct ccn * | h, | |
unsigned char * | msg, | |||
struct ccn_parsed_ContentObject * | pco, | |||
struct expressed_interest * | trigger_interest | |||
) | [static] |
static void ccn_initiate_prefix_reg | ( | struct ccn * | h, | |
const void * | prefix, | |||
size_t | prefix_size, | |||
struct interest_filter * | i | |||
) | [static] |
int ccn_is_final_block | ( | struct ccn_upcall_info * | info | ) |
Check whether content described by info is final block.
info | - the ccn_upcall_info describing the ContentObject |
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.
h | is the ccn handle | |
keystore_path | is the pathname of the keystore file | |
keystore_passphrase | is the passphase needed to unlock the keystore |
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.
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 |
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.
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] |
static void ccn_notify_ccndid_changed | ( | struct ccn * | h | ) | [static] |
int ccn_output_is_pending | ( | struct ccn * | h | ) |
Definition at line 746 of file ccn_client.c.
Referenced by ccn_grab_buffered_output(), ccn_process_scheduled_operations(), ccn_run(), and r_io_prepare_poll_fds().
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.
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] |
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.
h | is the ccn handle. |
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 | |||
) |
Definition at line 702 of file ccn_client.c.
Referenced by ccn_refresh_interest(), ccn_seqw_write(), ccnd_answer_req(), ccnr_answer_req(), incoming_interest(), interest_handler(), localStore(), main(), outgoing_content(), r_io_send(), r_proto_begin_enumeration(), r_proto_bulk_import(), r_proto_continue_enumeration(), r_proto_start_write(), r_proto_start_write_checked(), seqw_incoming_interest(), storeHandler(), and SyncInterestArrived().
static void ccn_refresh_interest | ( | struct ccn * | h, | |
struct expressed_interest * | interest | |||
) | [static] |
Definition at line 763 of file ccn_client.c.
Referenced by ccn_age_interest(), ccn_check_pub_arrival(), ccn_dispatch_message(), and ccn_express_interest().
static void ccn_replace_handler | ( | struct ccn * | h, | |
struct ccn_closure ** | dstp, | |||
struct ccn_closure * | src | |||
) | [static] |
Definition at line 216 of file ccn_client.c.
Referenced by ccn_destroy(), ccn_destroy_interest(), ccn_dispatch_message(), ccn_express_interest(), ccn_process_scheduled_operations(), and ccn_set_interest_filter_with_flags().
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.
h | is the ccn handle. | |
timeout | is in milliseconds. |
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 | |||
) |
Definition at line 672 of file ccn_client.c.
Referenced by ccn_seqw_close(), ccn_seqw_create(), ccnd_uri_listen(), ccnr_uri_listen(), main(), putFile(), r_proto_uri_listen(), and SyncRegisterInterest().
int ccn_set_interest_filter_with_flags | ( | struct ccn * | h, | |
struct ccn_charbuf * | namebuf, | |||
struct ccn_closure * | action, | |||
int | forw_flags | |||
) |
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.
h | is the ccn handle. | |
timeout | is in milliseconds. |
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.
h | is the ccn handle - may be NULL. | |
error_code | is the code to set. |
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.
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 |
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] |
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.
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] |
static void finalize_keystore | ( | struct hashtb_enumerator * | e | ) | [static] |
static void finalize_pkey | ( | struct hashtb_enumerator * | e | ) | [static] |
static enum ccn_upcall_res handle_ccndid_response | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) | [static] |
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] |
static enum ccn_upcall_res handle_simple_incoming_content | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) | [static] |
static void replace_interest_msg | ( | struct expressed_interest * | interest, | |
struct ccn_charbuf * | cb | |||
) | [static] |
Definition at line 382 of file ccn_client.c.
Referenced by ccn_construct_interest(), ccn_destroy_interest(), ccn_dispatch_message(), and ccn_process_scheduled_operations().
static int tv_earlier | ( | const struct timeval * | a, | |
const struct timeval * | b | |||
) | [static] |