blob: cfbfa3d5f93d0695271b74e5b75d979849e55e42 [file] [log] [blame]
Jeff Thompson56ec9e22013-08-02 11:34:07 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_BINARY_XML_DATA_H
Jeff Thompsona0d18c92013-08-06 13:55:32 -07007#define NDN_BINARY_XML_DATA_H
Jeff Thompson56ec9e22013-08-02 11:34:07 -07008
9#include "../errors.h"
10#include "../data.h"
Jeff Thompson53412192013-08-06 13:35:50 -070011#include "binary-xml-encoder.h"
12#include "binary-xml-decoder.h"
Jeff Thompson56ec9e22013-08-02 11:34:07 -070013
Jeff Thompsona0d18c92013-08-06 13:55:32 -070014#ifdef __cplusplus
Jeff Thompson56ec9e22013-08-02 11:34:07 -070015extern "C" {
16#endif
17
Jeff Thompsonaa020712013-08-08 21:20:06 -070018/**
Jeff Thompson2d4698a2013-08-12 11:28:34 -070019 * Encode the data packet as binary XML.
Jeff Thompsonaa020712013-08-08 21:20:06 -070020 * @param data Pointer to the data object the encode.
21 * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed.
22 * If you are not encoding in order to sign, you can ignore this.
23 * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
24 * If you are not encoding in order to sign, you can ignore this.
Jeff Thompson2d4698a2013-08-12 11:28:34 -070025 * @param encoder Pointer to the ndn_BinaryXmlEncoder struct which receives the encoding.
26 * @return 0 for success, else an error code.
Jeff Thompsonaa020712013-08-08 21:20:06 -070027 */
28ndn_Error ndn_encodeBinaryXmlData
29 (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlEncoder *encoder);
Jeff Thompson56ec9e22013-08-02 11:34:07 -070030
Jeff Thompson2d4698a2013-08-12 11:28:34 -070031/**
32 * Decode the data packet as binary XML.
33 * @param data Pointer to the data object the decode.
34 * @param signedFieldsBeginOffset Return the offset in the encoding of the beginning of the fields which are signed.
35 * If you are not encoding in order to sign, you can ignore this.
36 * @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
37 * If you are not encoding in order to sign, you can ignore this.
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 */
41ndn_Error ndn_decodeBinaryXmlData
42 (struct ndn_Data *data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson56ec9e22013-08-02 11:34:07 -070043
Jeff Thompsona0d18c92013-08-06 13:55:32 -070044#ifdef __cplusplus
Jeff Thompson56ec9e22013-08-02 11:34:07 -070045}
46#endif
47
48#endif