Sync library interface. More...
Go to the source code of this file.
Defines | |
#define | SLICE_VERSION 20110614 |
Typedefs | |
typedef int(* | ccns_callback )(struct ccns_handle *ccns, struct ccn_charbuf *lhash, struct ccn_charbuf *rhash, struct ccn_charbuf *pname) |
Functions | |
struct ccns_slice * | ccns_slice_create (void) |
Allocate a ccns_slice structure. | |
void | ccns_slice_destroy (struct ccns_slice **sp) |
Deallocate a ccns_slice structure. | |
int | ccns_slice_set_topo_prefix (struct ccns_slice *slice, struct ccn_charbuf *t, struct ccn_charbuf *p) |
int | ccns_slice_add_clause (struct ccns_slice *s, struct ccn_charbuf *f) |
Add a (filter) clause to a ccns_slice structure. | |
int | ccns_slice_name (struct ccn_charbuf *nm, struct ccns_slice *s) |
Construct the name of a Sync configuration slice. | |
int | ccns_read_slice (struct ccn *h, struct ccn_charbuf *name, struct ccns_slice *slice) |
Read a slice given the 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. | |
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 **sh, struct ccn_charbuf *rhash, struct ccn_charbuf *pname) |
Stop notification of changes of names in a sync slice and free the handle. |
Sync library interface.
Defines a library interface to the Sync protocol facilities implemented by the Repository
Part of the CCNx C Library.
Copyright (C) 2012 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 sync.h.
#define SLICE_VERSION 20110614 |
Definition at line 30 of file sync.h.
Referenced by append_slice(), ccns_slice_create(), sendSlice(), slice_parse(), SyncRootAppendSlice(), and SyncRootDecodeAndAdd().
typedef int(* ccns_callback)(struct ccns_handle *ccns, struct ccn_charbuf *lhash, struct ccn_charbuf *rhash, struct ccn_charbuf *pname) |
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.
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.
h | is the ccn_handle on which to write. | |
name | is a pointer to a charbuf naming the slice to be deleted. |
Definition at line 515 of file ccn_sync.c.
Referenced by main().
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.
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. |
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. |
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 given the name.
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. |
Read a slice given the name.
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. |
Definition at line 314 of file ccn_sync.c.
int ccns_slice_add_clause | ( | struct ccns_slice * | s, | |
struct ccn_charbuf * | f | |||
) |
Add a (filter) clause to a ccns_slice structure.
slice | is the slice to be modified | |
f | is a filter clause ccnb-encoded as a Name |
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.
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.
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.
nm | is a ccn_charbuf into which will be stored the slice name | |
s | is the slice structure for which the name is required. |
Construct the name of a Sync configuration slice.
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. |
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 * | slice, | |
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.
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. |
Definition at line 482 of file ccn_sync.c.
Referenced by main().