/* Authentication ************************************************************/
+/** @brief Called with the greeting from the server */
static void authbanner_opcallback(disorder_eclient *c,
struct operation *op) {
size_t nonce_len;
(char *)0);
}
+/** @brief Called with the response to the @c user command */
static void authuser_opcallback(disorder_eclient *c,
struct operation *op) {
char *r;
if(rr && *rr)
((disorder_eclient_string_response *)op->completed)(op->v, *rr);
else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
} else
((disorder_eclient_string_response *)op->completed)(op->v,
c->line + 4);
}
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
((disorder_eclient_integer_response *)op->completed)
(op->v, strtol(c->line + 4, 0, 10));
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
if(op->completed)
((disorder_eclient_no_response *)op->completed)(op->v);
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
void *u) {
struct operation *op = u;
+ /* TODO don't use protocol_error here */
protocol_error(op->client, op, -1, "error parsing queue entry: %s", msg);
}
if(op->completed)
((disorder_eclient_queue_response *)op->completed)(op->v, qh);
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
q = 0;
break;
default:
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
return;
}
if(op->completed)
((disorder_eclient_queue_response *)op->completed)(op->v, q);
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
c->vec.nvec,
c->vec.vec);
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
if(c->rc / 100 == 2) {
if(op->completed) {
if(sscanf(c->line + 4, "%d %d", &l, &r) != 2 || l < 0 || r < 0)
+ /* TODO don't use protocol_error here */
protocol_error(c, op, -1, "%s: invalid volume response: %s",
c->ident, c->line);
else
((disorder_eclient_volume_response *)op->completed)(op->v, l, r);
}
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
((disorder_eclient_list_response *)op->completed)(op->v, nvec, vec);
}
} else
+ /* TODO don't use protocol_error here */
protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
}
/* error callback for log line parsing */
static void logline_error(const char *msg, void *u) {
disorder_eclient *c = u;
+ /* TODO don't use protocol_error here */
protocol_error(c, c->ops, -1, "error parsing log line: %s", msg);
}
* reported */
if(sscanf(vec[0], "%"SCNxMAX, &when) != 1) {
/* probably the wrong side of a format change */
+ /* TODO don't use protocol_error here */
protocol_error(c, c->ops, -1, "invalid log timestamp '%s'", vec[0]);
return;
}
* These must all be valid.
*/
typedef struct disorder_eclient_callbacks {
- /** @brief Called when a communication error (e.g. connected refused) occurs.
+ /** @brief Called when a communication error occurs.
* @param u from disorder_eclient_new()
* @param msg error message
+ *
+ * This might be called at any time, and indicates a low-level error,
+ * e.g. connection refused by the server. It does not mean that any requests
+ * made of the owning eclient will not be fulfilled at some point.
*/
void (*comms_error)(void *u, const char *msg);
* @param u from disorder_eclient_new()
* @param v from failed command, or NULL if during setup
* @param msg error message
+ *
+ * This call is obsolete at least in its current form, in which it is used to
+ * report most errors from most requests. Ultimately requests-specific
+ * errors will be reported in a request-specific way rather than via this
+ * generic callback.
*/
void (*protocol_error)(void *u, void *v, int code, const char *msg);