seqwriter.h File Reference

Part of the CCNx C Library. More...

Go to the source code of this file.

Functions

struct ccn_seqwriter * ccn_seqw_create (struct ccn *h, struct ccn_charbuf *name)
 Create a seqwriter for writing data to a versioned, segmented stream.
int ccn_seqw_possible_interest (struct ccn_seqwriter *w)
 Assert that an interest has possibly been expressed that matches the seqwriter's data.
int ccn_seqw_batch_start (struct ccn_seqwriter *w)
 Start a batch of writes.
int ccn_seqw_get_name (struct ccn_seqwriter *w, struct ccn_charbuf *nv)
 Append to a charbuf the versioned ccnb-encoded Name that will be used for this stream.
int ccn_seqw_write (struct ccn_seqwriter *w, const void *buf, size_t size)
 Write some data to a seqwriter.
int ccn_seqw_batch_end (struct ccn_seqwriter *w)
 End a batch of writes.
int ccn_seqw_set_block_limits (struct ccn_seqwriter *w, int l, int h)
int ccn_seqw_close (struct ccn_seqwriter *w)
 Close the seqwriter, which will be freed.


Detailed Description

Part of the CCNx C Library.

Copyright (C) 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 seqwriter.h.


Function Documentation

int ccn_seqw_batch_end ( struct ccn_seqwriter *  w  ) 

End a batch of writes.

Definition at line 264 of file ccn_seqwriter.c.

Referenced by ccnd_notice_push(), and ccnr_notice_push().

int ccn_seqw_batch_start ( struct ccn_seqwriter *  w  ) 

Start a batch of writes.

This will delay the signing of content objects until the batch ends, producing a more efficient result. Must have a matching ccn_seqw_batch_end() call. Batching may be nested.

Definition at line 253 of file ccn_seqwriter.c.

Referenced by ccnd_notice_push(), and ccnr_notice_push().

int ccn_seqw_close ( struct ccn_seqwriter *  w  ) 

Close the seqwriter, which will be freed.

Definition at line 302 of file ccn_seqwriter.c.

Referenced by main().

struct ccn_seqwriter* ccn_seqw_create ( struct ccn *  h,
struct ccn_charbuf name 
) [read]

Create a seqwriter for writing data to a versioned, segmented stream.

Parameters:
name is a ccnb-encoded Name. It will be provided with a version based on the current time unless it already ends in a version component.

Definition at line 132 of file ccn_seqwriter.c.

Referenced by ccnd_start_notice(), and main().

int ccn_seqw_get_name ( struct ccn_seqwriter *  w,
struct ccn_charbuf nv 
)

Append to a charbuf the versioned ccnb-encoded Name that will be used for this stream.

Parameters:
w the seqwriter for which the name is requested
nv the charbuf to which the name will be appended
Returns:
0 for success, -1 for failure

Definition at line 184 of file ccn_seqwriter.c.

Referenced by main().

int ccn_seqw_possible_interest ( struct ccn_seqwriter *  w  ) 

Assert that an interest has possibly been expressed that matches the seqwriter's data.

This is useful, for example, if the seqwriter was created in response to an interest.

Definition at line 289 of file ccn_seqwriter.c.

int ccn_seqw_set_block_limits ( struct ccn_seqwriter *  w,
int  l,
int  h 
)

Definition at line 273 of file ccn_seqwriter.c.

Referenced by main().

int ccn_seqw_write ( struct ccn_seqwriter *  w,
const void *  buf,
size_t  size 
)

Write some data to a seqwriter.

This is roughly analogous to a write(2) call in non-blocking mode.

The current implementation returns an error and refuses the new data if it does not fit in the current buffer. That is, there are no partial writes. In this case, the caller should ccn_run() for a little while and retry.

It is also an error to attempt to write more than 4096 bytes.

Returns:
the size written, or -1 for an error. In case of an error, the caller may test ccn_geterror() for values of EAGAIN or EINVAL from errno.h.

Definition at line 208 of file ccn_seqwriter.c.

Referenced by ccn_seqw_batch_end(), ccn_seqw_close(), ccn_seqw_possible_interest(), main(), and post_face_notice().


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