sync.h File Reference

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.

Detailed Description

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 Documentation

#define SLICE_VERSION   20110614

Typedef Documentation

typedef int(* ccns_callback)(struct ccns_handle *ccns, struct ccn_charbuf *lhash, struct ccn_charbuf *rhash, struct ccn_charbuf *pname)

Definition at line 35 of file sync.h.


Function Documentation

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().

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.
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 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. XXX: should name be permitted to have trailing segment?

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.

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.

Parameters:
nm is a ccn_charbuf into which will be stored the slice name
s is the slice structure for which the name is required.
Returns:
0 on success, -1 otherwise.

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 *  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.

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().

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