blob: c069356fb114743c05623ff5fccce7174b9cc97f [file] [log] [blame]
Jeff Thompson9915bdd2013-07-11 11:27:09 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_BINARYXMLKEY_H
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07007#define NDN_BINARYXMLKEY_H
Jeff Thompson9915bdd2013-07-11 11:27:09 -07008
9#include "../errors.h"
Jeff Thompson53412192013-08-06 13:35:50 -070010#include "../key.h"
11#include "binary-xml-encoder.h"
12#include "binary-xml-decoder.h"
Jeff Thompson9915bdd2013-07-11 11:27:09 -070013
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070014#ifdef __cplusplus
Jeff Thompson9915bdd2013-07-11 11:27:09 -070015extern "C" {
16#endif
17
18/**
19 * Encode the ndn_KeyLocator struct using Binary XML. If keyLocator->type is -1, then do nothing.
20 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070021 * @param encoder pointer to the ndn_BinaryXmlEncoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070022 * @return 0 for success, else an error code
23 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070024ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070025
26/**
27 * Expect the next element to be a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
28 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070029 * @param decoder pointer to the ndn_BinaryXmlDecoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070030 * @return 0 for success, else an error code, including if the next element is not KeyLocator.
31 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070032ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070033
34/**
35 * Peek the next element and if it is a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
36 * Otherwise, set the ndn_KeyLocator struct to none.
37 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070038 * @param decoder pointer to the ndn_BinaryXmlDecoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070039 * @return 0 for success, else an error code, including if the next element is not KeyLocator.
40 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070041ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070042
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070043#ifdef __cplusplus
Jeff Thompson9915bdd2013-07-11 11:27:09 -070044}
45#endif
46
47#endif