Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 1 | /** |
| 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" |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 10 | #include "../key.h" |
| 11 | #include "binary-xml-encoder.h" |
| 12 | #include "binary-xml-decoder.h" |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 21 | * @param encoder pointer to the ndn_BinaryXmlEncoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 22 | * @return 0 for success, else an error code |
| 23 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 24 | ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 25 | |
| 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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 29 | * @param decoder pointer to the ndn_BinaryXmlDecoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 30 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 31 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 32 | ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 33 | |
| 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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 38 | * @param decoder pointer to the ndn_BinaryXmlDecoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 39 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 40 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 41 | ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 42 | |
| 43 | #ifdef __cplusplus |
| 44 | } |
| 45 | #endif |
| 46 | |
| 47 | #endif |