Support for constructing various ccnb-encoded objects. More...
Go to the source code of this file.
Functions | |
int | ccn_signed_info_create (struct ccn_charbuf *c, const void *publisher_key_id, size_t publisher_key_id_size, const struct ccn_charbuf *timestamp, enum ccn_content_type type, int freshness, const struct ccn_charbuf *finalblockid, const struct ccn_charbuf *key_locator) |
Create SignedInfo. | |
static int | ccn_encode_Signature (struct ccn_charbuf *buf, const char *digest_algorithm, const void *witness, size_t witness_size, const struct ccn_signature *signature, size_t signature_size) |
int | ccn_encode_ContentObject (struct ccn_charbuf *buf, const struct ccn_charbuf *Name, const struct ccn_charbuf *SignedInfo, const void *data, size_t size, const char *digest_algorithm, const struct ccn_pkey *private_key) |
Encode and sign a ContentObject. | |
int | ccn_encode_StatusResponse (struct ccn_charbuf *buf, int errcode, const char *errtext) |
int | ccn_charbuf_append_tt (struct ccn_charbuf *c, size_t val, enum ccn_tt tt) |
Append a ccnb start marker. | |
int | ccn_charbuf_append_closer (struct ccn_charbuf *c) |
Append a CCN_CLOSE. | |
int | ccnb_append_number (struct ccn_charbuf *c, int nni) |
Append a non-negative integer as a UDATA. | |
int | ccnb_append_timestamp_blob (struct ccn_charbuf *c, enum ccn_marker marker, intmax_t secs, int nsecs) |
Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction). | |
int | ccnb_append_now_blob (struct ccn_charbuf *c, enum ccn_marker marker) |
Append a binary timestamp, using the current time. | |
int | ccnb_element_begin (struct ccn_charbuf *c, enum ccn_dtag dtag) |
Append a start-of-element marker. | |
int | ccnb_element_end (struct ccn_charbuf *c) |
Append an end-of-element marker. | |
int | ccnb_append_tagged_blob (struct ccn_charbuf *c, enum ccn_dtag dtag, const void *data, size_t size) |
Append a tagged BLOB. | |
int | ccnb_tagged_putf (struct ccn_charbuf *c, enum ccn_dtag dtag, const char *fmt,...) |
Append a tagged UDATA string, with printf-style formatting. |
Support for constructing various ccnb-encoded objects.
Part of the CCNx C Library.
Copyright (C) 2008, 2009, 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 ccn_buf_encoder.c.
int ccn_charbuf_append_closer | ( | struct ccn_charbuf * | c | ) |
Append a CCN_CLOSE.
Use this to close off an element in ccnb-encoded data.
c | is the buffer to append to. |
Definition at line 273 of file ccn_buf_encoder.c.
Referenced by answer_passive(), append_Any_filter(), append_bf_all(), append_bloom_element(), append_filter_all(), append_future_vcomp(), ccn_construct_interest(), ccn_create_version(), ccn_encode_ContentObject(), ccn_encode_Signature(), ccn_encode_StatusResponse(), ccn_initiate_key_fetch(), ccn_name_append_components(), ccn_name_from_uri(), ccn_name_init(), ccn_sign_content(), ccn_signed_info_create(), ccnb_append_tagged_blob(), ccnb_element_end(), ccnb_tagged_putf(), ccnd_answer_req(), ccnd_append_plain_nonce(), ccnd_init_service_ccnb(), create_passive_templ(), express_bulkdata_interest(), express_my_interest(), find_first_match_candidate(), incoming_content(), initialize_global_data(), local_scope(), local_scope_rm_template(), main(), make_data_template(), make_template(), process_incoming_content(), resolve_templ(), stuff_and_send(), and stuff_link_check().
int ccn_charbuf_append_tt | ( | struct ccn_charbuf * | c, | |
size_t | val, | |||
enum ccn_tt | tt | |||
) |
Append a ccnb start marker.
This forms the basic building block of ccnb-encoded data.
c | is the buffer to append to. | |
val | is the numval, intepreted according to tt (see enum ccn_tt). | |
tt | is the type field. |
Definition at line 255 of file ccn_buf_encoder.c.
Referenced by answer_passive(), append_Any_filter(), append_bf_all(), append_bloom_element(), append_filter_all(), append_future_vcomp(), ccn_append_link_stuff(), ccn_append_pubkey_blob(), ccn_construct_interest(), ccn_create_version(), ccn_encode_ContentObject(), ccn_encode_Signature(), ccn_encode_StatusResponse(), ccn_initiate_key_fetch(), ccn_name_append(), ccn_name_init(), ccn_sign_content(), ccn_signed_info_create(), ccnb_append_number(), ccnb_append_tagged_blob(), ccnb_append_timestamp_blob(), ccnb_element_begin(), ccnb_tagged_putf(), ccnd_append_plain_nonce(), ccnd_init_service_ccnb(), create_passive_templ(), express_bulkdata_interest(), express_my_interest(), incoming_content(), initialize_global_data(), local_scope(), local_scope_rm_template(), main(), make_data_template(), make_template(), process_incoming_content(), resolve_templ(), stuff_and_send(), and stuff_link_check().
int ccn_encode_ContentObject | ( | struct ccn_charbuf * | buf, | |
const struct ccn_charbuf * | Name, | |||
const struct ccn_charbuf * | SignedInfo, | |||
const void * | data, | |||
size_t | size, | |||
const char * | digest_algorithm, | |||
const struct ccn_pkey * | private_key | |||
) |
Encode and sign a ContentObject.
buf | is the output buffer where encoded object is written. | |
Name | is the ccnb-encoded name from ccn_name_init and friends. | |
SignedInfo | is the ccnb-encoded info from ccn_signed_info_create. | |
data | pintes to the raw data to be encoded. | |
size | is the size, in bytes, of the raw data to be encoded. | |
digest_algorithm | may be NULL for default. | |
private_key | is the private key to use for signing. |
Definition at line 160 of file ccn_buf_encoder.c.
Referenced by ccn_sign_content(), encode_message(), and main().
static int ccn_encode_Signature | ( | struct ccn_charbuf * | buf, | |
const char * | digest_algorithm, | |||
const void * | witness, | |||
size_t | witness_size, | |||
const struct ccn_signature * | signature, | |||
size_t | signature_size | |||
) | [static] |
Definition at line 110 of file ccn_buf_encoder.c.
Referenced by ccn_encode_ContentObject().
int ccn_encode_StatusResponse | ( | struct ccn_charbuf * | buf, | |
int | errcode, | |||
const char * | errtext | |||
) |
Definition at line 231 of file ccn_buf_encoder.c.
Referenced by ccnd_nack().
int ccn_signed_info_create | ( | struct ccn_charbuf * | c, | |
const void * | publisher_key_id, | |||
size_t | publisher_key_id_size, | |||
const struct ccn_charbuf * | timestamp, | |||
enum ccn_content_type | type, | |||
int | freshness, | |||
const struct ccn_charbuf * | finalblockid, | |||
const struct ccn_charbuf * | key_locator | |||
) |
Create SignedInfo.
c | is used to hold the result. | |
publisher_key_id | points to the digest of the publisher key id. | |
publisher_key_id_size | is the size in bytes(32) of the pub key digest | |
timestamp | holds the timestamp, as a ccnb-encoded blob, or is NULL to use the current time. | |
type | indicates the Type of the ContentObject. | |
freshness | is the FreshnessSeconds value, or -1 to omit. | |
finalblockid | holds the FinalBlockID, as a ccnb-encoded blob, or is NULL to omit. | |
key_locator | is the ccnb-encoded KeyLocator element, or NULL to omit. |
Definition at line 48 of file ccn_buf_encoder.c.
Referenced by ccn_sign_content(), and main().
int ccnb_append_now_blob | ( | struct ccn_charbuf * | c, | |
enum ccn_marker | marker | |||
) |
Append a binary timestamp, using the current time.
Like ccnb_append_timestamp_blob() but uses current time
c | is the buffer to append to. | |
marker | - see ccnb_append_timestamp_blob() |
Definition at line 355 of file ccn_buf_encoder.c.
Referenced by ccn_create_version(), and ccn_signed_info_create().
int ccnb_append_number | ( | struct ccn_charbuf * | c, | |
int | nni | |||
) |
Append a non-negative integer as a UDATA.
c | is the buffer to append to. | |
nni | is a non-negative value. |
Definition at line 288 of file ccn_buf_encoder.c.
Referenced by main(), make_data_template(), and make_template().
int ccnb_append_tagged_blob | ( | struct ccn_charbuf * | c, | |
enum ccn_dtag | dtag, | |||
const void * | data, | |||
size_t | size | |||
) |
Append a tagged BLOB.
This is a ccnb-encoded element with containing the BLOB as content
c | is the buffer to append to. | |
dtag | is the element's dtab | |
data | points to the binary data | |
size | is the size of the data, in bytes |
Definition at line 395 of file ccn_buf_encoder.c.
Referenced by ccn_encode_ContentObject(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), ccnb_append_header(), ccnd_append_debug_nonce(), and main().
int ccnb_append_timestamp_blob | ( | struct ccn_charbuf * | c, | |
enum ccn_marker | marker, | |||
intmax_t | secs, | |||
int | nsecs | |||
) |
Append a binary timestamp as a BLOB using the ccn binary Timestamp representation (12-bit fraction).
c | is the buffer to append to. | |
marker | If marker >= 0, the low-order byte is used as a marker byte, useful for some content naming conventions (versioning, in particular). | |
secs | - seconds since epoch | |
nsecs | - nanoseconds |
Definition at line 316 of file ccn_buf_encoder.c.
Referenced by ccn_create_version(), and ccnb_append_now_blob().
int ccnb_element_begin | ( | struct ccn_charbuf * | c, | |
enum ccn_dtag | dtag | |||
) |
Append a start-of-element marker.
Definition at line 369 of file ccn_buf_encoder.c.
Referenced by ccnb_append_face_instance(), ccnb_append_forwarding_entry(), and ccnb_append_header().
int ccnb_element_end | ( | struct ccn_charbuf * | c | ) |
Append an end-of-element marker.
This is the same as ccn_charbuf_append_closer()
Definition at line 379 of file ccn_buf_encoder.c.
Referenced by ccn_append_link_stuff(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), and ccnb_append_header().
int ccnb_tagged_putf | ( | struct ccn_charbuf * | c, | |
enum ccn_dtag | dtag, | |||
const char * | fmt, | |||
... | ||||
) |
Append a tagged UDATA string, with printf-style formatting.
This is a ccnb-encoded element with containing UDATA as content.
c | is the buffer to append to. | |
dtag | is the element's dtab. | |
fmt | is a printf-style format string, followed by its values |
Definition at line 421 of file ccn_buf_encoder.c.
Referenced by answer_highest(), answer_passive(), ccn_encode_StatusResponse(), ccn_signed_info_create(), ccnb_append_face_instance(), ccnb_append_forwarding_entry(), ccnb_append_header(), initialize_global_data(), local_scope_rm_template(), main(), make_template(), and stuff_link_check().