Bringing up TLS connections working.
[libradsec.git] / lib / err.c
index 71a8380..8d26d3c 100644 (file)
--- a/lib/err.c
+++ b/lib/err.c
@@ -1,5 +1,9 @@
 /* See the file COPYING for licensing information.  */
 
+#if defined HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -8,8 +12,8 @@
 
 const char *_errtxt[] = {
   "SUCCESS",                   /* 0 RSE_OK */
-  "NOMEM",                     /* 1 RSE_NOMEM */
-  "NYI -- not yet implemented",        /* 2 RSE_NOSYS */
+  "out of memory",             /* 1 RSE_NOMEM */
+  "not yet implemented",       /* 2 RSE_NOSYS */
   "invalid handle"             /* 3 RSE_INVALID_CTX */
   "invalid connection"         /* 4 RSE_INVALID_CONN */
   "connection type mismatch"   /* 5 RSE_CONN_TYPE_MISMATCH */
@@ -19,9 +23,9 @@ const char *_errtxt[] = {
   "libevent error"             /* 9 RSE_EVENT */
   "connection error"           /* 10 RSE_CONNERR */
   "invalid configuration file" /* 11 RSE_CONFIG */
-  "ERR 12"                     /*  RSE_ */
-  "ERR 13"                     /*  RSE_ */
-  "ERR 14"                     /*  RSE_ */
+  "authentication failed"      /* 12 RSE_BADAUTH */
+  "internal error"             /* 13 RSE_INTERNAL */
+  "SSL error"                  /* 14 RSE_SSLERR */
   "ERR 15"                     /*  RSE_ */
   "ERR 16"                     /*  RSE_ */
   "ERR 17"                     /*  RSE_ */
@@ -79,7 +83,8 @@ _rs_err_create (unsigned int code, const char *file, int line, const char *fmt,
 }
 
 static int
-_ctx_err_vpush_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, va_list args)
+_ctx_err_vpush_fl (struct rs_context *ctx, int code, const char *file,
+                  int line, const char *fmt, va_list args)
 {
   struct rs_error *err = _err_vcreate (code, file, line, fmt, args);
 
@@ -89,7 +94,7 @@ _ctx_err_vpush_fl (struct rs_handle *ctx, int code, const char *file, int line,
 }
 
 int
-rs_err_ctx_push (struct rs_handle *ctx, int code, const char *fmt, ...)
+rs_err_ctx_push (struct rs_context *ctx, int code, const char *fmt, ...)
 {
   va_list args;
   va_start (args, fmt);
@@ -99,7 +104,8 @@ rs_err_ctx_push (struct rs_handle *ctx, int code, const char *fmt, ...)
 }
 
 int
-rs_err_ctx_push_fl (struct rs_handle *ctx, int code, const char *file, int line, const char *fmt, ...)
+rs_err_ctx_push_fl (struct rs_context *ctx, int code, const char *file,
+                   int line, const char *fmt, ...)
 {
   va_list args;
   va_start (args, fmt);
@@ -116,7 +122,8 @@ _rs_err_conn_push_err (struct rs_connection *conn, struct rs_error *err)
 }
 
 static int
-_conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file, int line, const char *fmt, va_list args)
+_conn_err_vpush_fl (struct rs_connection *conn, int code, const char *file,
+                   int line, const char *fmt, va_list args)
 {
   struct rs_error *err = _err_vcreate (code, file, line, fmt, args);
 
@@ -136,7 +143,8 @@ rs_err_conn_push (struct rs_connection *conn, int code, const char *fmt, ...)
 }
 
 int
-rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file, int line, const char *fmt, ...)
+rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file,
+                    int line, const char *fmt, ...)
 {
   va_list args;
   va_start (args, fmt);
@@ -146,7 +154,7 @@ rs_err_conn_push_fl (struct rs_connection *conn, int code, const char *file, int
 }
 
 struct rs_error *
-rs_err_ctx_pop (struct rs_handle *ctx)
+rs_err_ctx_pop (struct rs_context *ctx)
 {
   struct rs_error *err;