An icon image (description text to the right)

Kerberos Errors API


Types:

typedef long errcode_t;

The error code integer type. The value of each error code is determined by compile_et based on the four character name of the API the error codes belong to.


struct error_table {
    const char * const * const messages;
    int32_t base;
    int32_t count;
};

The error table type. This is the fallback error tables used if the bundle strings are not available. You can add and remove these from Kerberos Error's search path using add_error_table() and remove_error_table()


typedef void (*com_err_handler_t) (const char   *whoami, 
                                   errcode_t     code, 
                                   const char   *format, 
                                   va_list       args);

The com_err display hook callback. Your application should define this if it wants to use com_err() or com_err_va() to display error messages and does not want them printfed to stderr.


Functions:

char const *error_message (errcode_t code);

error_message() converts an error code to a UTF8 string so it can be reported to the user.


com_err_handler_t set_com_err_hook(com_err_handler_t handler);
com_err_handler_t reset_com_err_hook(void);

set_com_err_hook() sets the com_err display hook function to handler. reset_com_err_hook() sets it back to the default function, which fprintf's to stderr.


void com_err    (const char      *progname, 
                 errcode_t        code, 
                 const char      *format, ...);
void com_err_va (const char      *progname, 
                 errcode_t        code, 
                 const char      *format, 
                 va_list          args);

com_err() and com_err_va() print an error message using the com_err hook function. The default hook function prints a string of the form "progname: error_message (code> format" to stderr. You can set your own hook function with set_com_err_hook().


errcode_t add_error_table    (const struct error_table *et);
errcode_t remove_error_table (const struct error_table *et);

add_error_table() and remove_error_table() add and remove com_err C string error tables to the list of fallback error tables. These tables are searched after Kerberos Errors has failed to find a bundle string for the error code. You will only need these functions if your code does not have a bundle or if you do not install the strings list generated by the Kerberos Errors compile_et.