Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 1 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 2 | * Copyright (C) 2013 Regents of the University of California. |
| 3 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_BINARYXMLKEY_H |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 8 | #define NDN_BINARYXMLKEY_H |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 9 | |
Jeff Thompson | 98ec85a | 2013-12-17 11:57:56 -0800 | [diff] [blame] | 10 | #include "../key-locator.h" |
Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 11 | #include "../errors.h" |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 12 | #include "binary-xml-encoder.h" |
| 13 | #include "binary-xml-decoder.h" |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 15 | #ifdef __cplusplus |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 16 | extern "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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 22 | * @param encoder pointer to the ndn_BinaryXmlEncoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 23 | * @return 0 for success, else an error code |
| 24 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 25 | ndn_Error ndn_encodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlEncoder *encoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 26 | |
| 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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 30 | * @param decoder pointer to the ndn_BinaryXmlDecoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 31 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 32 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 33 | ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 34 | |
| 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 Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 39 | * @param decoder pointer to the ndn_BinaryXmlDecoder struct |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 40 | * @return 0 for success, else an error code, including if the next element is not KeyLocator. |
| 41 | */ |
Jeff Thompson | f0fea00 | 2013-07-30 17:22:42 -0700 | [diff] [blame] | 42 | ndn_Error ndn_decodeOptionalBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder); |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 43 | |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 44 | #ifdef __cplusplus |
Jeff Thompson | 9915bdd | 2013-07-11 11:27:09 -0700 | [diff] [blame] | 45 | } |
| 46 | #endif |
| 47 | |
| 48 | #endif |