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" |
| 10 | #include "../Key.h" |
| 11 | #include "BinaryXMLEncoder.h" |
| 12 | #include "BinaryXMLDecoder.h" |
| 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 |
| 21 | * @param encoder pointer to the ndn_BinaryXMLEncoder struct |
| 22 | * @return 0 for success, else an error code |
| 23 | */ |
| 24 | ndn_Error ndn_encodeBinaryXMLKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXMLEncoder *encoder); |
| 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 |
| 29 | * @param decoder pointer to the ndn_BinaryXMLDecoder struct |
| 30 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 31 | */ |
| 32 | ndn_Error ndn_decodeBinaryXMLKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXMLDecoder *decoder); |
| 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 |
| 38 | * @param decoder pointer to the ndn_BinaryXMLDecoder struct |
| 39 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 40 | */ |
| 41 | ndn_Error ndn_decodeOptionalBinaryXMLKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXMLDecoder *decoder); |
| 42 | |
| 43 | #ifdef __cplusplus |
| 44 | } |
| 45 | #endif |
| 46 | |
| 47 | #endif |