diff --git a/lib/hx509/ChangeLog b/lib/hx509/ChangeLog index fc13cddfa..48502146c 100644 --- a/lib/hx509/ChangeLog +++ b/lib/hx509/ChangeLog @@ -1,5 +1,9 @@ 2007-12-15 Love Hörnquist Åstrand + * hx509_err.et: add NO_STORE + + * More documentation + * lock.c: Add page referance * keyset.c: some more documentation. diff --git a/lib/hx509/doxygen.c b/lib/hx509/doxygen.c index 00604d719..31bdac571 100644 --- a/lib/hx509/doxygen.c +++ b/lib/hx509/doxygen.c @@ -45,6 +45,7 @@ * - @ref page_name * - @ref page_cert * - @ref page_keyset + * - @ref page_error * - @ref page_lock * - @ref page_revoke * - @ref page_cms @@ -56,6 +57,8 @@ /** @defgroup hx509 hx509 library */ +/** @defgroup hx509_error hx509 error functions + * See the @ref page_error for description and examples. */ /** @defgroup hx509_cert hx509 certificate functions * See the @ref page_cert for description and examples. */ /** @defgroup hx509_keyset hx509 certificate store functions @@ -71,3 +74,4 @@ /** @defgroup hx509_verify hx509 verification functions */ /** @defgroup hx509_lock hx509 lock functions * See the @ref page_lock for description and examples. */ +/** @defgroup hx509_query hx509 query functions */ diff --git a/lib/hx509/error.c b/lib/hx509/error.c index 5b036525a..9eeecb227 100644 --- a/lib/hx509/error.c +++ b/lib/hx509/error.c @@ -34,6 +34,12 @@ #include "hx_locl.h" RCSID("$Id$"); +/** + * @page page_error Hx509 error reporting functions + * + * See the library functions here: @ref hx509_error + */ + struct hx509_error_data { hx509_error next; int code; @@ -51,6 +57,14 @@ free_error_string(hx509_error msg) } } +/** + * Resets the error strings the hx509 context. + * + * @param context A hx509 context. + * + * @ingroup hx509_error + */ + void hx509_clear_error_string(hx509_context context) { @@ -58,6 +72,20 @@ hx509_clear_error_string(hx509_context context) context->error = NULL; } +/** + * Add an error message to the hx509 context. + * + * @param context A hx509 context. + * @param flags + * - HX509_ERROR_APPEND appends the error string to the old messages + (code is updated). + * @param code error code related to error message + * @param fmt error message format + * @param ap arguments to error message format + * + * @ingroup hx509_error + */ + void hx509_set_error_stringv(hx509_context context, int flags, int code, const char *fmt, va_list ap) @@ -86,6 +114,20 @@ hx509_set_error_stringv(hx509_context context, int flags, int code, } } +/** + * See hx509_set_error_stringv(). + * + * @param context A hx509 context. + * @param flags + * - HX509_ERROR_APPEND appends the error string to the old messages + (code is updated). + * @param code error code related to error message + * @param fmt error message format + * @param ... arguments to error message format + * + * @ingroup hx509_error + */ + void hx509_set_error_string(hx509_context context, int flags, int code, const char *fmt, ...) @@ -97,6 +139,17 @@ hx509_set_error_string(hx509_context context, int flags, int code, va_end(ap); } +/** + * Get an error string from context associated with error_code. + * + * @param context A hx509 context. + * @param error_code Get error message for this error code. + * + * @return error string, free with hx509_free_error_string(). + * + * @ingroup hx509_error + */ + char * hx509_get_error_string(hx509_context context, int error_code) { @@ -125,6 +178,32 @@ hx509_get_error_string(hx509_context context, int error_code) return rk_strpoolcollect(p); } +/** + * Free error string returned by hx509_get_error_string(). + * + * @param str error string to free. + * + * @ingroup hx509_error + */ + +void +hx509_free_error_string(char *str) +{ + free(str); +} + +/** + * Print error message and fatally exit from error code + * + * @param context A hx509 context. + * @param exit_code exit() code from process. + * @param error_code Error code for the reason to exit. + * @param fmt format string with the exit message. + * @param ... argument to format string. + * + * @ingroup hx509_error + */ + void hx509_err(hx509_context context, int exit_code, int error_code, const char *fmt, ...)