![]() |
ndn-lite
|
High-level wrapper APIs providing convenience. More...
![]() |
Functions | |
int | tlv_make_data (uint8_t *buf, size_t buflen, size_t *result_size, int argc,...) |
All-in-one function to generate a Data packet. More... | |
int | tlv_parse_data (uint8_t *buf, size_t buflen, int argc,...) |
All-in-one function to parse a Data packet. More... | |
int | tlv_make_interest (uint8_t *buf, size_t buflen, size_t *result_size, int argc,...) |
All-in-one function to generate an Interest packet. More... | |
int | tlv_parse_interest (uint8_t *buf, size_t buflen, int argc,...) |
All-in-one function to parse an Interest packet. More... | |
void | tlv_encode_segno (name_component_t *comp, uint64_t val) |
Encode a name component from a segment number. More... | |
uint64_t | tlv_decode_segno (name_component_t *comp) |
Decode a name component into a segment number. More... | |
High-level wrapper APIs providing convenience.
enum TLV_DATAARG_TYPE |
The type of variant args of tlv_make_data and tlv_parse_data.
Enumerator | |
---|---|
TLV_DATAARG_NAME_PTR | A pointer to a name. make_data: [in] ndn_name_t* parse_data: [out] ndn_name_t* |
TLV_DATAARG_NAME_BUF | A pointer to an encoded TLV name. make_data: [in] parse_data: [out] |
TLV_DATAARG_NAME_SEGNO_U64 | Segment number. make_data: [in] parse_data: [out] |
TLV_DATAARG_CONTENTTYPE_U8 | Content type. make_data: [in] parse_data: [out] |
TLV_DATAARG_FRESHNESSPERIOD_U64 | Freshness period. make_data: [in] parse_data: [out] |
TLV_DATAARG_FINALBLOCKID_PTR | A pointer to a final block id. make_data: [in] name_component_t* parse_data: [out] name_component_t* |
TLV_DATAARG_FINALBLOCKID_BUF | A pointer to an encoded final block id. make_data: [in] parse_data: [out] |
TLV_DATAARG_FINALBLOCKID_U64 | A pointer to a final block id, in form of segment number. make_data: [in] parse_data: [out] |
TLV_DATAARG_CONTENT_BUF | Payload. make_data: [in, opt] parse_data: [out] |
TLV_DATAARG_CONTENT_SIZE | The size of make_data: [in] parse_data: [out] |
TLV_DATAARG_SIGTYPE_U8 | Signature type. make_data: [in] parse_data: [out] |
TLV_DATAARG_IDENTITYNAME_PTR | A pointer to the name of identity. make_data: [in, opt] ndn_name_t* parse_data: N/A |
TLV_DATAARG_SIGKEY_PTR | A pointer to the key. make_data: [in, opt] ndn_ecc_prv_t* or ndn_hmac_key_t* parse_data: [in, opt] ndn_ecc_pub_t* or ndn_hmac_key_t* |
TLV_DATAARG_SIGTIME_U64 | The signature timestamp. make_data: [in] parse_data: [out] |
TLV_DATAARG_VERIFY | Verify the Data after decoding. make_data: N/A parse_data: [in] |
enum TLV_INTARG_TYPE |
The type of variant args of tlv_make_interest.
Enumerator | |
---|---|
TLV_INTARG_NAME_PTR | A pointer to a name. make_interest: [in] ndn_name_t* parse_interest: [out] ndn_name_t* |
TLV_INTARG_NAME_BUF | A pointer to an encoded TLV name. make_interest: [in] parse_interest: [out] |
TLV_INTARG_NAME_SEGNO_U64 | Segment number. make_interest: [in] parse_interest: [out] |
TLV_INTARG_CANBEPREFIX_BOOL | CanBePrefix. make_interest: [in] parse_interest: [out] |
TLV_INTARG_MUSTBEFRESH_BOOL | MustBeFresh. make_interest: [in] parse_interest: [out] |
TLV_INTARG_LIFETIME_U64 | Interest lifetime in milliseconds. make_interest: [in] parse_interest: [out] |
TLV_INTARG_HOTLIMIT_U8 | Interest HopLimit. make_interest: [in] parse_interest: [out] |
TLV_INTARG_PARAMS_BUF | Interest parameters. make_interest: [in, opt] parse_interest: [out] |
TLV_INTARG_PARAMS_SIZE | The size of Interest parameters. make_interest: [in] parse_interest: [out] |
TLV_INTARG_SIGTYPE_U8 | Signature type. make_interest: [in] parse_interest: [out] |
TLV_INTARG_IDENTITYNAME_PTR | A pointer to the name of identity. make_interest: [in, opt] ndn_name_t* parse_interest: N/A |
TLV_INTARG_SIGKEY_PTR | A pointer to the key. make_interest: [in, opt] ndn_ecc_prv_t* or ndn_hmac_key_t* parse_interest: [in, opt] ndn_ecc_prv_t* or ndn_hmac_key_t* |
TLV_INTARG_VERIFY | Verify the Interest after decoding. make_interest: N/A parse_interest: [in] bool (promoted) |
uint64_t tlv_decode_segno | ( | name_component_t * | comp | ) |
Decode a name component into a segment number.
[in] | comp | Target component. |
(uint64_t)-1
if fails. void tlv_encode_segno | ( | name_component_t * | comp, |
uint64_t | val | ||
) |
Encode a name component from a segment number.
[out] | comp | Target component. |
[in] | val | The segment number. |
int tlv_make_data | ( | uint8_t * | buf, |
size_t | buflen, | ||
size_t * | result_size, | ||
int | argc, | ||
... | |||
) |
All-in-one function to generate a Data packet.
This function uses variant args to input optional parameters. The value of each variant arg should be given after its type. See TLV_DATAARG_TYPE for all supported variant arg types. An example:
[out] | buf | The buffer where Data is stored. result_size bytes are written. |
[in] | buflen | The available size of buf . |
[out] | result_size | [Optional] The encoded size of the Data packet. |
[in] | argc | The number of variant args, without counting the type. |
NDN_INVALID_ARG | An unknown argument is given; or no name is given. |
NDN_SEC_UNSUPPORT_SIGN_TYPE | Unsupported signature type. |
NDN_INVALID_POINTER | A non-optional pointer argument is NULL . Notice that some arguments are allowed to be NULL . |
result_size <= buflen
buf
to get result_size
only, but this is not possible under current back end. int tlv_make_interest | ( | uint8_t * | buf, |
size_t | buflen, | ||
size_t * | result_size, | ||
int | argc, | ||
... | |||
) |
All-in-one function to generate an Interest packet.
This function uses variant args to input optional parameters. The value of each variant arg should be given after its type. See TLV_INTARG_TYPE for all supported variant arg types. An example:
[out] | buf | The buffer where Interest is stored. result_size bytes are written. |
[in] | buflen | The available size of buf . |
[out] | result_size | [Optional] The encoded size of the Interest packet. |
[in] | argc | The number of variant args, without counting the type. |
NDN_INVALID_ARG | An unknown argument is given; or no name is given. |
NDN_SEC_UNSUPPORT_SIGN_TYPE | Unsupported signature type. |
NDN_INVALID_POINTER | A non-optional pointer argument is NULL . Notice that some arguments are allowed to be NULL . |
result_size <= buflen
buf
to get result_size
only, but this is not possible under current back end. int tlv_parse_data | ( | uint8_t * | buf, |
size_t | buflen, | ||
int | argc, | ||
... | |||
) |
All-in-one function to parse a Data packet.
This function uses variant args as input and output optional parameters. The value of each variant arg should be given after its type. See TLV_DATAARG_TYPE for all supported variant arg types. An example:
[in] | buf | The encoded TLV Data block. |
[in] | buflen | The size of buf . |
[in] | argc | The number of variant args, without counting the type. |
NDN_INVALID_ARG | An unknown argument is given. |
NDN_UNSUPPORTED_FORMAT | Unsupported Data format. |
NDN_SEC_UNSUPPORT_SIGN_TYPE | Unsupported signature type. |
NDN_INVALID_POINTER | A non-optional pointer argument is NULL . Notice that some arguments are allowed to be NULL . |
int tlv_parse_interest | ( | uint8_t * | buf, |
size_t | buflen, | ||
int | argc, | ||
... | |||
) |
All-in-one function to parse an Interest packet.
This function uses variant args as input and output optional parameters. The value of each variant arg should be given after its type. See TLV_INTARG_TYPE for all supported variant arg types. An example:
[in] | buf | The encoded TLV Interest block. |
[in] | buflen | The size of buf . |
[in] | argc | The number of variant args, without counting the type. |
NDN_INVALID_ARG | An unknown argument is given. |
NDN_UNSUPPORTED_FORMAT | Unsupported Interest format. |
NDN_SEC_UNSUPPORT_SIGN_TYPE | Unsupported signature type. |
NDN_INVALID_POINTER | A non-optional pointer argument is NULL . Notice that some arguments are allowed to be NULL . |