SyncNode.c File Reference

Part of CCNx Sync. More...

Go to the source code of this file.

Functions

int SyncSetCompErr (struct SyncNodeComposite *nc, int val)
 Sets the error field when there is a processing error.
int SyncCheckCompErr (struct SyncNodeComposite *nc)
 Tests the error field for an error returns 0 for no error != 0 for an error).
struct ccn_buf_decoderSyncInitDecoderFromOffset (struct ccn_buf_decoder *d, struct SyncNodeComposite *nc, ssize_t start, ssize_t stop)
 Makes a decoder from an offset range using the node charbuf.
struct ccn_buf_decoderSyncInitDecoderFromElem (struct ccn_buf_decoder *d, struct SyncNodeComposite *nc, struct SyncNodeElem *ep)
 Makes a decoder from an element.
void SyncNodeIncRC (struct SyncNodeComposite *nc)
 Increments the reference count.
struct SyncNodeCompositeSyncNodeDecRC (struct SyncNodeComposite *nc)
 Decrements the reference count.
enum SyncCompareResult SyncNodeCompareMinMax (struct SyncNodeComposite *nc, struct ccn_charbuf *name)
 Compares a name against the min and max names in the node.
enum SyncCompareResult SyncNodeCompareLeaf (struct SyncNodeComposite *nc, struct SyncNodeElem *ep, struct ccn_charbuf *name)
 Compares a name against the leaf in the element.
void SyncResetComposite (struct SyncNodeComposite *nc)
 resets a composite node to its initial state except that it retains any allocated storage
struct SyncNodeCompositeSyncAllocComposite (struct SyncBaseStruct *base)
 allocates a new, empty, composite object
void SyncExtendComposite (struct SyncNodeComposite *nc, SyncElemKind kind, ssize_t start, ssize_t stop)
 extends the references section of a composite object with a new offset pair useful if NOT using SyncNodeAddName and SyncNodeAddNode
void SyncNodeMaintainMinMax (struct SyncNodeComposite *nc, const struct ccn_charbuf *name)
 maintains the minName and maxName bounds useful if NOT using SyncNodeAddName and SyncNodeAddNode
void SyncNodeAddName (struct SyncNodeComposite *nc, const struct ccn_charbuf *name)
 extends the references section of a composite object with a new name, updating the composite fields (including the name bounds) the names MUST be added in sorted order!
void SyncNodeAddNode (struct SyncNodeComposite *nc, struct SyncNodeComposite *node)
 extends the references section of a composite object with a new node, updating the composite fields (including the name bounds) the nodes MUST be added in sorted order!
int SyncNodeAppendLongHash (struct ccn_charbuf *cb, struct SyncNodeComposite *nc)
 appends the ccnb encoding for the long hash of nc to cb
void SyncEndComposite (struct SyncNodeComposite *nc)
 endComposite finishes up the encoding, appending the composite fields the hash field will be valid after this call
void SyncFreeComposite (struct SyncNodeComposite *nc)
 freeComposite returns the storage for the composite object
void SyncWriteComposite (struct SyncNodeComposite *nc, FILE *f)
 writes the encoding to a file (primarily useful for test and debug code)
int SyncParseComposite (struct SyncNodeComposite *nc, struct ccn_buf_decoder *d)
 parses an encoded node and fills in the supplied node implicitly resets the node at the start of the parse


Detailed Description

Part of CCNx Sync.

Copyright (C) 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 SyncNode.c.


Function Documentation

struct SyncNodeComposite* SyncAllocComposite ( struct SyncBaseStruct base  )  [read]

allocates a new, empty, composite object

Definition at line 155 of file SyncNode.c.

Referenced by extractNode(), MakeNodeFromNames(), nodeFromNodes(), SyncCacheEntryFetch(), testEncodeDecode(), and testGenComposite().

int SyncCheckCompErr ( struct SyncNodeComposite nc  ) 

Tests the error field for an error returns 0 for no error != 0 for an error).

Definition at line 36 of file SyncNode.c.

Referenced by SyncEndComposite(), and SyncParseComposite().

void SyncEndComposite ( struct SyncNodeComposite nc  ) 

endComposite finishes up the encoding, appending the composite fields the hash field will be valid after this call

Definition at line 260 of file SyncNode.c.

Referenced by MakeNodeFromNames(), nodeFromNodes(), and testGenComposite().

void SyncExtendComposite ( struct SyncNodeComposite nc,
SyncElemKind  kind,
ssize_t  start,
ssize_t  stop 
)

extends the references section of a composite object with a new offset pair useful if NOT using SyncNodeAddName and SyncNodeAddNode

Definition at line 166 of file SyncNode.c.

Referenced by SyncNodeAddName(), SyncNodeAddNode(), and SyncParseComposite().

void SyncFreeComposite ( struct SyncNodeComposite nc  ) 

freeComposite returns the storage for the composite object

Definition at line 289 of file SyncNode.c.

Referenced by extractNode(), newNodeCommon(), SyncCacheEntryFetch(), SyncNodeDecRC(), and testEncodeDecode().

struct ccn_buf_decoder* SyncInitDecoderFromElem ( struct ccn_buf_decoder d,
struct SyncNodeComposite nc,
struct SyncNodeElem ep 
) [read]

Makes a decoder from an element.

Definition at line 52 of file SyncNode.c.

Referenced by extractBuf().

struct ccn_buf_decoder* SyncInitDecoderFromOffset ( struct ccn_buf_decoder d,
struct SyncNodeComposite nc,
ssize_t  start,
ssize_t  stop 
) [read]

Makes a decoder from an offset range using the node charbuf.

Definition at line 41 of file SyncNode.c.

Referenced by cacheEntryForElem(), printTreeInner(), SyncNodeCompareLeaf(), SyncTreeGenerateNames(), and SyncTreeWorkerPush().

void SyncNodeAddName ( struct SyncNodeComposite nc,
const struct ccn_charbuf name 
)

extends the references section of a composite object with a new name, updating the composite fields (including the name bounds) the names MUST be added in sorted order!

Definition at line 215 of file SyncNode.c.

Referenced by MakeNodeFromNames(), and testGenComposite().

void SyncNodeAddNode ( struct SyncNodeComposite nc,
struct SyncNodeComposite node 
)

extends the references section of a composite object with a new node, updating the composite fields (including the name bounds) the nodes MUST be added in sorted order!

Definition at line 228 of file SyncNode.c.

Referenced by nodeFromNodes().

int SyncNodeAppendLongHash ( struct ccn_charbuf cb,
struct SyncNodeComposite nc 
)

appends the ccnb encoding for the long hash of nc to cb

Definition at line 247 of file SyncNode.c.

Referenced by SyncEndComposite(), and SyncNodeAddNode().

enum SyncCompareResult SyncNodeCompareLeaf ( struct SyncNodeComposite nc,
struct SyncNodeElem ep,
struct ccn_charbuf name 
)

Compares a name against the leaf in the element.

Definition at line 98 of file SyncNode.c.

Referenced by SyncTreeLookupName(), and SyncTreeMergeNames().

enum SyncCompareResult SyncNodeCompareMinMax ( struct SyncNodeComposite nc,
struct ccn_charbuf name 
)

Compares a name against the min and max names in the node.

Definition at line 83 of file SyncNode.c.

Referenced by doComparison(), and SyncTreeLookupName().

struct SyncNodeComposite* SyncNodeDecRC ( struct SyncNodeComposite nc  )  [read]

Decrements the reference count.

Returns:
nc if the resulting count is > 0.

NULL if the resulting count == 0 (and frees the node).

Definition at line 67 of file SyncNode.c.

Referenced by localFreeEntry(), newNodeCommon(), and purgeOldEntries().

void SyncNodeIncRC ( struct SyncNodeComposite nc  ) 

Increments the reference count.

Definition at line 61 of file SyncNode.c.

Referenced by MakeNodeFromNames(), newNodeCommon(), SyncCacheEntryFetch(), SyncRemoteFetchResponse(), and SyncRootAdviseResponse().

void SyncNodeMaintainMinMax ( struct SyncNodeComposite nc,
const struct ccn_charbuf name 
)

maintains the minName and maxName bounds useful if NOT using SyncNodeAddName and SyncNodeAddNode

Definition at line 192 of file SyncNode.c.

Referenced by SyncNodeAddName(), and SyncNodeAddNode().

int SyncParseComposite ( struct SyncNodeComposite nc,
struct ccn_buf_decoder d 
)

parses an encoded node and fills in the supplied node implicitly resets the node at the start of the parse

Returns:
nc->err

Definition at line 308 of file SyncNode.c.

Referenced by extractNode(), SyncCacheEntryFetch(), and testEncodeDecode().

void SyncResetComposite ( struct SyncNodeComposite nc  ) 

resets a composite node to its initial state except that it retains any allocated storage

Definition at line 126 of file SyncNode.c.

Referenced by SyncAllocComposite(), SyncFreeComposite(), and SyncParseComposite().

int SyncSetCompErr ( struct SyncNodeComposite nc,
int  val 
)

Sets the error field when there is a processing error.

Definition at line 29 of file SyncNode.c.

Referenced by SyncEndComposite(), and SyncParseComposite().

void SyncWriteComposite ( struct SyncNodeComposite nc,
FILE *  f 
)

writes the encoding to a file (primarily useful for test and debug code)

Definition at line 302 of file SyncNode.c.

Referenced by testEncodeDecode(), and testReadBuilder().


Generated on Thu Feb 16 00:44:28 2012 for Content-Centric Networking in C by  doxygen 1.5.6