summaryrefslogtreecommitdiff
path: root/src/rexmpp.h
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-09-18 15:05:34 +0300
committerdefanor <defanor@uberspace.net>2020-09-18 15:05:34 +0300
commit07717e84876b7e62e3a62dd0878e19692c6c2662 (patch)
treecc075a3e45b31191ae92968052f0aed7b3d32ac9 /src/rexmpp.h
parentc9b55c44dc4f31822cf9f3176f44ec283a63125b (diff)
Introduce XML input queue
Instead of processing XML elements from parser callbacks, they are now queued to be processed after parsing. This allows to explicitly return error codes from processing functions, as well as to reset the parser without relying on an additional stream state (REXMPP_STREAM_RESTART, which is removed).
Diffstat (limited to 'src/rexmpp.h')
-rw-r--r--src/rexmpp.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/rexmpp.h b/src/rexmpp.h
index 7fc535f..2dfbde8 100644
--- a/src/rexmpp.h
+++ b/src/rexmpp.h
@@ -96,8 +96,6 @@ enum stream_st {
REXMPP_STREAM_SM_ACKS,
/** Resuming a stream. */
REXMPP_STREAM_SM_RESUME,
- /** Restarting a stream. */
- REXMPP_STREAM_RESTART,
/** The streams are ready for use: messaging and other higher-level
things not covered here. */
REXMPP_STREAM_READY,
@@ -194,7 +192,9 @@ enum rexmpp_err {
/** A roster item is not found. */
REXMPP_E_ROSTER_ITEM_NOT_FOUND,
/** An erroneous parameter is supplied. */
- REXMPP_E_PARAM
+ REXMPP_E_PARAM,
+ /** A stream error. */
+ REXMPP_E_STREAM
};
typedef enum rexmpp_err rexmpp_err_t;
@@ -315,6 +315,8 @@ struct rexmpp
xmlParserCtxtPtr xml_parser;
xmlNodePtr current_element_root;
xmlNodePtr current_element;
+ xmlNodePtr input_queue;
+ xmlNodePtr input_queue_last;
/* TLS structures. */
void *tls_session_data;
@@ -379,11 +381,11 @@ rexmpp_err_t rexmpp_send (rexmpp_t *s, xmlNodePtr node);
library. If an application wants to track replies on its own, it
should use ::rexmpp_send.
*/
-void rexmpp_iq_new (rexmpp_t *s,
- const char *type,
- const char *to,
- xmlNodePtr payload,
- rexmpp_iq_callback_t cb);
+rexmpp_err_t rexmpp_iq_new (rexmpp_t *s,
+ const char *type,
+ const char *to,
+ xmlNodePtr payload,
+ rexmpp_iq_callback_t cb);
/**
@brief Determines the maximum time to wait before the next