ccn_sync.c File Reference

Go to the source code of this file.

Defines

#define CCNL_NONE   0
 No logging at all.
#define CCNL_SEVERE   3
 Severe errors.
#define CCNL_ERROR   5
 Configuration errors.
#define CCNL_WARNING   7
 Something might be wrong.
#define CCNL_INFO   9
 Low-volume informational.
#define CCNL_FINE   11
 Debugging.
#define CCNL_FINER   13
 More debugging.
#define CCNL_FINEST   15
 MORE DEBUGGING YET.
#define CACHE_PURGE_TRIGGER   60
#define CACHE_CLEAN_BATCH   16
#define CACHE_CLEAN_DELTA   8
#define ADVISE_NEED_RESET   1
#define UPDATE_STALL_DELTA   15
#define UPDATE_NEED_DELTA   6
#define SHORT_DELAY_MICROS   500
#define COMPARE_ASSUME_BAD   20
#define NODE_SPLIT_TRIGGER   400
#define EXCLUSION_LIMIT   1000
#define EXCLUSION_TRIG   5
#define STABLE_TIME_TRIG   10
#define HASH_SPLIT_TRIGGER   17
#define NAMES_YIELD_INC   100
#define NAMES_YIELD_MICROS   20*1000
#define CCNS_FLAGS_SC   1
#define extern
#define SYNCLIBRARY
#define ccnr_msg   ccns_msg
#define ccnr_hwm_update   ccns_hwm_update

Enumerations

enum  SyncCompareState {
  SyncCompare_init, SyncCompare_preload, SyncCompare_busy, SyncCompare_waiting,
  SyncCompare_done, SyncCompare_init, SyncCompare_preload, SyncCompare_busy,
  SyncCompare_waiting, SyncCompare_done
}

Functions

static ccnr_hwm ccns_hwm_update (struct ccnr_handle *ccnr, ccnr_hwm hwm, ccnr_accession a)
static uintmax_t ccns_accession_encode (struct ccnr_handle *ccnr, ccnr_accession a)
struct ccns_slice * ccns_slice_create ()
 Allocate a ccns_slice structure.
void ccns_slice_destroy (struct ccns_slice **sp)
 Deallocate a ccns_slice structure.
int ccns_slice_add_clause (struct ccns_slice *s, struct ccn_charbuf *c)
 Add a (filter) clause to a ccns_slice structure.
int ccns_slice_set_topo_prefix (struct ccns_slice *s, struct ccn_charbuf *t, struct ccn_charbuf *p)
static int append_slice (struct ccn_charbuf *c, struct ccns_slice *s)
static int slice_parse (struct ccns_slice *s, const unsigned char *p, size_t size)
int ccns_slice_name (struct ccn_charbuf *nm, struct ccns_slice *s)
 Construct the name of a Sync configuration slice based on the parameters.
int ccns_read_slice (struct ccn *h, struct ccn_charbuf *name, struct ccns_slice *slice)
 Read a slice (from a repository) given the name.
struct ccn_charbufmake_scope1_template (void)
static enum ccn_upcall_res write_interest_handler (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static int write_slice (struct ccn *h, struct ccns_slice *slice, struct ccn_charbuf *name)
int ccns_write_slice (struct ccn *h, struct ccns_slice *slice, struct ccn_charbuf *name)
 Write a ccns_slice object to a repository.
int ccns_delete_slice (struct ccn *h, struct ccn_charbuf *name)
 Delete a ccns_slice object from a repository.
static void gettime (const struct ccn_gettime *self, struct ccn_timeval *result)
static int HeartbeatAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
static int ccns_send_root_advise_interest (struct SyncRootStruct *root)
struct ccns_handle * ccns_open (struct ccn *h, struct ccns_slice *slice, ccns_callback callback, struct ccn_charbuf *rhash, struct ccn_charbuf *pname)
 Start notification of addition of names to a sync slice.
void ccns_close (struct ccns_handle **ccnsp, struct ccn_charbuf *rhash, struct ccn_charbuf *pname)
 Stop notification of changes of names in a sync slice and free the handle.
void ccns_msg (struct ccnr_handle *h, const char *fmt,...)
static void delinkActionData (struct SyncActionData *data)
static int moveActionData (struct SyncActionData *data, enum SyncActionState dstState)
static struct SyncActionDatadestroyActionData (struct SyncActionData *data)
static struct SyncActionDatanewActionData (enum SyncRegisterActionKind kind)
static void linkActionData (struct SyncRootStruct *root, struct SyncActionData *data)
static void setCovered (struct SyncHashCacheEntry *ce)
static int isCovered (struct SyncHashCacheEntry *ce)
static int compareHash (struct ccn_charbuf *hashX, struct ccn_charbuf *hashY)
static struct SyncActionDataSyncFindAction (struct SyncRootStruct *root, enum SyncRegisterActionKind kind)
int SyncAddName (struct SyncBaseStruct *base, struct ccn_charbuf *name, ccnr_accession item)
 Adds the given name to any applicable roots.
static struct SyncNodeCompositeextractNode (struct SyncRootStruct *root, struct ccn_upcall_info *info)
static int noteRemoteHash (struct SyncRootStruct *root, struct SyncHashCacheEntry *ce, int add)
static char * getCmdStr (enum SyncRegisterActionKind kind)
static struct SyncNameAccumsortNames (struct SyncRootStruct *root, struct SyncNameAccum *src)
static struct SyncNameAccumexclusionsFromHashList (struct SyncRootStruct *root, struct SyncHashInfoList *list)
static struct ccn_charbufconstructCommandPrefix (struct SyncRootStruct *root, enum SyncRegisterActionKind kind)
enum ccn_upcall_res ccns_root_advise_response (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static int CompareAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
static struct SyncHashInfoListchooseRemoteHash (struct SyncRootStruct *root)
static void destroyCompareData (struct SyncCompareData *data)
static void abortCompare (struct SyncCompareData *data, char *why)
static int comparisonFailed (struct SyncCompareData *data, char *why, int line)
static int extractBuf (struct ccn_charbuf *cb, struct SyncNodeComposite *nc, struct SyncNodeElem *ne)
static struct SyncHashCacheEntryensureRemoteEntry (struct SyncCompareData *data, const unsigned char *xp, ssize_t xs)
static struct SyncHashCacheEntrycacheEntryForElem (struct SyncCompareData *data, struct SyncNodeComposite *nc, struct SyncNodeElem *ne, int remote)
static void kickCompare (struct SyncCompareData *scd, struct SyncActionData *action)
enum ccn_upcall_res SyncRemoteFetchResponse (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
int SyncStartNodeFetch (struct SyncRootStruct *root, struct SyncHashCacheEntry *ce, struct SyncCompareData *comp)
 starts a remote fetch of the given node, based on the hash comp may be NULL if this is not for a compare
static int doPreload (struct SyncCompareData *data, struct SyncTreeWorkerHead *twHead)
static int addNameFromCompare (struct SyncCompareData *data)
static int doComparison (struct SyncCompareData *data)
int SyncStartCompareAction (struct SyncRootStruct *root, struct ccn_charbuf *hashR)
 initiates a compare action with the given remote hash
enum ccn_upcall_res SyncInterestArrived (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
int SyncRegisterInterests (struct SyncRootStruct *root)
 registers interests associated with the given root these include C1.S.RA (Root Advise) and C1.S.NF (Node Fetch) interests additional interests may be registered as the protocol evolves
int SyncHandleSlice (struct SyncBaseStruct *base, struct ccn_charbuf *name)
 Creates a new slice from a full name.
int SyncStartSliceEnum (struct SyncRootStruct *root)
 starts a slice enumeration for the root
int SyncStartHeartbeat (struct SyncBaseStruct *base)
 starts a periodic wakeup that maintains state across all roots
static int r_sync_lookup (struct ccnr_handle *ccnr, struct ccn_charbuf *interest, struct ccn_charbuf *content_ccnb)
static int r_sync_local_store (struct ccnr_handle *ccnr, struct ccn_charbuf *content)
 Called when a content object has been constructed locally by sync and needs to be committed to stable storage by the repo.

Define Documentation

#define ADVISE_NEED_RESET   1

Definition at line 51 of file ccn_sync.c.

Referenced by SyncInterestArrived().

#define CACHE_CLEAN_BATCH   16

Definition at line 49 of file ccn_sync.c.

#define CACHE_CLEAN_DELTA   8

Definition at line 50 of file ccn_sync.c.

#define CACHE_PURGE_TRIGGER   60

Definition at line 48 of file ccn_sync.c.

#define CCNL_ERROR   5
#define CCNL_FINE   11
#define CCNL_FINER   13
#define CCNL_FINEST   15
#define CCNL_INFO   9
#define CCNL_NONE   0

No logging at all.

Definition at line 39 of file ccn_sync.c.

Referenced by ccnr_msg_level_from_string().

#define CCNL_SEVERE   3
#define CCNL_WARNING   7
#define ccnr_hwm_update   ccns_hwm_update

Definition at line 2538 of file ccn_sync.c.

Referenced by SyncAddName(), and SyncNotifyContent().

#define ccnr_msg   ccns_msg

Definition at line 2537 of file ccn_sync.c.

Referenced by abortCompare(), ccnr_close_fd(), ccnr_collect_stats(), ccnr_debug_ccnb(), ccnr_debug_content(), ccnr_direct_client_refresh(), ccnr_init_repo_keystore(), ccnr_stats_http_set_debug(), cleanup_se(), CompareAction(), content_sender(), establish_min_send_bufsize(), findAndDeleteRoot(), handle_send_error(), HeartbeatAction(), load_policy(), main(), merge_files(), newNodeCommon(), nodeFromNodes(), noteHash(), process_input_buffer(), process_input_message(), r_dispatch_process_input(), r_dispatch_run(), r_init_config_msg(), r_init_confval(), r_init_create(), r_init_debug_getenv(), r_init_fail(), r_init_map_and_process_file(), r_init_parse_config(), r_io_accept_connection(), r_io_open_repo_data_file(), r_io_prepare_poll_fds(), r_io_record_fd(), r_io_send(), r_io_shutdown_client_fd(), r_link_do_deferred_write(), r_net_listen_on_address(), r_net_setsockopt_v6only(), r_proto_activate_policy(), r_proto_begin_enumeration(), r_proto_bulk_import(), r_proto_check_exclude(), r_proto_continue_enumeration(), r_proto_deactivate_policy(), r_proto_dump_enums(), r_proto_expect_content(), r_proto_policy_complete(), r_proto_policy_update(), r_proto_start_write(), r_proto_start_write_checked(), r_sendq_face_send_queue_insert(), r_store_commit_content(), r_store_content_base(), r_store_content_from_accession(), r_store_content_read(), r_store_fatal(), r_store_final(), r_store_forget_content(), r_store_index_cleaner(), r_store_index_needs_cleaning(), r_store_init(), r_store_read_stable_point(), r_store_reindexing(), r_store_set_flatname(), r_store_trim(), r_store_write_stable_point(), r_sync_enumerate(), r_sync_local_store(), r_sync_notify_content(), r_sync_upcall_store(), start_ccnr(), SyncHandleSlice(), SyncInit(), SyncNoteFailed(), SyncNoteSimple(), SyncNoteSimple2(), SyncNoteSimple3(), SyncNoteUri(), SyncNoteUriBase(), SyncNotifyContent(), SyncRegisterInterests(), SyncRootLookupName(), SyncShutdown(), SyncStartCompareAction(), SyncStartHeartbeat(), SyncUpdateRoot(), and UpdateAction().

#define CCNS_FLAGS_SC   1

Definition at line 75 of file ccn_sync.c.

Referenced by ccns_open(), and CompareAction().

#define COMPARE_ASSUME_BAD   20

Definition at line 55 of file ccn_sync.c.

#define EXCLUSION_LIMIT   1000

Definition at line 57 of file ccn_sync.c.

#define EXCLUSION_TRIG   5

Definition at line 58 of file ccn_sync.c.

#define extern

Definition at line 2535 of file ccn_sync.c.

#define HASH_SPLIT_TRIGGER   17

Definition at line 60 of file ccn_sync.c.

#define NAMES_YIELD_INC   100

Definition at line 61 of file ccn_sync.c.

#define NAMES_YIELD_MICROS   20*1000

Definition at line 62 of file ccn_sync.c.

#define NODE_SPLIT_TRIGGER   400

Definition at line 56 of file ccn_sync.c.

#define SHORT_DELAY_MICROS   500

Definition at line 54 of file ccn_sync.c.

#define STABLE_TIME_TRIG   10

Definition at line 59 of file ccn_sync.c.

#define SYNCLIBRARY

Definition at line 2536 of file ccn_sync.c.

#define UPDATE_NEED_DELTA   6

Definition at line 53 of file ccn_sync.c.

#define UPDATE_STALL_DELTA   15

Definition at line 52 of file ccn_sync.c.


Enumeration Type Documentation

Enumerator:
SyncCompare_init 
SyncCompare_preload 
SyncCompare_busy 
SyncCompare_waiting 
SyncCompare_done 
SyncCompare_init 
SyncCompare_preload 
SyncCompare_busy 
SyncCompare_waiting 
SyncCompare_done 

Definition at line 664 of file ccn_sync.c.


Function Documentation

static void abortCompare ( struct SyncCompareData *  data,
char *  why 
) [static]

Definition at line 1373 of file ccn_sync.c.

Referenced by CompareAction(), and HeartbeatAction().

static int addNameFromCompare ( struct SyncCompareData *  data  )  [static]

Definition at line 1790 of file ccn_sync.c.

Referenced by doComparison().

static int append_slice ( struct ccn_charbuf c,
struct ccns_slice *  s 
) [static]

Definition at line 179 of file ccn_sync.c.

Referenced by ccns_slice_name(), and write_slice().

static struct SyncHashCacheEntry* cacheEntryForElem ( struct SyncCompareData *  data,
struct SyncNodeComposite nc,
struct SyncNodeElem ne,
int  remote 
) [static, read]

Definition at line 1450 of file ccn_sync.c.

Referenced by doComparison(), and doPreload().

static uintmax_t ccns_accession_encode ( struct ccnr_handle ccnr,
ccnr_accession  a 
) [static]

Definition at line 2525 of file ccn_sync.c.

Referenced by SyncAddName().

void ccns_close ( struct ccns_handle **  ccnsp,
struct ccn_charbuf rhash,
struct ccn_charbuf pname 
)

Stop notification of changes of names in a sync slice and free the handle.

Parameters:
sh is a pointer (to a pointer) to the sync handle returned by ccns_open, which will be freed and set to NULL.
rhash if non-NULL will be filled in with the current root hash.
pname if non-NULL will be filled in with the starting name for enumeration within the sync tree represented by the root hash rhash.

Definition at line 632 of file ccn_sync.c.

Referenced by main().

int ccns_delete_slice ( struct ccn *  h,
struct ccn_charbuf name 
)

Delete a ccns_slice object from a repository.

Parameters:
h is the ccn_handle on which to write.
name is a pointer to a charbuf naming the slice to be deleted.
Returns:
0 on success, -1 otherwise.

Definition at line 515 of file ccn_sync.c.

Referenced by main().

static ccnr_hwm ccns_hwm_update ( struct ccnr_handle ccnr,
ccnr_hwm  hwm,
ccnr_accession  a 
) [static]

Definition at line 2531 of file ccn_sync.c.

Referenced by SyncAddName().

void ccns_msg ( struct ccnr_handle h,
const char *  fmt,
  ... 
)
struct ccns_handle* ccns_open ( struct ccn *  h,
struct ccns_slice *  slice,
ccns_callback  callback,
struct ccn_charbuf rhash,
struct ccn_charbuf pname 
) [read]

Start notification of addition of names to a sync slice.

Parameters:
h is the ccn_handle on which to communicate
slice is the slice to be opened.
callback is the procedure which will be called for each new name, and returns 0 to continue enumeration, -1 to stop further enumeration. NOTE: It is not safe to call ccns_close from within the callback.
rhash If NULL, indicates that the enumeration should start from the empty set. If non-NULL but empty, indicates that the enumeration should start from the current root. If non-NULL, and not empty, indicates that the enumeration should start from the specified root hash
pname if non-NULL represents the starting name for enumeration within the sync tree represented by the root hash rhash.
Returns:
a pointer to a new sync handle, which will be freed at close.

Definition at line 571 of file ccn_sync.c.

Referenced by main().

int ccns_read_slice ( struct ccn *  h,
struct ccn_charbuf name,
struct ccns_slice *  slice 
)

Read a slice (from a repository) given the name.

Read a slice given the name.

Parameters:
h is the ccn_handle on which to read.
name is the charbuf containing the name of the sync slice to be read.
slice is a pointer to a ccns_slice object which will be filled in on successful return.
Returns:
0 on success, -1 otherwise.

Definition at line 314 of file ccn_sync.c.

enum ccn_upcall_res ccns_root_advise_response ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Definition at line 1111 of file ccn_sync.c.

Referenced by ccns_send_root_advise_interest().

static int ccns_send_root_advise_interest ( struct SyncRootStruct root  )  [static]

Definition at line 1237 of file ccn_sync.c.

Referenced by ccns_open().

int ccns_slice_add_clause ( struct ccns_slice *  s,
struct ccn_charbuf f 
)

Add a (filter) clause to a ccns_slice structure.

Parameters:
slice is the slice to be modified
f is a filter clause ccnb-encoded as a Name
Returns:
0 on success, -1 otherwise.

Definition at line 130 of file ccn_sync.c.

Referenced by main(), and slice_parse().

struct ccns_slice* ccns_slice_create ( void   )  [read]

Allocate a ccns_slice structure.

Returns:
a pointer to a new ccns_slice structure

Definition at line 89 of file ccn_sync.c.

Referenced by main().

void ccns_slice_destroy ( struct ccns_slice **  sp  ) 

Deallocate a ccns_slice structure.

Parameters:
a pointer to a pointer to a ccns_slice structure. The pointer will be set to NULL on return.

Definition at line 109 of file ccn_sync.c.

Referenced by main().

int ccns_slice_name ( struct ccn_charbuf nm,
struct ccns_slice *  s 
)

Construct the name of a Sync configuration slice based on the parameters.

Construct the name of a Sync configuration slice.

Parameters:
nm is the ccn_charbuf which will be set to the ccnb encoded Name
s is the definition of the slice for which the name is required.
Returns:
a ccn_charbuf with the ccnb encoded Name of the slice.

Definition at line 270 of file ccn_sync.c.

Referenced by ccns_write_slice(), and main().

int ccns_slice_set_topo_prefix ( struct ccns_slice *  s,
struct ccn_charbuf t,
struct ccn_charbuf p 
)

Definition at line 160 of file ccn_sync.c.

Referenced by main().

int ccns_write_slice ( struct ccn *  h,
struct ccns_slice *  slice,
struct ccn_charbuf name 
)

Write a ccns_slice object to a repository.

Parameters:
h is the ccn_handle on which to write.
slice is a pointer to a ccns_slice object to be written.
name,if non-NULL, is a pointer to a charbuf which will be filled in with the name of the slice that was written.
Returns:
0 on success, -1 otherwise.

Definition at line 482 of file ccn_sync.c.

Referenced by main().

static struct SyncHashInfoList* chooseRemoteHash ( struct SyncRootStruct root  )  [static, read]

Definition at line 1310 of file ccn_sync.c.

Referenced by HeartbeatAction().

static int CompareAction ( struct ccn_schedule *  sched,
void *  clienth,
struct ccn_scheduled_event ev,
int  flags 
) [static]

Definition at line 2045 of file ccn_sync.c.

Referenced by kickCompare().

static int compareHash ( struct ccn_charbuf hashX,
struct ccn_charbuf hashY 
) [static]

Definition at line 833 of file ccn_sync.c.

Referenced by abortCompare(), and SyncStartNodeFetch().

static int comparisonFailed ( struct SyncCompareData *  data,
char *  why,
int  line 
) [static]

Definition at line 1418 of file ccn_sync.c.

Referenced by doComparison().

static struct ccn_charbuf* constructCommandPrefix ( struct SyncRootStruct root,
enum SyncRegisterActionKind  kind 
) [static, read]
static void delinkActionData ( struct SyncActionData data  )  [static]

Definition at line 700 of file ccn_sync.c.

Referenced by destroyActionData(), and moveActionData().

static struct SyncActionData* destroyActionData ( struct SyncActionData data  )  [static, read]
static void destroyCompareData ( struct SyncCompareData *  data  )  [static]

Definition at line 1339 of file ccn_sync.c.

Referenced by abortCompare(), and CompareAction().

static int doComparison ( struct SyncCompareData *  data  )  [static]

Definition at line 1821 of file ccn_sync.c.

Referenced by CompareAction().

static int doPreload ( struct SyncCompareData *  data,
struct SyncTreeWorkerHead twHead 
) [static]

Definition at line 1729 of file ccn_sync.c.

Referenced by CompareAction().

static struct SyncHashCacheEntry* ensureRemoteEntry ( struct SyncCompareData *  data,
const unsigned char *  xp,
ssize_t  xs 
) [static, read]

Definition at line 1434 of file ccn_sync.c.

Referenced by cacheEntryForElem().

static struct SyncNameAccum* exclusionsFromHashList ( struct SyncRootStruct root,
struct SyncHashInfoList list 
) [static, read]

Definition at line 1038 of file ccn_sync.c.

Referenced by ccns_send_root_advise_interest().

static int extractBuf ( struct ccn_charbuf cb,
struct SyncNodeComposite nc,
struct SyncNodeElem ne 
) [static]

Definition at line 1425 of file ccn_sync.c.

Referenced by doComparison().

static struct SyncNodeComposite* extractNode ( struct SyncRootStruct root,
struct ccn_upcall_info info 
) [static, read]

Definition at line 904 of file ccn_sync.c.

Referenced by ccns_root_advise_response(), and SyncRemoteFetchResponse().

static char* getCmdStr ( enum SyncRegisterActionKind  kind  )  [static]

Definition at line 983 of file ccn_sync.c.

Referenced by constructCommandPrefix().

static void gettime ( const struct ccn_gettime self,
struct ccn_timeval result 
) [static]

Definition at line 538 of file ccn_sync.c.

Referenced by ccns_open().

static int HeartbeatAction ( struct ccn_schedule *  sched,
void *  clienth,
struct ccn_scheduled_event ev,
int  flags 
) [static]

Definition at line 2272 of file ccn_sync.c.

Referenced by ccns_open().

static int isCovered ( struct SyncHashCacheEntry ce  )  [static]

Definition at line 823 of file ccn_sync.c.

Referenced by ccns_root_advise_response(), doComparison(), and SyncRemoteFetchResponse().

static void kickCompare ( struct SyncCompareData *  scd,
struct SyncActionData action 
) [static]

Definition at line 1490 of file ccn_sync.c.

Referenced by SyncRemoteFetchResponse(), and SyncStartCompareAction().

static void linkActionData ( struct SyncRootStruct root,
struct SyncActionData data 
) [static]
struct ccn_charbuf* make_scope1_template ( void   )  [read]

Definition at line 355 of file ccn_sync.c.

Referenced by write_slice().

static int moveActionData ( struct SyncActionData data,
enum SyncActionState  dstState 
) [static]

Definition at line 745 of file ccn_sync.c.

Referenced by SyncRemoteFetchResponse().

static struct SyncActionData* newActionData ( enum SyncRegisterActionKind  kind  )  [static, read]
static int noteRemoteHash ( struct SyncRootStruct root,
struct SyncHashCacheEntry ce,
int  add 
) [static]

Definition at line 933 of file ccn_sync.c.

Referenced by ccns_root_advise_response(), and SyncInterestArrived().

static int r_sync_local_store ( struct ccnr_handle ccnr,
struct ccn_charbuf content 
) [static]

Called when a content object has been constructed locally by sync and needs to be committed to stable storage by the repo.

returns 0 for success, -1 for error.

Definition at line 2516 of file ccn_sync.c.

Referenced by load_policy(), r_sync_local_store(), storeStablePoint(), and SyncLocalRepoStore().

static int r_sync_lookup ( struct ccnr_handle ccnr,
struct ccn_charbuf interest,
struct ccn_charbuf content_ccnb 
) [static]
static void setCovered ( struct SyncHashCacheEntry ce  )  [static]

Definition at line 806 of file ccn_sync.c.

Referenced by doComparison(), ensureRemoteEntry(), isCovered(), and noteRemoteHash().

static int slice_parse ( struct ccns_slice *  s,
const unsigned char *  p,
size_t  size 
) [static]

Definition at line 202 of file ccn_sync.c.

Referenced by ccns_read_slice().

static struct SyncNameAccum* sortNames ( struct SyncRootStruct root,
struct SyncNameAccum src 
) [static, read]

Definition at line 1001 of file ccn_sync.c.

Referenced by exclusionsFromHashList().

int SyncAddName ( struct SyncBaseStruct base,
struct ccn_charbuf name,
ccnr_accession  item 
)

Adds the given name to any applicable roots.

Use item == 0 to ignore accession number.

Returns:
< 0 for failure, number of additions to roots for success.

Definition at line 855 of file ccn_sync.c.

Referenced by SyncNotifyContent(), and SyncStartContentFetch().

static struct SyncActionData* SyncFindAction ( struct SyncRootStruct root,
enum SyncRegisterActionKind  kind 
) [static, read]

Definition at line 845 of file ccn_sync.c.

Referenced by ccns_send_root_advise_interest(), and SyncInterestArrived().

int SyncHandleSlice ( struct SyncBaseStruct base,
struct ccn_charbuf name 
)

Creates a new slice from a full name.

The name must start with base->priv->sliceCmdPrefix.

Returns:
< 0 if an error occurred, otherwise the new root number.

Definition at line 2481 of file ccn_sync.c.

Referenced by SyncNotifyContent().

enum ccn_upcall_res SyncInterestArrived ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Definition at line 2317 of file ccn_sync.c.

Referenced by SyncRegisterInterest(), and SyncRegisterInterests().

int SyncRegisterInterests ( struct SyncRootStruct root  ) 

registers interests associated with the given root these include C1.S.RA (Root Advise) and C1.S.NF (Node Fetch) interests additional interests may be registered as the protocol evolves

Returns:
< 0 for error, >= 0 for success

Definition at line 2445 of file ccn_sync.c.

Referenced by SyncAddRoot().

enum ccn_upcall_res SyncRemoteFetchResponse ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Definition at line 1507 of file ccn_sync.c.

Referenced by SyncStartContentFetch(), and SyncStartNodeFetch().

int SyncStartCompareAction ( struct SyncRootStruct root,
struct ccn_charbuf hashR 
)

initiates a compare action with the given remote hash

Returns:
< 0 for error, >= 0 for OK

Definition at line 2206 of file ccn_sync.c.

Referenced by HeartbeatAction(), and SyncRootAdviseResponse().

int SyncStartHeartbeat ( struct SyncBaseStruct base  ) 

starts a periodic wakeup that maintains state across all roots

Returns:
< 0 for error, >= 0 for success

Definition at line 2491 of file ccn_sync.c.

Referenced by SyncInit().

int SyncStartNodeFetch ( struct SyncRootStruct root,
struct SyncHashCacheEntry ce,
struct SyncCompareData *  comp 
)

starts a remote fetch of the given node, based on the hash comp may be NULL if this is not for a compare

Returns:
< 0 for error, >= 0 for success

Definition at line 1646 of file ccn_sync.c.

Referenced by doComparison(), and doPreload().

int SyncStartSliceEnum ( struct SyncRootStruct root  ) 

starts a slice enumeration for the root

Returns:
< 0 for error, 0 if some enumeration is busy, 1 for success

Definition at line 2486 of file ccn_sync.c.

Referenced by HeartbeatAction(), and SyncNotifyContent().

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

Definition at line 368 of file ccn_sync.c.

Referenced by write_slice().

static int write_slice ( struct ccn *  h,
struct ccns_slice *  slice,
struct ccn_charbuf name 
) [static]

Definition at line 390 of file ccn_sync.c.

Referenced by ccns_delete_slice(), and ccns_write_slice().

Generated on Tue Aug 21 14:54:51 2012 for Content-Centric Networking in C by  doxygen 1.6.3