blob: 6aecd206278d19ac13dc900caedfac4df0c1c46d [file] [log] [blame]
Jeff Thompson9915bdd2013-07-11 11:27:09 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson9915bdd2013-07-11 11:27:09 -07004 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NDN_BINARYXMLKEY_H
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07008#define NDN_BINARYXMLKEY_H
Jeff Thompson9915bdd2013-07-11 11:27:09 -07009
10#include "../errors.h"
Jeff Thompson53412192013-08-06 13:35:50 -070011#include "../key.h"
12#include "binary-xml-encoder.h"
13#include "binary-xml-decoder.h"
Jeff Thompson9915bdd2013-07-11 11:27:09 -070014
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070015#ifdef __cplusplus
Jeff Thompson9915bdd2013-07-11 11:27:09 -070016extern "C" {
17#endif
18
19/**
20 * Encode the ndn_KeyLocator struct using Binary XML. If keyLocator->type is -1, then do nothing.
21 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070022 * @param encoder pointer to the ndn_BinaryXmlEncoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070023 * @return 0 for success, else an error code
24 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070025ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070026
27/**
28 * Expect the next element to be a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
29 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070030 * @param decoder pointer to the ndn_BinaryXmlDecoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070031 * @return 0 for success, else an error code, including if the next element is not KeyLocator.
32 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070033ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070034
35/**
36 * Peek the next element and if it is a Binary XML KeyLocator and decode into the ndn_KeyLocator struct.
37 * Otherwise, set the ndn_KeyLocator struct to none.
38 * @param keyLocator pointer to the ndn_KeyLocator struct
Jeff Thompsonf0fea002013-07-30 17:22:42 -070039 * @param decoder pointer to the ndn_BinaryXmlDecoder struct
Jeff Thompson9915bdd2013-07-11 11:27:09 -070040 * @return 0 for success, else an error code, including if the next element is not KeyLocator.
41 */
Jeff Thompsonf0fea002013-07-30 17:22:42 -070042ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson9915bdd2013-07-11 11:27:09 -070043
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070044#ifdef __cplusplus
Jeff Thompson9915bdd2013-07-11 11:27:09 -070045}
46#endif
47
48#endif