ccn_coding.c File Reference

Support for scanning and parsing ccnb-encoded data. More...

Go to the source code of this file.

Defines

#define XML(goop)   ((void)0)
 This macro documents what's happening in the state machine by hinting at the XML syntax would be emitted in a re-encoder.

Functions

ssize_t ccn_skeleton_decode (struct ccn_skeleton_decoder *d, const unsigned char *p, size_t n)
 Decodes ccnb decoded data.

Detailed Description

Support for scanning and parsing ccnb-encoded data.

Part of the CCNx C Library.

Copyright (C) 2008, 2009 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_coding.c.


Define Documentation

#define XML ( goop   )     ((void)0)

This macro documents what's happening in the state machine by hinting at the XML syntax would be emitted in a re-encoder.

But it actually does nothing.

Definition at line 27 of file ccn_coding.c.

Referenced by ccn_skeleton_decode().


Function Documentation

ssize_t ccn_skeleton_decode ( struct ccn_skeleton_decoder d,
const unsigned char *  p,
size_t  n 
)

Decodes ccnb decoded data.

Parameters:
d holds the current state of the decoder.
p points to a new block of ccnb data to feed to the decoder.
n is the size of the input, in bytes.
Returns:
the number of bytes consumed.

The client should ensure that the decoder is initialized to all zero before the first call. In the default mode, the decoder will return only when it runs out of data, encounters an error, or reaches the end of the element that it started at. This is a good way to pull ccnb-encoded objects from a byte stream.

By setting the CCN_DSTATE_PAUSE bit is set in the decoder state, the decoder will additionally return just after recognizing each token. In this instance, use CCN_GET_TT_FROM_DSTATE() to extract the token type from the decoder state; CCN_CLOSE will be reported as CCN_NO_TOKEN.

The pause bit persists, so the end test should take that into account by using the CCN_FINAL_DSTATE() macro instead of testing for state 0.

Once an error state is entered, no addition input is processed.

See also:
ccn_buf_decoder_start(), ccn_buf_advance(), ccn_buf_check_close()

Definition at line 57 of file ccn_coding.c.

Referenced by ccn_buf_advance(), ccn_buf_decoder_start(), ccn_process_input(), ccn_put(), ccnbx(), main(), process_input(), process_input_buffer(), process_input_message(), and process_test().

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