diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-03-18 17:39:27 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-03-18 17:39:27 +0000 |
commit | 25c436a6432ebac429285c81f990653a4c52dd3c (patch) | |
tree | 8f145c79bd09aa7bd7390100f809ca72bf2f069b /pjnath/include | |
parent | 331af12f95e6c79555ce45e5ea9c387fd70915dc (diff) |
Changed pj_sockaddr structure and added pjnath project for ICE/STUN stuffs
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1080 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/include')
-rw-r--r-- | pjnath/include/pjnath.h | 27 | ||||
-rw-r--r-- | pjnath/include/pjnath/config.h | 65 | ||||
-rw-r--r-- | pjnath/include/pjnath/errno.h | 152 | ||||
-rw-r--r-- | pjnath/include/pjnath/ice.h | 253 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_auth.h | 12 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_doc.h | 14 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_endpoint.h | 30 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_msg.h | 20 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_session.h | 22 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_transaction.h | 22 | ||||
-rw-r--r-- | pjnath/include/pjnath/turn_client.h | 12 | ||||
-rw-r--r-- | pjnath/include/pjnath/types.h | 63 |
12 files changed, 624 insertions, 68 deletions
diff --git a/pjnath/include/pjnath.h b/pjnath/include/pjnath.h new file mode 100644 index 00000000..7562120a --- /dev/null +++ b/pjnath/include/pjnath.h @@ -0,0 +1,27 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2007 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 + */ + +#include <pjnath/config.h> +#include <pjnath/errno.h> +#include <pjnath/stun_auth.h> +#include <pjnath/stun_endpoint.h> +#include <pjnath/stun_msg.h> +#include <pjnath/stun_session.h> +#include <pjnath/stun_transaction.h> +#include <pjnath/types.h> diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h new file mode 100644 index 00000000..fc3e004e --- /dev/null +++ b/pjnath/include/pjnath/config.h @@ -0,0 +1,65 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2007 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 __PJNATH_CONFIG_H__ +#define __PJNATH_CONFIG_H__ + + +/** + * @file config.h + * @brief Compile time settings + */ + +/** + * @defgroup PJNATH_CONFIG Configuration + * @ingroup PJNATH + * @{ + */ + +/* ************************************************************************** + * STUN CLIENT CONFIGURATION + */ + +/** + * Maximum number of attributes in the STUN packet (for the old STUN + * library). + * + * Default: 16 + */ +#ifndef PJSTUN_MAX_ATTR +# define PJSTUN_MAX_ATTR 16 +#endif + + +/** + * Maximum number of attributes in the STUN packet (for the new STUN + * library). + * + * Default: 16 + */ +#ifndef PJ_STUN_MAX_ATTR +# define PJ_STUN_MAX_ATTR 16 +#endif + + +/** + * @} + */ + +#endif /* __PJNATH_CONFIG_H__ */ + diff --git a/pjnath/include/pjnath/errno.h b/pjnath/include/pjnath/errno.h new file mode 100644 index 00000000..cbefee85 --- /dev/null +++ b/pjnath/include/pjnath/errno.h @@ -0,0 +1,152 @@ +/* $Id$ */ +/* + * Copyright (C)2003-2007 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 __PJNATH_ERRNO_H__ +#define __PJNATH_ERRNO_H__ + + +#include <pj/errno.h> + +/** + * @defgroup PJNATH_ERROR NAT Helper Error Codes + * @ingroup PJNATH + * @{ + */ + +/** + * Start of error code relative to PJ_ERRNO_START_USER. + * This value is 370000. + */ +#define PJNATH_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4) + + + +/************************************************************ + * NEW STUN ERROR + ***********************************************************/ +/* Messaging errors */ +#define PJNATH_ESTUNINATTRLEN -1 +#define PJNATH_ESTUNINMSGLEN -1 +#define PJNATH_ESTUNINMSGTYPE -1 +#define PJNATH_ESTUNFINGERPRINT -1 +#define PJNATH_ESTUNNOTRESPOND -1 + +/** + * @hideinitializer + * Too many STUN attributes. + */ +#define PJNATH_ESTUNTOOMANYATTR (PJNATH_ERRNO_START+110)/* 370110 */ +/** + * @hideinitializer + * Unknown STUN attribute. This error happens when the decoder encounters + * mandatory attribute type which it doesn't understand. + */ +#define PJNATH_ESTUNUNKNOWNATTR (PJNATH_ERRNO_START+111)/* 370111 */ +/** + * @hideinitializer + * Invalid STUN socket address length. + */ +#define PJNATH_ESTUNINADDRLEN (PJNATH_ERRNO_START+112)/* 370112 */ +/** + * @hideinitializer + * STUN IPv6 attribute not supported + */ +#define PJNATH_ESTUNIPV6NOTSUPP (PJNATH_ERRNO_START+113)/* 370113 */ +/** + * @hideinitializer + * Expecting STUN response message. + */ +#define PJNATH_ESTUNNOTRESPONSE (PJNATH_ERRNO_START+114)/* 370114 */ +/** + * @hideinitializer + * STUN transaction ID mismatch. + */ +#define PJNATH_ESTUNINVALIDID (PJNATH_ERRNO_START+115)/* 370115 */ +/** + * @hideinitializer + * Unable to find handler for the request. + */ +#define PJNATH_ESTUNNOHANDLER (PJNATH_ERRNO_START+116)/* 370116 */ +/** + * @hideinitializer + * Found non-FINGERPRINT attribute after MESSAGE-INTEGRITY. This is not + * valid since MESSAGE-INTEGRITY MUST be the last attribute or the + * attribute right before FINGERPRINT before the message. + */ +#define PJNATH_ESTUNMSGINTPOS (PJNATH_ERRNO_START+118)/* 370118 */ +/** + * @hideinitializer + * Found attribute after FINGERPRINT. This is not valid since FINGERPRINT + * MUST be the last attribute in the message. + */ +#define PJNATH_ESTUNFINGERPOS (PJNATH_ERRNO_START+119)/* 370119 */ +/** + * @hideinitializer + * Missing STUN USERNAME attribute. + * When credential is included in the STUN message (MESSAGE-INTEGRITY is + * present), the USERNAME attribute must be present in the message. + */ +#define PJNATH_ESTUNNOUSERNAME (PJNATH_ERRNO_START+120)/* 370120 */ +/** + * @hideinitializer + * Unknown STUN username/credential. + */ +#define PJNATH_ESTUNUSERNAME (PJNATH_ERRNO_START+121)/* 370121 */ +/** + * @hideinitializer + * Missing/invalidSTUN MESSAGE-INTEGRITY attribute. + */ +#define PJNATH_ESTUNMSGINT (PJNATH_ERRNO_START+122)/* 370122 */ +/** + * @hideinitializer + * Found duplicate STUN attribute. + */ +#define PJNATH_ESTUNDUPATTR (PJNATH_ERRNO_START+123)/* 370123 */ +/** + * @hideinitializer + * Missing STUN REALM attribute. + */ +#define PJNATH_ESTUNNOREALM (PJNATH_ERRNO_START+124)/* 370124 */ +/** + * @hideinitializer + * Missing/stale STUN NONCE attribute value. + */ +#define PJNATH_ESTUNNONCE (PJNATH_ERRNO_START+125)/* 370125 */ +/** + * @hideinitializer + * STUN transaction terminates with failure. + */ +#define PJNATH_ESTUNTSXFAILED (PJNATH_ERRNO_START+126)/* 370126 */ + + +//#define PJ_STATUS_FROM_STUN_CODE(code) (PJNATH_ERRNO_START+code) + + +/** + * @hideinitializer + * No ICE checklist is formed. + */ +#define PJ_EICENOCHECKLIST -1 + + + +/** + * @} + */ + +#endif /* __PJNATH_ERRNO_H__ */ diff --git a/pjnath/include/pjnath/ice.h b/pjnath/include/pjnath/ice.h new file mode 100644 index 00000000..3277dc77 --- /dev/null +++ b/pjnath/include/pjnath/ice.h @@ -0,0 +1,253 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2005 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 __PJNATH_ICE_SOCK_H__ +#define __PJNATH_ICE_SOCK_H__ + +/** + * @file ice_sock.h + * @brief ICE socket. + */ +#include <pjnath/types.h> +#include <pjnath/stun_endpoint.h> +#include <pjlib-util/resolver.h> +#include <pj/sock.h> + +PJ_BEGIN_DECL + + +/* **************************************************************************/ +/** + * @defgroup PJNATH_ICE_SOCK ICE Socket + * @brief High level ICE socket abstraction. + * @ingroup PJNATH + * @{ + */ + +/** + * This enumeration describes the type of an ICE candidate. + */ +typedef enum pj_ice_cand_type +{ + PJ_ICE_CAND_TYPE_HOST, + PJ_ICE_CAND_TYPE_MAPPED, + PJ_ICE_CAND_TYPE_PEER_MAPPED, + PJ_ICE_CAND_TYPE_RELAYED +} pj_ice_cand_type; + +/** + * + */ +enum pj_ice_type_pref +{ + PJ_ICE_HOST_PREF = 126, + PJ_ICE_MAPPED_PREF = 100, + PJ_ICE_PEER_MAPPED_PREF = 110, + PJ_ICE_RELAYED_PREF = 0 +}; + +typedef struct pj_ice pj_ice; + + +#define PJ_ICE_MAX_CAND 32 +#define PJ_ICE_MAX_COMP 8 + + +/** + * ICE component + */ +typedef struct pj_ice_comp +{ + unsigned comp_id; + pj_sock_t sock; +} pj_ice_comp; + + +/** + * This structure describes an ICE candidate. + */ +typedef struct pj_ice_cand +{ + pj_uint32_t comp_id; + pj_ice_cand_type type; + pj_str_t foundation; + pj_uint32_t prio; + pj_sockaddr addr; + pj_sockaddr base_addr; + pj_sockaddr srv_addr; +} pj_ice_cand; + +typedef enum pj_ice_check_state +{ + PJ_ICE_CHECK_STATE_FROZEN, + PJ_ICE_CHECK_STATE_WAITING, + PJ_ICE_CHECK_STATE_IN_PROGRESS, + PJ_ICE_CHECK_STATE_SUCCEEDED, + PJ_ICE_CHECK_STATE_FAILED +} pj_ice_check_state; + + +typedef struct pj_ice_check +{ + unsigned local_cand_id; + pj_uint64_t check_prio; + pj_ice_check_state check_state; + + pj_ice_cand_type rem_type; + pj_str_t rem_foundation; + pj_uint32_t rem_prio; + pj_sockaddr rem_addr; + pj_sockaddr rem_base_addr; +} pj_ice_check; + + +typedef enum pj_ice_checklist_state +{ + PJ_ICE_CHECKLIST_ST_IDLE, + PJ_ICE_CHECKLIST_ST_RUNNING, + PJ_ICE_CHECKLIST_ST_COMPLETED +} pj_ice_checklist_state; + +typedef struct pj_ice_checklist +{ + pj_ice_checklist_state state; + unsigned count; + pj_ice_check *checks; +} pj_ice_checklist; + + +/** + * ICE sock callback. + */ +typedef struct pj_ice_cb +{ + pj_bool_t (*on_found_cand)(pj_ice *sock, + pj_ice_cand_type type, + const pj_sockaddr_t *addr, + int addr_len); +} pj_ice_cb; + + +typedef enum pj_ice_state +{ + PJ_ICE_STATE_INIT, + PJ_ICE_STATE_GATHERING, + PJ_ICE_STATE_CAND_COMPLETE, + PJ_ICE_STATE_CHECKING, + PJ_ICE_STATE_COMPLETE, + PJ_ICE_STATE_RESV_ERROR +} pj_ice_state; + +/** + * ICE structure. + */ +struct pj_ice +{ + char obj_name[PJ_MAX_OBJ_NAME]; + + pj_pool_t *pool; + pj_mutex_t *mutex; + int af; + int sock_type; + + pj_ice_state state; + + /* Components */ + unsigned comp_cnt; + pj_ice_comp comp[PJ_ICE_MAX_COMP]; + + /* Local candidates */ + unsigned cand_cnt; + pj_ice_cand cand[PJ_ICE_MAX_CAND]; + + /* Checklist */ + pj_ice_checklist cklist; + + /* STUN servers */ + pj_dns_resolver *resv; + pj_dns_async_query *resv_q; + pj_bool_t relay_enabled; + pj_sockaddr stun_srv; +}; + + +PJ_DECL(pj_status_t) pj_ice_create(pj_stun_config *cfg, + const char *name, + int af, + int sock_type, + pj_ice **p_ice); +PJ_DECL(pj_status_t) pj_ice_destroy(pj_ice *ice); +PJ_DECL(pj_status_t) pj_ice_set_srv(pj_ice *ice, + pj_bool_t enable_relay, + pj_dns_resolver *resolver, + const pj_str_t *domain); +PJ_DECL(pj_status_t) pj_ice_set_srv_addr(pj_ice *ice, + pj_bool_t enable_relay, + const pj_sockaddr_t *srv_addr, + unsigned addr_len); +PJ_DECL(pj_status_t) pj_ice_add_comp(pj_ice *ice, + unsigned comp_id, + const pj_sockaddr_t *local_addr, + unsigned addr_len); +PJ_DECL(pj_status_t) pj_ice_add_sock_comp(pj_ice *ice, + unsigned comp_id, + pj_sock_t sock); + +PJ_DECL(pj_status_t) pj_ice_start_gather(pj_ice *ice, + unsigned flags); + +PJ_DECL(pj_status_t) pj_ice_add_cand(pj_ice *ice, + unsigned comp_id, + pj_ice_cand_type type, + pj_uint16_t local_pref, + const pj_str_t *foundation, + const pj_sockaddr_t *addr, + const pj_sockaddr_t *base_addr, + const pj_sockaddr_t *srv_addr, + int addr_len, + unsigned *cand_id); + +PJ_DECL(unsigned) pj_ice_get_cand_cnt(pj_ice *ice); +PJ_DECL(pj_status_t) pj_ice_enum_cands(pj_ice *ice, + unsigned sort_by, + unsigned *p_count, + unsigned cand_ids[]); +PJ_DECL(unsigned) pj_ice_get_default_cand(pj_ice *ice, + int *cand_id); +PJ_DECL(pj_status_t) pj_ice_get_cand(pj_ice *ice, + unsigned cand_id, + pj_ice_cand **p_cand); + +PJ_DECL(pj_status_t) pj_ice_create_check_list(pj_ice *ice, + pj_bool_t is_remote_offer, + unsigned rem_cand_cnt, + const pj_ice_cand rem_cand[]); + +PJ_DECL(pj_status_t) pj_ice_start_check(pj_ice *ice); + + +/** + * @} + */ + + +PJ_END_DECL + + +#endif /* __PJNATH_ICE_SOCK_H__ */ + diff --git a/pjnath/include/pjnath/stun_auth.h b/pjnath/include/pjnath/stun_auth.h index 49b2acbb..e30ebc95 100644 --- a/pjnath/include/pjnath/stun_auth.h +++ b/pjnath/include/pjnath/stun_auth.h @@ -16,15 +16,15 @@ * 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_STUN_AUTH_H__ -#define __PJLIB_UTIL_STUN_AUTH_H__ +#ifndef __PJNATH_STUN_AUTH_H__ +#define __PJNATH_STUN_AUTH_H__ /** * @file stun_auth.h * @brief STUN authentication. */ -#include <pjlib-util/stun_msg.h> +#include <pjnath/stun_msg.h> PJ_BEGIN_DECL @@ -32,8 +32,8 @@ PJ_BEGIN_DECL /* **************************************************************************/ /** - * @defgroup PJLIB_UTIL_STUN_AUTH STUN Authentication - * @ingroup PJLIB_UTIL_STUN + * @defgroup PJNATH_STUN_AUTH STUN Authentication + * @ingroup PJNATH_STUN * @{ */ @@ -271,5 +271,5 @@ void pj_stun_calc_md5_key(pj_uint8_t digest[16], PJ_END_DECL -#endif /* __PJLIB_UTIL_STUN_AUTH_H__ */ +#endif /* __PJNATH_STUN_AUTH_H__ */ diff --git a/pjnath/include/pjnath/stun_doc.h b/pjnath/include/pjnath/stun_doc.h index 612bf1a7..7b5e6511 100644 --- a/pjnath/include/pjnath/stun_doc.h +++ b/pjnath/include/pjnath/stun_doc.h @@ -24,8 +24,8 @@ */ /** - * @defgroup PJLIB_UTIL_STUN STUN and TURN - * @ingroup PJLIB_UTIL + * @defgroup PJNATH_STUN STUN and TURN + * @ingroup PJNATH This is the implementation of STUN/TURN in PJLIB-UTIL library. @@ -54,7 +54,7 @@ @subsection stun_msg_sec Messaging and Parsing - The lowest layer of the STUN implementation is the @ref PJLIB_UTIL_STUN_MSG + The lowest layer of the STUN implementation is the @ref PJNATH_STUN_MSG component. This part is responsible for encoding and decoding STUN messages. This layer only implements message representation and parsing. In particular, @@ -65,7 +65,7 @@ @subsection stun_endpt_sec Endpoint - The @ref PJLIB_UTIL_STUN_ENDPOINT is used by the library to put together + The @ref PJNATH_STUN_ENDPOINT is used by the library to put together common settings for all STUN objects. For example, the STUN endpoint has a reference of timer heap to poll all STUN timers, reference to ioqueue to poll network events for STUN servers, and some common settings used by @@ -74,11 +74,11 @@ @subsection stun_clt_tsx_sec Client Transaction - The @ref PJLIB_UTIL_STUN_TRANSACTION is used to manage outgoing STUN request, + The @ref PJNATH_STUN_TRANSACTION is used to manage outgoing STUN request, for example to retransmit the request and to notify application about the completion of the request. - The @ref PJLIB_UTIL_STUN_TRANSACTION does not use any networking operations, + The @ref PJNATH_STUN_TRANSACTION does not use any networking operations, but instead application must supply the transaction with a callback to be used by the transaction to send outgoing requests. This way the STUN transaction is made more generic and can work with different types of @@ -88,7 +88,7 @@ @subsection stun_srv_sec Server Components - The @ref PJLIB_UTIL_STUN_SERVER is used for: + The @ref PJNATH_STUN_SERVER is used for: - implementing STUN servers, and/or - implementing server side STUN handling (for example for ICE). diff --git a/pjnath/include/pjnath/stun_endpoint.h b/pjnath/include/pjnath/stun_endpoint.h index b341309a..d9a32b5c 100644 --- a/pjnath/include/pjnath/stun_endpoint.h +++ b/pjnath/include/pjnath/stun_endpoint.h @@ -16,15 +16,15 @@ * 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_STUN_ENDPOINT_H__ -#define __PJLIB_UTIL_STUN_ENDPOINT_H__ +#ifndef __PJNATH_STUN_CONFIG_H__ +#define __PJNATH_STUN_CONFIG_H__ /** - * @file stun_endpoint.h + * @file stun_config.h * @brief STUN endpoint. */ -#include <pjlib-util/stun_msg.h> +#include <pjnath/stun_msg.h> PJ_BEGIN_DECL @@ -32,9 +32,9 @@ PJ_BEGIN_DECL /* **************************************************************************/ /** - * @defgroup PJLIB_UTIL_STUN_ENDPOINT STUN Endpoint + * @defgroup PJNATH_STUN_ENDPOINT STUN Endpoint * @brief Management of incoming and outgoing STUN transactions. - * @ingroup PJLIB_UTIL_STUN + * @ingroup PJNATH_STUN * @{ */ @@ -43,7 +43,7 @@ PJ_BEGIN_DECL * server STUN transactions, and it needs to be initialized before application * can send or receive STUN messages. */ -typedef struct pj_stun_endpoint +typedef struct pj_stun_config { /** * Pool factory to be used by the STUN endpoint and all objects created @@ -86,23 +86,23 @@ typedef struct pj_stun_endpoint */ unsigned res_cache_msec; -} pj_stun_endpoint; +} pj_stun_config; /** * Create a STUN endpoint instance. */ -PJ_DECL(pj_status_t) pj_stun_endpoint_create(pj_pool_factory *factory, - unsigned options, - pj_ioqueue_t *ioqueue, - pj_timer_heap_t *timer_heap, - pj_stun_endpoint **p_endpt); +PJ_DECL(pj_status_t) pj_stun_config_create(pj_pool_factory *factory, + unsigned options, + pj_ioqueue_t *ioqueue, + pj_timer_heap_t *timer_heap, + pj_stun_config **p_endpt); /** * Destroy STUN endpoint instance. */ -PJ_DECL(pj_status_t) pj_stun_endpoint_destroy(pj_stun_endpoint *endpt); +PJ_DECL(pj_status_t) pj_stun_config_destroy(pj_stun_config *endpt); /** @@ -113,5 +113,5 @@ PJ_DECL(pj_status_t) pj_stun_endpoint_destroy(pj_stun_endpoint *endpt); PJ_END_DECL -#endif /* __PJLIB_UTIL_STUN_ENDPOINT_H__ */ +#endif /* __PJNATH_STUN_CONFIG_H__ */ diff --git a/pjnath/include/pjnath/stun_msg.h b/pjnath/include/pjnath/stun_msg.h index ae66c2d1..ae076295 100644 --- a/pjnath/include/pjnath/stun_msg.h +++ b/pjnath/include/pjnath/stun_msg.h @@ -16,15 +16,15 @@ * 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_STUN_MSG_H__ -#define __PJLIB_UTIL_STUN_MSG_H__ +#ifndef __PJNATH_STUN_MSG_H__ +#define __PJNATH_STUN_MSG_H__ /** * @file stun_msg.h * @brief STUN message components. */ -#include <pjlib-util/types.h> +#include <pjnath/types.h> #include <pj/sock.h> @@ -33,9 +33,9 @@ PJ_BEGIN_DECL /* **************************************************************************/ /** - * @defgroup PJLIB_UTIL_STUN_MSG STUN Message Representation and Parsing + * @defgroup PJNATH_STUN_MSG STUN Message Representation and Parsing * @brief Low-level representation and parsing of STUN messages. - * @ingroup PJLIB_UTIL_STUN + * @ingroup PJNATH_STUN * @{ */ @@ -529,13 +529,9 @@ typedef struct pj_stun_sockaddr_attr pj_bool_t xor_ed; /** - * The socket address (as a union) + * The socket address */ - union { - pj_sockaddr addr; /**< Generic socket address. */ - pj_sockaddr_in ipv4; /**< IPv4 socket address. */ - pj_sockaddr_in6 ipv6; /**< IPv6 socket address. */ - } addr; + pj_sockaddr sockaddr; } pj_stun_sockaddr_attr; @@ -1535,5 +1531,5 @@ PJ_DECL(pj_status_t) pj_stun_msg_add_binary_attr(pj_pool_t *pool, PJ_END_DECL -#endif /* __PJLIB_UTIL_STUN_MSG_H__ */ +#endif /* __PJNATH_STUN_MSG_H__ */ diff --git a/pjnath/include/pjnath/stun_session.h b/pjnath/include/pjnath/stun_session.h index fa18dc3a..5f5bda30 100644 --- a/pjnath/include/pjnath/stun_session.h +++ b/pjnath/include/pjnath/stun_session.h @@ -16,13 +16,13 @@ * 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_STUN_SESSION_H__ -#define __PJLIB_UTIL_STUN_SESSION_H__ +#ifndef __PJNATH_STUN_SESSION_H__ +#define __PJNATH_STUN_SESSION_H__ -#include <pjlib-util/stun_msg.h> -#include <pjlib-util/stun_auth.h> -#include <pjlib-util/stun_endpoint.h> -#include <pjlib-util/stun_transaction.h> +#include <pjnath/stun_msg.h> +#include <pjnath/stun_auth.h> +#include <pjnath/stun_endpoint.h> +#include <pjnath/stun_transaction.h> #include <pj/list.h> #include <pj/timer.h> @@ -31,9 +31,9 @@ PJ_BEGIN_DECL /* **************************************************************************/ /** - * @defgroup PJLIB_UTIL_STUN_SESSION STUN Client/Server Session + * @defgroup PJNATH_STUN_SESSION STUN Client/Server Session * @brief STUN client and server session - * @ingroup PJLIB_UTIL_STUN + * @ingroup PJNATH_STUN * @{ */ @@ -156,7 +156,7 @@ struct pj_stun_tx_data /** * Create a STUN session. * - * @param endpt The STUN endpoint, to be used to register timers etc. + * @param cfg The STUN endpoint, to be used to register timers etc. * @param name Optional name to be associated with this instance. The * name will be used for example for logging purpose. * @param cb Session callback. @@ -165,7 +165,7 @@ struct pj_stun_tx_data * * @return PJ_SUCCESS on success, or the appropriate error code. */ -PJ_DECL(pj_status_t) pj_stun_session_create(pj_stun_endpoint *endpt, +PJ_DECL(pj_status_t) pj_stun_session_create(pj_stun_config *cfg, const char *name, const pj_stun_session_cb *cb, pj_bool_t fingerprint, @@ -368,5 +368,5 @@ PJ_DECL(void) pj_stun_msg_destroy_tdata(pj_stun_session *sess, PJ_END_DECL -#endif /* __PJLIB_UTIL_STUN_SESSION_H__ */ +#endif /* __PJNATH_STUN_SESSION_H__ */ diff --git a/pjnath/include/pjnath/stun_transaction.h b/pjnath/include/pjnath/stun_transaction.h index c7a5bf93..f4858863 100644 --- a/pjnath/include/pjnath/stun_transaction.h +++ b/pjnath/include/pjnath/stun_transaction.h @@ -16,16 +16,16 @@ * 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_STUN_TRANSACTION_H__ -#define __PJLIB_UTIL_STUN_TRANSACTION_H__ +#ifndef __PJNATH_STUN_TRANSACTION_H__ +#define __PJNATH_STUN_TRANSACTION_H__ /** * @file stun_transaction.h * @brief STUN transaction */ -#include <pjlib-util/stun_msg.h> -#include <pjlib-util/stun_endpoint.h> +#include <pjnath/stun_msg.h> +#include <pjnath/stun_endpoint.h> PJ_BEGIN_DECL @@ -33,16 +33,16 @@ PJ_BEGIN_DECL /* **************************************************************************/ /** - * @defgroup PJLIB_UTIL_STUN_TRANSACTION STUN Client Transaction + * @defgroup PJNATH_STUN_TRANSACTION STUN Client Transaction * @brief STUN client transaction - * @ingroup PJLIB_UTIL_STUN + * @ingroup PJNATH_STUN * @{ * - The @ref PJLIB_UTIL_STUN_TRANSACTION is used to manage outgoing STUN request, + The @ref PJNATH_STUN_TRANSACTION is used to manage outgoing STUN request, for example to retransmit the request and to notify application about the completion of the request. - The @ref PJLIB_UTIL_STUN_TRANSACTION does not use any networking operations, + The @ref PJNATH_STUN_TRANSACTION does not use any networking operations, but instead application must supply the transaction with a callback to be used by the transaction to send outgoing requests. This way the STUN transaction is made more generic and can work with different types of @@ -100,7 +100,7 @@ typedef struct pj_stun_tsx_cb * ensure the reliability of the request by periodically retransmitting * the request, if necessary. * - * @param endpt The STUN endpoint, which will be used to retrieve + * @param cfg The STUN endpoint, which will be used to retrieve * various settings for the transaction. * @param pool Pool to be used to allocate memory from. * @param cb Callback structure, to be used by the transaction @@ -110,7 +110,7 @@ typedef struct pj_stun_tsx_cb * * @return PJ_SUCCESS on success, or the appropriate error code. */ -PJ_DECL(pj_status_t) pj_stun_client_tsx_create( pj_stun_endpoint *endpt, +PJ_DECL(pj_status_t) pj_stun_client_tsx_create( pj_stun_config *cfg, pj_pool_t *pool, const pj_stun_tsx_cb *cb, pj_stun_client_tsx **p_tsx); @@ -213,5 +213,5 @@ PJ_DECL(pj_status_t) pj_stun_client_tsx_on_rx_msg(pj_stun_client_tsx *tsx, PJ_END_DECL -#endif /* __PJLIB_UTIL_STUN_TRANSACTION_H__ */ +#endif /* __PJNATH_STUN_TRANSACTION_H__ */ diff --git a/pjnath/include/pjnath/turn_client.h b/pjnath/include/pjnath/turn_client.h index 83d8d2d6..b9cfacc0 100644 --- a/pjnath/include/pjnath/turn_client.h +++ b/pjnath/include/pjnath/turn_client.h @@ -16,24 +16,24 @@ * 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_TURN_CLIENT_H__ -#define __PJLIB_UTIL_TURN_CLIENT_H__ +#ifndef __PJNATH_TURN_CLIENT_H__ +#define __PJNATH_TURN_CLIENT_H__ /** * @file turn_client.h * @brief TURN client session. */ -#include <pjlib-util/stun_msg.h> +#include <pjnath/stun_msg.h> PJ_BEGIN_DECL /** - * @defgroup PJLIB_UTIL_TURN_CLIENT TURN Client Session + * @defgroup PJNATH_TURN_CLIENT TURN Client Session * @brief Management of STUN/TURN client session - * @ingroup PJLIB_UTIL_STUN + * @ingroup PJNATH_STUN * @{ */ @@ -128,5 +128,5 @@ PJ_DECL(pj_status_t) pj_turn_client_create(pj_stun_endpoint *endpt, PJ_END_DECL -#endif /* __PJLIB_UTIL_TURN_CLIENT_H__ */ +#endif /* __PJNATH_TURN_CLIENT_H__ */ diff --git a/pjnath/include/pjnath/types.h b/pjnath/include/pjnath/types.h new file mode 100644 index 00000000..d39da89e --- /dev/null +++ b/pjnath/include/pjnath/types.h @@ -0,0 +1,63 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2007 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 __PJNATH_TYPES_H__ +#define __PJNATH_TYPES_H__ + +/** + * @file types.h + * @brief PJNATH types. + */ + +#include <pj/types.h> +#include <pjnath/config.h> + +/** + * @defgroup PJNATH NAT Helper Library + */ + +/** + * @mainpage NAT Helper Library + * + * \n + * \n + * \n + * This is the documentation of PJNATH, an auxiliary library providing + * NAT helper functionalities such as STUN and ICE. + * + * Please go to the <A HREF="modules.htm"><B>Modules</B></A> page for list + * of modules. + * + * + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + * \n + */ + +#endif /* __PJNATH_TYPES_H__ */ + |