/**
 * @author: Jeff Thompson
 * See COPYING for copyright and distribution information.
 */

#ifndef NDN_BINARYXMLELEMENTREADER_H
#define	NDN_BINARYXMLELEMENTREADER_H

#include "../errors.h"
#include "BinaryXMLStructureDecoder.h"
#include "../util/DynamicUCharArray.h"

#ifdef	__cplusplus
extern "C" {
#endif

/** An ndn_ElementListener struct holds a function pointer onReceivedElement.  You can extend this struct with data that
 * will be passed to onReceivedElement.
 */
struct ndn_ElementListener {
  void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength); /**< see ndn_ElementListener_init */
};

/**
 * Initialize an ndn_ElementListener struct to use the onReceivedElement function pointer.
 * @param self pointer to the ndn_ElementListener struct
 * @param onReceivedElement pointer to a function which is called when an entire binary XML element is received.
 * self is the pointer to this ndn_ElementListener struct.  See ndn_BinaryXMLElementReader_onReceivedData.
 */
static inline void ndn_ElementListener_init
  (struct ndn_ElementListener *self, void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength))
{
  self->onReceivedElement = onReceivedElement;
}
  
/**
 * A BinaryXmlElementReader lets you call ndn_BinaryXMLElementReader_onReceivedData multiple times which uses an
 * ndn_BinaryXMLStructureDecoder to detect the end of a binary XML element and calls
 * (*elementListener->onReceivedElement)(element, elementLength) with the element. 
 * This handles the case where a single call to onReceivedData may contain multiple elements.
 */
struct ndn_BinaryXMLElementReader {
  struct ndn_ElementListener *elementListener;
  struct ndn_BinaryXMLStructureDecoder structureDecoder;
  int usePartialData;
  struct ndn_DynamicUCharArray partialData;
  unsigned int partialDataLength;
};

/**
 * Initialize an ndn_BinaryXMLElementReader struct with the elementListener and a buffer for saving partial data.
 * @param self pointer to the ndn_BinaryXMLElementReader struct
 * @param elementListener pointer to the ndn_ElementListener used by ndn_BinaryXMLElementReader_onReceivedData.
 * @param buffer the allocated buffer.  If reallocFunction is null, this should be large enough to save a full element, perhaps 8000 bytes.
 * @param bufferLength the length of the buffer
 * @param reallocFunction see ndn_DynamicUCharArray_ensureLength.  This may be 0.
 */
static inline void ndn_BinaryXMLElementReader_init
  (struct ndn_BinaryXMLElementReader *self, struct ndn_ElementListener *elementListener,
   unsigned char *buffer, unsigned int bufferLength, unsigned char * (*reallocFunction)(unsigned char *, unsigned int))
{
  self->elementListener = elementListener;
  ndn_BinaryXMLStructureDecoder_init(&self->structureDecoder);
  self->usePartialData = 0;
  ndn_DynamicUCharArray_init(&self->partialData, buffer, bufferLength, reallocFunction);
}

/**
 * Continue to read binary XML data until the end of an element, then call (*elementListener->onReceivedElement)(element, elementLength).
 * The buffer passed to onReceivedElement is only valid during this call.  If you need the data later, you must copy.
 * @param self pointer to the ndn_BinaryXMLElementReader struct
 * @param data pointer to the buffer with the binary XML bytes
 * @param dataLength length of data
 * @return 0 for success, else an error code
 */
ndn_Error ndn_BinaryXMLElementReader_onReceivedData
  (struct ndn_BinaryXMLElementReader *self, unsigned char *data, unsigned int dataLength);

#ifdef	__cplusplus
}
#endif

#endif
