ccn_versioning.c File Reference

Versioning support. More...

Go to the source code of this file.

Defines

#define FF   0xff

Functions

static void append_filter_all (struct ccn_charbuf *c)
 This appends a filter useful for excluding everything between two 'fenceposts' in an Exclude construct.
static void answer_passive (struct ccn_charbuf *templ)
 Append AnswerOriginKind=1 to partially constructed Interest, meaning do not generate new content.
static void answer_highest (struct ccn_charbuf *templ)
 Append ChildSelector to partially constructed Interest, meaning prefer to send rightmost available.
static void append_future_vcomp (struct ccn_charbuf *templ)
static struct ccn_charbufresolve_templ (struct ccn_charbuf *templ, unsigned const char *vcomp, int size)
int ccn_resolve_version (struct ccn *h, struct ccn_charbuf *name, int versioning_flags, int timeout_ms)
 Resolve the version, based on existing ccn content.
int ccn_create_version (struct ccn *h, struct ccn_charbuf *name, int versioning_flags, intmax_t secs, int nsecs)
 Extend a Name with a new version stamp.

Detailed Description

Versioning support.

Part of the CCNx C Library.

Copyright (C) 2009-2010 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_versioning.c.


Define Documentation

#define FF   0xff

Definition at line 31 of file ccn_versioning.c.

Referenced by ccn_resolve_version().


Function Documentation

static void answer_highest ( struct ccn_charbuf templ  )  [static]

Append ChildSelector to partially constructed Interest, meaning prefer to send rightmost available.

Definition at line 62 of file ccn_versioning.c.

Referenced by resolve_templ().

static void answer_passive ( struct ccn_charbuf templ  )  [static]

Append AnswerOriginKind=1 to partially constructed Interest, meaning do not generate new content.

Definition at line 49 of file ccn_versioning.c.

Referenced by resolve_templ().

static void append_filter_all ( struct ccn_charbuf c  )  [static]

This appends a filter useful for excluding everything between two 'fenceposts' in an Exclude construct.

Definition at line 38 of file ccn_versioning.c.

Referenced by resolve_templ().

static void append_future_vcomp ( struct ccn_charbuf templ  )  [static]

Definition at line 68 of file ccn_versioning.c.

Referenced by resolve_templ().

int ccn_create_version ( struct ccn *  h,
struct ccn_charbuf name,
int  versioning_flags,
intmax_t  secs,
int  nsecs 
)

Extend a Name with a new version stamp.

Parameters:
h is the the ccn handle. May be NULL. This procedure does not use the connection.
name is a ccnb-encoded Name prefix. By default it gets extended in-place with one additional Component that conforms to the versioning profile and is based on the supplied time, unless a version component is already present.
versioning_flags modifies the default behavior: CCN_V_REPLACE causes the last component to be replaced if it appears to be a version stamp. If CCN_V_HIGH is set as well, an attempt will be made to generate a new version stamp that is later than the existing one, or to return an error. CCN_V_NOW bases the version on the current time rather than the supplied time. CCN_V_NESTOK will allow the new version component to be appended even if there is one there (this makes no difference if CCN_V_REPLACE is also set).
secs is the desired time, in seconds since epoch (ignored if CCN_V_NOW is set).
nsecs is the number of nanoseconds.
Returns:
-1 for error, 0 for success.

Definition at line 215 of file ccn_versioning.c.

Referenced by ccn_seqw_create(), ccnd_init_service_ccnb(), and main().

int ccn_resolve_version ( struct ccn *  h,
struct ccn_charbuf name,
int  versioning_flags,
int  timeout_ms 
)

Resolve the version, based on existing ccn content.

Parameters:
h is the the ccn handle; it may be NULL, but it is preferable to use the handle that the client probably already has.
name is a ccnb-encoded Name prefix. It gets extended in-place with one additional Component such that it names highest extant version that can be found, subject to the supplied timeout.
versioning_flags presently must be CCN_V_HIGH or CCN_V_HIGHEST, possibly combined with CCN_V_NESTOK. If CCN_V_NESTOK is not present and the ending component appears to be a version, the routine returns 0 immediately, on the assumption that an explicit version has already been provided.
timeout_ms is a time value in milliseconds. This is applied per fetch attempt, so the total time may be longer by a factor that depends on the number of (ccn) hops to the source(s).
Returns:
-1 for error, 0 if name could not be extended, 1 if was.

Definition at line 124 of file ccn_versioning.c.

Referenced by ccn_fetch_open(), ccn_get_header(), and main().

static struct ccn_charbuf* resolve_templ ( struct ccn_charbuf templ,
unsigned const char *  vcomp,
int  size 
) [static, read]

Definition at line 79 of file ccn_versioning.c.

Referenced by ccn_resolve_version().

Generated on Fri May 13 16:27:23 2011 for Content-Centric Networking in C by  doxygen 1.6.3