blob: f5865baf846441348d4ccaf71af1841637218dfb [file] [log] [blame]
Jeff Thompson56ec9e22013-08-02 11:34:07 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson56ec9e22013-08-02 11:34:07 -07004 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NDN_BINARY_XML_DATA_H
Jeff Thompsona0d18c92013-08-06 13:55:32 -07008#define NDN_BINARY_XML_DATA_H
Jeff Thompson56ec9e22013-08-02 11:34:07 -07009
10#include "../errors.h"
11#include "../data.h"
Jeff Thompson53412192013-08-06 13:35:50 -070012#include "binary-xml-encoder.h"
13#include "binary-xml-decoder.h"
Jeff Thompson56ec9e22013-08-02 11:34:07 -070014
Jeff Thompsona0d18c92013-08-06 13:55:32 -070015#ifdef __cplusplus
Jeff Thompson56ec9e22013-08-02 11:34:07 -070016extern "C" {
17#endif
18
Jeff Thompsonaa020712013-08-08 21:20:06 -070019/**
Jeff Thompson2d4698a2013-08-12 11:28:34 -070020 * Encode the data packet as binary XML.
Jeff Thompsonc87f39a2013-08-12 11:55:11 -070021 * @param data Pointer to the data object to encode.
Jeff Thompson9c661702013-09-13 14:35:44 -070022 * @param signedPortionBeginOffset Return the offset in the encoding of the beginning of the signed portion.
Jeff Thompson49dc42e2013-08-12 11:30:37 -070023 * If you are not encoding in order to sign, you can ignore this returned value.
Jeff Thompson9c661702013-09-13 14:35:44 -070024 * @param signedPortionEndOffset Return the offset in the encoding of the end of the signed portion.
Jeff Thompson49dc42e2013-08-12 11:30:37 -070025 * If you are not encoding in order to sign, you can ignore this returned value.
Jeff Thompson2d4698a2013-08-12 11:28:34 -070026 * @param encoder Pointer to the ndn_BinaryXmlEncoder struct which receives the encoding.
27 * @return 0 for success, else an error code.
Jeff Thompsonaa020712013-08-08 21:20:06 -070028 */
29ndn_Error ndn_encodeBinaryXmlData
Jeff Thompson97223af2013-09-24 17:01:27 -070030 (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlEncoder *encoder);
Jeff Thompson56ec9e22013-08-02 11:34:07 -070031
Jeff Thompson2d4698a2013-08-12 11:28:34 -070032/**
Jeff Thompsonc87f39a2013-08-12 11:55:11 -070033 * Decode the data packet as binary XML and set the fields in the data object.
34 * @param data Pointer to the data object whose fields are updated.
Jeff Thompson9c661702013-09-13 14:35:44 -070035 * @param signedPortionBeginOffset Return the offset in the input buffer of the beginning of the signed portion.
Jeff Thompson49dc42e2013-08-12 11:30:37 -070036 * If you are not decoding in order to verify, you can ignore this returned value.
Jeff Thompson9c661702013-09-13 14:35:44 -070037 * @param signedPortionEndOffset Return the offset in the input buffer of the end of the signed portion.
Jeff Thompson49dc42e2013-08-12 11:30:37 -070038 * If you are not decoding in order to verify, you can ignore this returned value.
Jeff Thompson2d4698a2013-08-12 11:28:34 -070039 * @param decoder Pointer to the ndn_BinaryXmlDecoder struct which has been initialized with the buffer to decode.
40 * @return 0 for success, else an error code.
41 */
42ndn_Error ndn_decodeBinaryXmlData
Jeff Thompson97223af2013-09-24 17:01:27 -070043 (struct ndn_Data *data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset, struct ndn_BinaryXmlDecoder *decoder);
Jeff Thompson56ec9e22013-08-02 11:34:07 -070044
Jeff Thompsona0d18c92013-08-06 13:55:32 -070045#ifdef __cplusplus
Jeff Thompson56ec9e22013-08-02 11:34:07 -070046}
47#endif
48
49#endif