summaryrefslogtreecommitdiff
path: root/src/upb_decoder.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2010-06-07 17:27:54 -0700
committerJoshua Haberman <joshua@reverberate.org>2010-06-07 17:27:54 -0700
commitfbc57ee4882eca6321f8e1f2f5a3b8fae448605b (patch)
tree073d6dd9f5e814d934f33ec4f91ef41c5acfc57f /src/upb_decoder.h
parentcfe0ef08c15d038865e9618af25de76c8304ad9e (diff)
More work on the decoder.
Diffstat (limited to 'src/upb_decoder.h')
-rw-r--r--src/upb_decoder.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/upb_decoder.h b/src/upb_decoder.h
index ea20d3d..d40d9fc 100644
--- a/src/upb_decoder.h
+++ b/src/upb_decoder.h
@@ -1,15 +1,16 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
- * upb_decoder implements a high performance, callback-based, stream-oriented
- * decoder (comparable to the SAX model in XML parsers). For parsing protobufs
- * into in-memory messages (a more DOM-like model), see the routines in
- * upb_msg.h, which are layered on top of this decoder.
+ * upb_decoder implements a high performance, streaming decoder for protobuf
+ * data that works by implementing upb_src and getting its data from a
+ * upb_bytesrc.
*
- * TODO: the decoder currently does not support returning unknown values. This
- * can easily be added when it is needed.
+ * The decoder does not currently support non-blocking I/O, in the sense that
+ * if the bytesrc returns UPB_STATUS_TRYAGAIN it is not possible to resume the
+ * decoder when data becomes available again. Support for this could be added,
+ * but it would add complexity and perhaps cost efficiency also.
*
- * Copyright (c) 2009 Joshua Haberman. See LICENSE for details.
+ * Copyright (c) 2009-2010 Joshua Haberman. See LICENSE for details.
*/
#ifndef UPB_DECODER_H_
@@ -17,8 +18,8 @@
#include <stdbool.h>
#include <stdint.h>
-#include "upb.h"
-#include "descriptor.h"
+#include "upb_def.h"
+#include "upb_srcsink.h"
#ifdef __cplusplus
extern "C" {
@@ -33,17 +34,17 @@ typedef struct upb_decoder upb_decoder;
// Allocates and frees a upb_decoder, respectively.
upb_decoder *upb_decoder_new(upb_msgdef *md);
-void upb_decoder_free(upb_decoder *p);
+void upb_decoder_free(upb_decoder *d);
// Resets the internal state of an already-allocated decoder. This puts it in a
// state where it has not seen any data, and expects the next data to be from
// the beginning of a new protobuf. Parsers must be reset before they can be
// used. A decoder can be reset multiple times.
-void upb_decoder_reset(upb_decoder *p, upb_bytesrc *bytesrc);
+void upb_decoder_reset(upb_decoder *d, upb_bytesrc *bytesrc);
// Returns a upb_src pointer by which the decoder can be used. The returned
-// upb_src is invalidated by upb_decoder_reset().
-upb_src *upb_decoder_getsrc(upb_decoder *p);
+// upb_src is invalidated by upb_decoder_reset() or upb_decoder_free().
+upb_src *upb_decoder_getsrc(upb_decoder *d);
#ifdef __cplusplus
} /* extern "C" */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback