diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-22 22:10:42 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-22 22:10:42 +0000 |
commit | 0cdc9f5a924c0f741372b7403ea10eae0a4cec24 (patch) | |
tree | 2a032cc17094287837587728b4076b49af7a0262 /pjlib-util/include | |
parent | 37a3c53aee2fa10f0d9317322fc4eccd18283aab (diff) |
Started errno framework in pjlib-util
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@217 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/include')
-rw-r--r-- | pjlib-util/include/pjlib-util.h | 20 | ||||
-rw-r--r-- | pjlib-util/include/pjlib-util/errno.h | 93 | ||||
-rw-r--r-- | pjlib-util/include/pjlib-util/stun.h | 11 |
3 files changed, 113 insertions, 11 deletions
diff --git a/pjlib-util/include/pjlib-util.h b/pjlib-util/include/pjlib-util.h index 0040d452..6ef91193 100644 --- a/pjlib-util/include/pjlib-util.h +++ b/pjlib-util/include/pjlib-util.h @@ -16,7 +16,27 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef __PJLIB_UTIL_H__ +#define __PJLIB_UTIL_H__ + +#include <pjlib-util/errno.h> #include <pjlib-util/md5.h> #include <pjlib-util/scanner.h> #include <pjlib-util/stun.h> #include <pjlib-util/xml.h> + + +PJ_BEGIN_DECL + +/** + * Initialize PJLIB UTIL (defined in errno.c) + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjlib_util_init(void); + + +PJ_END_DECL + + +#endif /* __PJLIB_UTIL_H__ */ diff --git a/pjlib-util/include/pjlib-util/errno.h b/pjlib-util/include/pjlib-util/errno.h new file mode 100644 index 00000000..7846fac8 --- /dev/null +++ b/pjlib-util/include/pjlib-util/errno.h @@ -0,0 +1,93 @@ +/* $Id */ +/* + * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJLIB_UTIL_ERRNO_H__ +#define __PJLIB_UTIL_ERRNO_H__ + + +#include <pj/errno.h> + + +/** + * Start of error code relative to PJ_ERRNO_START_USER. + */ +#define PJLIB_UTIL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3) + + +/************************************************************ + * STUN ERROR + ***********************************************************/ +/** + * @hideinitializer + * Unable to resolve STUN server + */ +#define PJLIB_UTIL_ESTUNRESOLVE (PJLIB_UTIL_ERRNO_START+1) +/** + * @hideinitializer + * Unknown STUN message type. + */ +#define PJLIB_UTIL_ESTUNINMSGTYPE (PJLIB_UTIL_ERRNO_START+2) +/** + * @hideinitializer + * Invalid STUN message length. + */ +#define PJLIB_UTIL_ESTUNINMSGLEN (PJLIB_UTIL_ERRNO_START+3) +/** + * @hideinitializer + * STUN attribute length error. + */ +#define PJLIB_UTIL_ESTUNINATTRLEN (PJLIB_UTIL_ERRNO_START+4) +/** + * @hideinitializer + * Invalid STUN attribute type + */ +#define PJLIB_UTIL_ESTUNINATTRTYPE (PJLIB_UTIL_ERRNO_START+5) +/** + * @hideinitializer + * Invalid STUN server/socket index + */ +#define PJLIB_UTIL_ESTUNININDEX (PJLIB_UTIL_ERRNO_START+6) +/** + * @hideinitializer + * No STUN binding response in the message + */ +#define PJLIB_UTIL_ESTUNNOBINDRES (PJLIB_UTIL_ERRNO_START+7) +/** + * @hideinitializer + * Received STUN error attribute + */ +#define PJLIB_UTIL_ESTUNRECVERRATTR (PJLIB_UTIL_ERRNO_START+8) +/** + * @hideinitializer + * No STUN mapped address attribute + */ +#define PJLIB_UTIL_ESTUNNOMAP (PJLIB_UTIL_ERRNO_START+9) +/** + * @hideinitializer + * Received no response from STUN server + */ +#define PJLIB_UTIL_ESTUNNOTRESPOND (PJLIB_UTIL_ERRNO_START+10) +/** + * @hideinitializer + * Symetric NAT detected by STUN + */ +#define PJLIB_UTIL_ESTUNSYMMETRIC (PJLIB_UTIL_ERRNO_START+11) + + + +#endif /* __PJLIB_UTIL_ERRNO_H__ */ diff --git a/pjlib-util/include/pjlib-util/stun.h b/pjlib-util/include/pjlib-util/stun.h index 353e07f6..0a431039 100644 --- a/pjlib-util/include/pjlib-util/stun.h +++ b/pjlib-util/include/pjlib-util/stun.h @@ -118,22 +118,11 @@ PJ_DECL(pj_status_t) pj_stun_parse_msg( void *buf, pj_size_t len, pj_stun_msg *msg); PJ_DECL(void*) pj_stun_msg_find_attr( pj_stun_msg *msg, pj_stun_attr_type t); -/* STUN simple client API (stun_client.c) */ -enum pj_stun_err_code { - PJ_STUN_ERR_MEMORY = (-2), - PJ_STUN_ERR_RESOLVE = (-3), - PJ_STUN_ERR_TRANSPORT = (-4), - PJ_STUN_ERR_INVALID_MSG = (-5), - PJ_STUN_ERR_NO_RESPONSE = (-6), - PJ_STUN_ERR_SYMETRIC = (-7), -}; - PJ_DECL(pj_status_t) pj_stun_get_mapped_addr( pj_pool_factory *pf, int sock_cnt, pj_sock_t sock[], const pj_str_t *srv1, int port1, const pj_str_t *srv2, int port2, pj_sockaddr_in mapped_addr[]); -PJ_DECL(const char*) pj_stun_get_err_msg(pj_status_t status); PJ_END_DECL |