blob: 8ccbcac9cb5ef252f2f7548f8108172917b481cf [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
7#define NDN_BINARYXMLKEY_H
8
9#include "../errors.h"
10#include "../Key.h"
11#include "BinaryXMLEncoder.h"
12#include "BinaryXMLDecoder.h"
13
14#ifdef __cplusplus
15extern "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
43#ifdef __cplusplus
44}
45#endif
46
47#endif