Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #ifndef NDN_BINARY_XML_DATA_H |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 7 | #define NDN_BINARY_XML_DATA_H |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 8 | |
| 9 | #include "../errors.h" |
| 10 | #include "../data.h" |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 11 | #include "binary-xml-encoder.h" |
| 12 | #include "binary-xml-decoder.h" |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 13 | |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 14 | #ifdef __cplusplus |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 15 | extern "C" { |
| 16 | #endif |
| 17 | |
Jeff Thompson | aa02071 | 2013-08-08 21:20:06 -0700 | [diff] [blame] | 18 | /** |
Jeff Thompson | 2d4698a | 2013-08-12 11:28:34 -0700 | [diff] [blame] | 19 | * Encode the data packet as binary XML. |
Jeff Thompson | c87f39a | 2013-08-12 11:55:11 -0700 | [diff] [blame] | 20 | * @param data Pointer to the data object to encode. |
Jeff Thompson | aa02071 | 2013-08-08 21:20:06 -0700 | [diff] [blame] | 21 | * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed. |
Jeff Thompson | 49dc42e | 2013-08-12 11:30:37 -0700 | [diff] [blame] | 22 | * If you are not encoding in order to sign, you can ignore this returned value. |
Jeff Thompson | aa02071 | 2013-08-08 21:20:06 -0700 | [diff] [blame] | 23 | * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed. |
Jeff Thompson | 49dc42e | 2013-08-12 11:30:37 -0700 | [diff] [blame] | 24 | * If you are not encoding in order to sign, you can ignore this returned value. |
Jeff Thompson | 2d4698a | 2013-08-12 11:28:34 -0700 | [diff] [blame] | 25 | * @param encoder Pointer to the ndn_BinaryXmlEncoder struct which receives the encoding. |
| 26 | * @return 0 for success, else an error code. |
Jeff Thompson | aa02071 | 2013-08-08 21:20:06 -0700 | [diff] [blame] | 27 | */ |
| 28 | ndn_Error ndn_encodeBinaryXmlData |
| 29 | (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlEncoder *encoder); |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 2d4698a | 2013-08-12 11:28:34 -0700 | [diff] [blame] | 31 | /** |
Jeff Thompson | c87f39a | 2013-08-12 11:55:11 -0700 | [diff] [blame] | 32 | * Decode the data packet as binary XML and set the fields in the data object. |
| 33 | * @param data Pointer to the data object whose fields are updated. |
Jeff Thompson | 9e97b6d | 2013-08-12 11:31:24 -0700 | [diff] [blame] | 34 | * @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed. |
Jeff Thompson | 49dc42e | 2013-08-12 11:30:37 -0700 | [diff] [blame] | 35 | * If you are not decoding in order to verify, you can ignore this returned value. |
Jeff Thompson | 9e97b6d | 2013-08-12 11:31:24 -0700 | [diff] [blame] | 36 | * @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed. |
Jeff Thompson | 49dc42e | 2013-08-12 11:30:37 -0700 | [diff] [blame] | 37 | * If you are not decoding in order to verify, you can ignore this returned value. |
Jeff Thompson | 2d4698a | 2013-08-12 11:28:34 -0700 | [diff] [blame] | 38 | * @param decoder Pointer to the ndn_BinaryXmlDecoder struct which has been initialized with the buffer to decode. |
| 39 | * @return 0 for success, else an error code. |
| 40 | */ |
| 41 | ndn_Error ndn_decodeBinaryXmlData |
| 42 | (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlDecoder *decoder); |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 43 | |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 44 | #ifdef __cplusplus |
Jeff Thompson | 56ec9e2 | 2013-08-02 11:34:07 -0700 | [diff] [blame] | 45 | } |
| 46 | #endif |
| 47 | |
| 48 | #endif |