summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-03-28 16:24:00 +0000
committerBenny Prijono <bennylp@teluu.com>2007-03-28 16:24:00 +0000
commit79930f4811de49812f565878f89a2c3bdef88553 (patch)
treeb2767a76f04cb18f40aa9ae8c3ca4c20e0900a4e
parentb461f076273b3bf78c5f889515cc7541e9d3b701 (diff)
Fixed pjnath build warnings/errors on Linux
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1112 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--Makefile3
-rw-r--r--pjmedia/include/pjmedia/transport_ice.h135
-rw-r--r--pjmedia/include/pjmedia/transport_udp.h2
-rw-r--r--pjmedia/src/pjmedia/transport_ice.c6
-rw-r--r--pjnath/src/pjnath/ice_session.c11
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h4
-rw-r--r--pjsip/src/pjsua-lib/pjsua_call.c4
-rw-r--r--pjsip/src/pjsua-lib/pjsua_core.c2
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c4
9 files changed, 153 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 18766d28..d6862e94 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
include build.mak
include build/host-$(HOST_NAME).mak
-DIRS = pjlib pjlib-util pjmedia pjsip pjsip-apps
+DIRS = pjlib pjlib-util pjnath pjmedia pjsip pjsip-apps
ifdef MINSIZE
MAKE_FLAGS := MINSIZE=1
@@ -20,6 +20,7 @@ all clean dep depend distclean doc print realclean:
LIBS = pjlib/lib/libpj-$(TARGET_NAME).a \
pjlib-util/lib/libpjlib-util-$(TARGET_NAME).a \
+ pjnath/lib/libpjnath-$(TARGET_NAME).a \
pjmedia/lib/libpjmedia-$(TARGET_NAME).a \
pjmedia/lib/libpjmedia-codec-$(TARGET_NAME).a \
pjsip/lib/libpjsip-$(TARGET_NAME).a \
diff --git a/pjmedia/include/pjmedia/transport_ice.h b/pjmedia/include/pjmedia/transport_ice.h
index d3ba718e..cf72886d 100644
--- a/pjmedia/include/pjmedia/transport_ice.h
+++ b/pjmedia/include/pjmedia/transport_ice.h
@@ -22,7 +22,7 @@
/**
* @file transport_ice.h
- * @brief Stream transport with ICE.
+ * @brief ICE capable media transport.
*/
#include <pjmedia/stream.h>
@@ -30,8 +30,8 @@
/**
- * @defgroup PJMEDIA_TRANSPORT_ICE ICE Socket Transport
- * @ingroup PJMEDIA_TRANSPORT_H
+ * @defgroup PJMEDIA_TRANSPORT_ICE ICE Capable media transport
+ * @ingroup PJMEDIA_TRANSPORT
* @brief Implementation of media transport with ICE.
* @{
*/
@@ -39,35 +39,162 @@
PJ_BEGIN_DECL
+/**
+ * Create the media transport.
+ *
+ * @param endpt The media endpoint.
+ * @param name Optional name to identify this ICE media transport
+ * for logging purposes.
+ * @param comp_cnt Number of components to be created.
+ * @param stun_cfg Pointer to STUN configuration settings.
+ * @param p_tp Pointer to receive the media transport instance.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_create(pjmedia_endpt *endpt,
const char *name,
unsigned comp_cnt,
pj_stun_config *stun_cfg,
pjmedia_transport **p_tp);
+
+/**
+ * Destroy the media transport.
+ *
+ * @param tp The media transport.
+ *
+ * @return PJ_SUCCESS.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp);
+
+/**
+ * Start the initialization process of this media transport. This function
+ * will gather the transport addresses to be registered to ICE session as
+ * candidates. If STUN is configured, this will start the STUN Binding or
+ * Allocate request to get the STUN server reflexive or relayed address.
+ * This function will return immediately, and application should poll the
+ * STUN completion status by calling #pjmedia_ice_get_init_status().
+ *
+ * @param tp The media transport.
+ * @param options Options, see pj_ice_strans_option in PJNATH
+ * documentation.
+ * @param start_addr Local address where socket will be bound to. This
+ * address will be used as follows:
+ * - if the value is NULL, then socket will be bound
+ * to any available port.
+ * - if the value is not NULL, then if the port number
+ * is not zero, it will used as the starting port
+ * where the socket will be bound to. If bind() to
+ * this port fails, this function will try to bind
+ * to port+2, repeatedly until it succeeded.
+ * If application doesn't want this function to
+ * retry binding the socket to other port, it can
+ * specify PJ_ICE_ST_OPT_NO_PORT_RETRY option.
+ * - if the value is not NULL, then if the address
+ * is not INADDR_ANY, this function will bind the
+ * socket to this particular interface only, and
+ * no other host candidates will be added for this
+ * socket.
+ * @param stun_srv Address of the STUN server, or NULL if STUN server
+ * reflexive mapping is not to be used.
+ * @param turn_srv Address of the TURN server, or NULL if TURN relay
+ * is not to be used.
+ *
+ * @return PJ_SUCCESS when the initialization process has started
+ * successfully, or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_start_init(pjmedia_transport *tp,
unsigned options,
const pj_sockaddr_in *start_addr,
const pj_sockaddr_in *stun_srv,
const pj_sockaddr_in *turn_srv);
+
+/**
+ * Poll the initialization status of this media transport.
+ *
+ * @param tp The media transport.
+ *
+ * @return PJ_SUCCESS if all candidates have been resolved
+ * successfully, PJ_EPENDING if transport resolution
+ * is still in progress, or other status on failure.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_get_init_status(pjmedia_transport *tp);
+
+/**
+ * Get the ICE stream transport component for the specified component ID.
+ *
+ * @param tp The media transport.
+ * @param comp_id The component ID.
+ * @param comp The structure which will be filled with the
+ * component.
+ *
+ * @return PJ_SUCCESS or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_get_comp(pjmedia_transport *tp,
unsigned comp_id,
pj_ice_strans_comp *comp);
+/**
+ * Initialize the ICE session.
+ *
+ * @param tp The media transport.
+ * @param role ICE role.
+ * @param local_ufrag Optional local username fragment.
+ * @param local_passwd Optional local password.
+ *
+ * @return PJ_SUCCESS, or the appropriate error code.
+
+ */
PJ_DECL(pj_status_t) pjmedia_ice_init_ice(pjmedia_transport *tp,
pj_ice_sess_role role,
const pj_str_t *local_ufrag,
const pj_str_t *local_passwd);
+
+/**
+ * Modify the SDP to add ICE specific SDP attributes before sending
+ * the SDP to remote host.
+ *
+ * @param tp The media transport.
+ * @param pool Pool to allocate memory for the SDP elements.
+ * @param sdp The SDP descriptor to be modified.
+ *
+ * @return PJ_SUCCESS, or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp,
pj_pool_t *pool,
pjmedia_sdp_session *sdp);
+
+/**
+ * Start ICE connectivity checks.
+ *
+ * This function will pair the local and remote candidates to create
+ * check list. Once the check list is created and sorted based on the
+ * priority, ICE periodic checks will be started. This function will
+ * return immediately, and application will be notified about the
+ * connectivity check status in the callback.
+ *
+ * @param tp The media transport.
+ * @param pool Memory pool to parse the SDP.
+ * @param rem_sdp The SDP received from remote agent.
+ * @param media_index The media index (in SDP) to process.
+ *
+ * @return PJ_SUCCESS, or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp,
pj_pool_t *pool,
- pjmedia_sdp_session *rem_sdp,
+ const pjmedia_sdp_session *rem_sdp,
unsigned media_index);
+
+/**
+ * Stop the ICE session (typically when the call is terminated). Application
+ * may restart the ICE session again by calling #pjmedia_ice_init_ice(),
+ * for example to use this media transport for the next call.
+ *
+ * @param tp The media transport.
+ *
+ * @return PJ_SUCCESS, or the appropriate error code.
+ */
PJ_DECL(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp);
diff --git a/pjmedia/include/pjmedia/transport_udp.h b/pjmedia/include/pjmedia/transport_udp.h
index 807f1a64..745df46b 100644
--- a/pjmedia/include/pjmedia/transport_udp.h
+++ b/pjmedia/include/pjmedia/transport_udp.h
@@ -30,7 +30,7 @@
/**
* @defgroup PJMEDIA_TRANSPORT_UDP UDP Socket Transport
- * @ingroup PJMEDIA_TRANSPORT_H
+ * @ingroup PJMEDIA_TRANSPORT
* @brief Implementation of media transport with UDP sockets.
* @{
*/
diff --git a/pjmedia/src/pjmedia/transport_ice.c b/pjmedia/src/pjmedia/transport_ice.c
index d419ade0..71d19c24 100644
--- a/pjmedia/src/pjmedia/transport_ice.c
+++ b/pjmedia/src/pjmedia/transport_ice.c
@@ -400,14 +400,14 @@ static void set_no_ice(struct transport_ice *tp_ice)
PJ_DEF(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp,
pj_pool_t *pool,
- pjmedia_sdp_session *rem_sdp,
+ const pjmedia_sdp_session *rem_sdp,
unsigned media_index)
{
struct transport_ice *tp_ice = (struct transport_ice*)tp;
- pjmedia_sdp_attr *attr;
+ const pjmedia_sdp_attr *attr;
unsigned i, cand_cnt;
pj_ice_sess_cand cand[PJ_ICE_MAX_CAND];
- pjmedia_sdp_media *sdp_med;
+ const pjmedia_sdp_media *sdp_med;
pj_str_t uname, pass;
pj_status_t status;
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
index b67830cc..3214215c 100644
--- a/pjnath/src/pjnath/ice_session.c
+++ b/pjnath/src/pjnath/ice_session.c
@@ -82,6 +82,8 @@ static void destroy_ice(pj_ice_sess *ice,
pj_status_t reason);
static pj_status_t start_periodic_check(pj_timer_heap_t *th,
pj_timer_entry *te);
+static void periodic_timer(pj_timer_heap_t *th,
+ pj_timer_entry *te);
static pj_status_t on_stun_send_msg(pj_stun_session *sess,
const void *pkt,
pj_size_t pkt_size,
@@ -1078,7 +1080,7 @@ pj_ice_sess_create_check_list(pj_ice_sess *ice,
td->ice = ice;
td->clist = clist;
clist->timer.user_data = (void*)td;
- clist->timer.cb = &start_periodic_check;
+ clist->timer.cb = &periodic_timer;
/* Log checklist */
@@ -1257,6 +1259,13 @@ static pj_status_t start_periodic_check(pj_timer_heap_t *th,
}
+/* Timer callback to perform periodic check */
+static void periodic_timer(pj_timer_heap_t *th,
+ pj_timer_entry *te)
+{
+ start_periodic_check(th, te);
+}
+
/* Start ICE check */
PJ_DEF(pj_status_t) pj_ice_sess_start_check(pj_ice_sess *ice)
{
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index 5365ff12..0e391a0d 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -295,8 +295,8 @@ pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id,
pj_pool_t *pool,
pjmedia_sdp_session **p_sdp);
pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
- pjmedia_sdp_session *local_sdp,
- pjmedia_sdp_session *remote_sdp);
+ const pjmedia_sdp_session *local_sdp,
+ const pjmedia_sdp_session *remote_sdp);
pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id);
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index b0e420eb..1494276e 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -2086,8 +2086,8 @@ static void pjsua_call_on_media_update(pjsip_inv_session *inv,
pj_status_t status)
{
pjsua_call *call;
- pjmedia_sdp_session *local_sdp;
- pjmedia_sdp_session *remote_sdp;
+ const pjmedia_sdp_session *local_sdp;
+ const pjmedia_sdp_session *remote_sdp;
PJSUA_LOCK();
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index d01a02b0..a002600b 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -653,8 +653,6 @@ static void busy_sleep(unsigned msec)
}
-static pj_status_t resolve_stun_server(pj_bool_t use_dns_srv);
-
/*
* Callback function to receive notification from the resolver
* when the resolution process completes.
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index eefcb2d3..0d4f6b2a 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -771,8 +771,8 @@ static void dtmf_callback(pjmedia_stream *strm, void *user_data,
pj_status_t pjsua_media_channel_update(pjsua_call_id call_id,
- pjmedia_sdp_session *local_sdp,
- pjmedia_sdp_session *remote_sdp)
+ const pjmedia_sdp_session *local_sdp,
+ const pjmedia_sdp_session *remote_sdp)
{
int prev_media_st = 0;
pjsua_call *call = &pjsua_var.calls[call_id];