size_t canl_io_read(canl_ctx cc, canl_io_handler io, void *buffer, size_t size, struct timeval *timeout);
size_t canl_io_write(canl_ctx cc, canl_io_handler io, void *buffer, size_t size, struct timeval *timeout);
-int canl_get_error(canl_ctx cc, char ** reason);
+int
+canl_get_error_code(canl_ctx cc);
+
+char *
+canl_get_error_message(canl_ctx);
+
int canl_io_close(canl_ctx cc, canl_io_handler io);
int canl_io_destroy(canl_ctx cc, canl_io_handler io);
}
}
+unsigned long
+canl_get_error_code(canl_ctx cc)
+{
+ glb_ctx *ctx = (glb_ctx*) cc;
+
+ if (ctx == NULL)
+ return -1;
+
+ return ctx->err_code;
+}
+
+char *
+canl_get_error_message(canl_ctx)
+{
+ glb_ctx *ctx = (glb_ctx*) cc;
+
+ if (ctx == NULL || ctx->err_msg == NULL)
+ return "No error available";
+
+ return ctx->err_msg;
+}
+
/*if the error code is known to colin, assign appropriate colin code
TODO go through ssl errors and assign appr. colin code
?preserve original one? */