43 errstring = (
char *) XML_ErrorString(XML_GetErrorCode(s->
expat));
45 _sx_debug(
ZONE,
"XML parse error: %s; line: %d, column: %d, buffer: %.*s", errstring, XML_GetCurrentLineNumber(s->
expat), XML_GetCurrentColumnNumber(s->
expat), buf->
len, buf->
data);
69 errstring = (
char *) XML_ErrorString(XML_GetErrorCode(s->
expat));
90 const char *out;
int len;
96 if(
NAD_ENS(nad, 0) >= 0 &&
NAD_NURI_L(nad,
NAD_ENS(nad, 0)) == strlen(
uri_STREAMS) && strncmp(
NAD_NURI(nad,
NAD_ENS(nad, 0)),
uri_STREAMS, strlen(
uri_STREAMS)) == 0 &&
NAD_ENAME_L(nad, 0) == 5 && strncmp(
NAD_ENAME(nad, 0),
"error", 5) == 0) {
104 errstring = (
char *) malloc(
sizeof(
char) * (
NAD_CDATA_L(nad, elem) + 1));
109 if (errstring == NULL &&
NAD_CDATA_L(nad, 0) > 0) {
110 errstring = (
char *) malloc(
sizeof(
char) * (
NAD_CDATA_L(nad, 0) + 1));
115 if (errstring == NULL) {
120 errstring = (
char *) malloc(
sizeof(
char) * (xlen + 1));
121 sprintf(errstring,
"%.*s", xlen, xml);
130 if(errstring != NULL) free(errstring);
148 if(plugin_ret == 0) {
185 assert((
int) (s != NULL));
212 _sx_debug(
ZONE,
"decoded 0 bytes read data - this should not happen");
296 }
else if(ret == -2) {
322 assert((
int) (s != NULL));
358 }
else if(written < out->len) {
361 out->
data += written;
421 assert((
int) (s != NULL));
422 assert((
int) (nad != NULL));
438 log_debug(
ZONE,
"stream closed, dropping outgoing raw data");
455 assert((
int) (s != NULL));
456 assert((
int) (buf != NULL));
481 assert((
int) (s != NULL));
496 assert((
int) (s != NULL));
int _sx_chain_nad_write(sx_t s, nad_t nad, int elem)
int _sx_chain_io_write(sx_t s, sx_buf_t buf)
#define _sx_event(s, e, data)
#define NAD_CDATA_L(N, E)
void sx_nad_write_elem(sx_t s, nad_t nad, int elem)
app version
int _sx_raw_write(sx_t s, const char *buf, int len)
send raw data out
int nad_find_elem(nad_t nad, int elem, int ns, const char *name, int depth)
locate the next elem at a given depth with an optional matching name
int jqueue_size(jqueue_t q)
error info for event_ERROR
void sx_raw_write(sx_t s, const char *buf, int len)
app version
void nad_free(nad_t nad)
free that nad
int sx_can_read(sx_t s)
we can read
holds the state for a single stream
#define NAD_ENAME_L(N, E)
void jqueue_push(jqueue_t q, void *data, int priority)
#define NAD_NURI_L(N, NS)
void _sx_buffer_free(sx_buf_t buf)
utility: kill a buffer
sx_buf_t _sx_buffer_new(const char *data, int len, _sx_notify_t notify, void *notify_arg)
utility: make a new buffer if len>0 but data is NULL, the buffer will contain that many bytes of garb...
void _sx_process_read(sx_t s, sx_buf_t buf)
handler for read data
#define stream_err_POLICY_VIOLATION
void _sx_close(sx_t s)
close a stream
void * jqueue_pull(jqueue_t q)
int _sx_chain_nad_read(sx_t s, nad_t nad)
int _sx_chain_io_read(sx_t s, sx_buf_t buf)
void _sx_error(sx_t s, int err, const char *text)
send an error
#define stream_err_XML_NOT_WELL_FORMED
#define _sx_gen_error(e, c, g, s)
helper macro to populate this struct
int(* process)(sx_t s, sx_plugin_t p, nad_t nad)
static int _sx_get_pending_write(sx_t s)
we can write
int _sx_nad_write(sx_t s, nad_t nad, int elem)
send a new nad out
void nad_print(nad_t nad, int elem, const char **xml, int *len)
create a string representation of the given element (and children), point references to it ...
int nad_find_scoped_namespace(nad_t nad, const char *uri, const char *prefix)
find a namespace in scope