Utility to convert ccn binary encoded data into XML form. More...
Go to the source code of this file.
Defines | |
#define | CCN_NO_SCHEMA INT_MIN |
#define | CCN_UNKNOWN_SCHEMA (INT_MIN+1) |
#define | FORCE_BINARY (1 << 0) |
#define | PREFER_HEX (1 << 1) |
#define | VERBOSE_DECODE (1 << 2) |
#define | L (CCN_TT_HBIT & ~CCN_CLOSE) |
Typedefs | |
typedef void(* | ccn_decoder_callback )(struct ccn_decoder *d, enum callback_kind kind, void *data) |
Enumerations | |
enum | callback_kind { CALLBACK_INITIAL, CALLBACK_OBJECTEND, CALLBACK_FINAL } |
Functions | |
static void | usage (const char *progname) |
struct ccn_decoder * | ccn_decoder_create (int formatting_flags, const struct ccn_dict *dtags) |
void | ccn_decoder_set_callback (struct ccn_decoder *d, ccn_decoder_callback c, void *data) |
struct ccn_decoder_stack_item * | ccn_decoder_push (struct ccn_decoder *d) |
void | ccn_decoder_pop (struct ccn_decoder *d) |
void | ccn_decoder_destroy (struct ccn_decoder **dp) |
static const char * | dict_name_from_number (int ndx, const struct ccn_dict_entry *dict, int n) |
static int | is_text_encodable (unsigned char p[], size_t start, size_t length) |
static void | print_percent_escaped (const unsigned char *data, size_t size) |
size_t | ccn_decoder_decode (struct ccn_decoder *d, unsigned char p[], size_t n) |
static int | process_data (struct ccn_decoder *d, unsigned char *data, size_t n) |
static int | process_fd (struct ccn_decoder *d, int fd) |
static int | process_file (char *path, int formatting_flags, const struct ccn_dict *dtags) |
static void | set_stdout (struct ccn_decoder *d, enum callback_kind kind, void *data) |
static int | process_split_file (char *base, char *path, int formatting_flags, const struct ccn_dict *dtags, int *suffix) |
int | main (int argc, char **argv) |
Variables | |
static const char | Base64 [] |
unsigned char | test1 [] |
Utility to convert ccn binary encoded data into XML form.
A CCNx command-line utility.
Copyright (C) 2008-2010 Palo Alto Research Center, Inc.
This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This work 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Definition in file ccn_ccnbtoxml.c.
#define CCN_NO_SCHEMA INT_MIN |
Definition at line 56 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_create().
#define CCN_UNKNOWN_SCHEMA (INT_MIN+1) |
Definition at line 57 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
#define FORCE_BINARY (1 << 0) |
Definition at line 99 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode(), and main().
#define L (CCN_TT_HBIT & ~CCN_CLOSE) |
Definition at line 749 of file ccn_ccnbtoxml.c.
#define PREFER_HEX (1 << 1) |
Definition at line 100 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode(), and main().
#define VERBOSE_DECODE (1 << 2) |
Definition at line 101 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode(), and main().
typedef void(* ccn_decoder_callback)(struct ccn_decoder *d, enum callback_kind kind, void *data) |
Definition at line 74 of file ccn_ccnbtoxml.c.
enum callback_kind |
Definition at line 68 of file ccn_ccnbtoxml.c.
struct ccn_decoder* ccn_decoder_create | ( | int | formatting_flags, | |
const struct ccn_dict * | dtags | |||
) | [read] |
Definition at line 104 of file ccn_ccnbtoxml.c.
Referenced by main(), process_file(), and process_split_file().
size_t ccn_decoder_decode | ( | struct ccn_decoder * | d, | |
unsigned char | p[], | |||
size_t | n | |||
) |
Definition at line 233 of file ccn_ccnbtoxml.c.
Referenced by process_data().
void ccn_decoder_destroy | ( | struct ccn_decoder ** | dp | ) |
Definition at line 162 of file ccn_ccnbtoxml.c.
Referenced by main(), process_file(), and process_split_file().
void ccn_decoder_pop | ( | struct ccn_decoder * | d | ) |
Definition at line 149 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode(), and ccn_decoder_destroy().
struct ccn_decoder_stack_item* ccn_decoder_push | ( | struct ccn_decoder * | d | ) | [read] |
Definition at line 134 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
void ccn_decoder_set_callback | ( | struct ccn_decoder * | d, | |
ccn_decoder_callback | c, | |||
void * | data | |||
) |
Definition at line 122 of file ccn_ccnbtoxml.c.
Referenced by process_split_file().
static const char* dict_name_from_number | ( | int | ndx, | |
const struct ccn_dict_entry * | dict, | |||
int | n | |||
) | [static] |
Definition at line 179 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
static int is_text_encodable | ( | unsigned char | p[], | |
size_t | start, | |||
size_t | length | |||
) | [static] |
Definition at line 192 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 778 of file ccn_ccnbtoxml.c.
static void print_percent_escaped | ( | const unsigned char * | data, | |
size_t | size | |||
) | [static] |
Definition at line 207 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
static int process_data | ( | struct ccn_decoder * | d, | |
unsigned char * | data, | |||
size_t | n | |||
) | [static] |
Definition at line 623 of file ccn_ccnbtoxml.c.
Referenced by main(), and process_fd().
static int process_fd | ( | struct ccn_decoder * | d, | |
int | fd | |||
) | [static] |
Definition at line 638 of file ccn_ccnbtoxml.c.
Referenced by process_file(), and process_split_file().
static int process_file | ( | char * | path, | |
int | formatting_flags, | |||
const struct ccn_dict * | dtags | |||
) | [static] |
Definition at line 668 of file ccn_ccnbtoxml.c.
Referenced by main().
static int process_split_file | ( | char * | base, | |
char * | path, | |||
int | formatting_flags, | |||
const struct ccn_dict * | dtags, | |||
int * | suffix | |||
) | [static] |
Definition at line 720 of file ccn_ccnbtoxml.c.
Referenced by main().
static void set_stdout | ( | struct ccn_decoder * | d, | |
enum callback_kind | kind, | |||
void * | data | |||
) | [static] |
Definition at line 697 of file ccn_ccnbtoxml.c.
Referenced by process_split_file().
static void usage | ( | const char * | progname | ) | [static] |
Definition at line 36 of file ccn_ccnbtoxml.c.
const char Base64[] [static] |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Definition at line 188 of file ccn_ccnbtoxml.c.
Referenced by ccn_decoder_decode().
unsigned char test1[] |
{ (2 << CCN_TT_BITS) + CCN_TAG + L, 'F', 'o', 'o', (0 << CCN_TT_BITS) + CCN_TAG + L, 'a', (1 << CCN_TT_BITS) + CCN_UDATA + L, 'X', CCN_CLOSE, (0 << CCN_TT_BITS) + CCN_TAG + L, 'b', (3 << CCN_TT_BITS) + CCN_ATTR + L, 't', 'y', 'p', 'e', (5 << CCN_TT_BITS) + CCN_UDATA + L, 'e', 'm', 'p', 't', 'y', CCN_CLOSE, (2 << CCN_TT_BITS) + CCN_TAG + L, 'b', 'i', 'n', (4 << CCN_TT_BITS) + CCN_BLOB + L, 1, 0x23, 0x45, 0x67, CCN_CLOSE, (CCN_CLOSE + ((20-1) >> (7-CCN_TT_BITS))), (((20-1) & CCN_TT_MASK) << CCN_TT_BITS) + CCN_TAG + L, 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd', CCN_CLOSE, (2 << CCN_TT_BITS) + CCN_TAG + L, 'i', 'n', 't', (3 << CCN_TT_BITS) + CCN_ATTR + L, 't', 'y', 'p', 'e', (3 << CCN_TT_BITS) + CCN_UDATA + L, 'B', 'I', 'G', CCN_CLOSE, (6 << CCN_TT_BITS) + CCN_UDATA + L, 'H','i','&','b','y','e', CCN_CLOSE, }
Definition at line 750 of file ccn_ccnbtoxml.c.
Referenced by main().