From 6cbba81e8937d6793705608e7e68e83ec950dd2a Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 2 Feb 2006 19:15:03 +0000 Subject: Added framework for attaching custom error message handler git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@128 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/errno.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'pjlib/include/pj/errno.h') diff --git a/pjlib/include/pj/errno.h b/pjlib/include/pj/errno.h index ffb72c19..83e0c800 100644 --- a/pjlib/include/pj/errno.h +++ b/pjlib/include/pj/errno.h @@ -106,6 +106,29 @@ PJ_DECL(void) pj_set_netos_error(pj_status_t code); PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode, char *buf, pj_size_t bufsize); +/** + * Register strerror message handler for the specified error space. + * Application can register its own handler to supply the error message + * for the specified error code range. This handler will be called + * by #pj_strerror(). + * + * @param start_code The starting error code where the handler should + * be called to retrieve the error message. + * @param err_space The size of error space. The error code range then + * will fall in start_code to start_code+err_space-1 + * range. + * @param f The handler to be called when #pj_strerror() is + * supplied with error code that falls into this range. + * + * @return PJ_SUCCESS or the specified error code. The + * registration may fail when the error space has been + * occupied by other handler, or when there are too many + * handlers registered to PJLIB. + */ +PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code, + pj_status_t err_space, + pj_str_t (*f)(pj_status_t,char*, + pj_size_t)); /** * @hideinitializer -- cgit v1.2.3