Details of the ccn binary wire encoding. More...
Go to the source code of this file.
Details of the ccn binary wire encoding.
Part of the CCNx C Library.
Copyright (C) 2008-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 coding.h.
#define CCN_CLOSE ((unsigned char)(0)) |
CCN_CLOSE terminates composites.
Definition at line 48 of file coding.h.
Referenced by ccn_charbuf_append_closer(), ccn_charbuf_append_tt(), ccn_decoder_decode(), ccn_name_append(), ccn_name_chop(), ccn_name_from_uri(), ccn_skeleton_decode(), emit_closer(), and emit_tt().
#define CCN_DSTATE_PAUSE (1 << 15) |
If the CCN_DSTATE_PAUSE bit is set in the decoder state, the decoder will 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.
Definition at line 212 of file coding.h.
Referenced by ccn_buf_decoder_start(), ccn_skeleton_decode(), ccnbx(), main(), process_input_message(), and process_test().
#define CCN_FINAL_DSTATE | ( | state | ) | (((state) & (CCN_DSTATE_PAUSE-1)) == 0) |
Definition at line 214 of file coding.h.
Referenced by ccn_face_instance_parse(), ccn_forwarding_entry_parse(), ccn_header_parse(), ccn_parse_ContentObject(), ccn_parse_interest(), ccn_ref_tagged_BLOB(), ccnbx(), and process_test().
#define CCN_GET_TT_FROM_DSTATE | ( | state | ) | (CCN_TT_MASK & ((state) >> 16)) |
Definition at line 213 of file coding.h.
Referenced by ccn_buf_advance_past_element(), ccn_buf_check_close(), ccn_buf_match_attr(), ccn_buf_match_dtag(), ccn_buf_match_some_blob(), ccn_buf_match_some_dtag(), ccn_buf_match_udata(), ccn_parse_nonNegativeInteger(), ccn_parse_required_tagged_UDATA(), ccn_parse_tagged_string(), ccn_parse_timestamp(), ccn_parse_uintmax(), ccnbx(), process_input_message(), and process_test().
#define CCN_MAX_TINY ((1 << (7-CCN_TT_BITS)) - 1) |
Definition at line 30 of file coding.h.
Referenced by ccn_charbuf_append_tt(), ccn_decoder_decode(), ccn_skeleton_decode(), and emit_tt().
#define CCN_TT_BITS 3 |
Definition at line 28 of file coding.h.
Referenced by ccn_charbuf_append_tt(), ccn_decoder_decode(), ccn_skeleton_decode(), and emit_tt().
#define CCN_TT_HBIT ((unsigned char)(1 << 7)) |
Definition at line 31 of file coding.h.
Referenced by ccn_charbuf_append_tt(), ccn_decoder_decode(), ccn_skeleton_decode(), and emit_tt().
#define CCN_TT_MASK ((1 << CCN_TT_BITS) - 1) |
Definition at line 29 of file coding.h.
Referenced by ccn_charbuf_append_tt(), ccn_decoder_decode(), ccn_skeleton_decode(), and emit_tt().
enum ccn_decoder_state |
The decoder state is one of these, possibly with some additional bits set for internal use.
A complete parse ends up in state 0 or an error state. Not all possible error states are listed here.
enum ccn_dtag |
DTAG identifies ccnb-encoded elements.
c.f. tagname.csvdict See the gen_enum_dtag script for help updating these.
enum ccn_ext_subtype |
enum ccn_tt |
Type tag for a ccnb start marker.
ssize_t ccn_skeleton_decode | ( | struct ccn_skeleton_decoder * | d, | |
const unsigned char * | p, | |||
size_t | n | |||
) |
Decodes ccnb decoded data.
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. |
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.
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().
struct ccn_dict ccn_dtag_dict |
Table for translating from DTAGs to names and vice versa.
Definition at line 124 of file ccn_dtag_table.c.
Referenced by dtag_lookup(), and main().