summaryrefslogtreecommitdiff
path: root/pjnath/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-03-21 22:05:58 +0000
committerBenny Prijono <bennylp@teluu.com>2007-03-21 22:05:58 +0000
commit8befa349c02d1150d1140aefee97ebb47527da20 (patch)
tree720b371c8d7512311472e606d58a7017b3b85ff0 /pjnath/include
parent33fe5e64b9b0482a127d8137aae43e5e29e1adc8 (diff)
Added pjnath-test
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1093 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/include')
-rw-r--r--pjnath/include/pjnath.h2
-rw-r--r--pjnath/include/pjnath/ice.h27
-rw-r--r--pjnath/include/pjnath/ice_mt.h114
3 files changed, 130 insertions, 13 deletions
diff --git a/pjnath/include/pjnath.h b/pjnath/include/pjnath.h
index 750a613e..c3f85fc3 100644
--- a/pjnath/include/pjnath.h
+++ b/pjnath/include/pjnath.h
@@ -19,6 +19,8 @@
#include <pjnath/config.h>
#include <pjnath/errno.h>
+#include <pjnath/ice.h>
+#include <pjnath/ice_mt.h>
#include <pjnath/stun_auth.h>
#include <pjnath/stun_config.h>
#include <pjnath/stun_msg.h>
diff --git a/pjnath/include/pjnath/ice.h b/pjnath/include/pjnath/ice.h
index 568a2825..94cd7a22 100644
--- a/pjnath/include/pjnath/ice.h
+++ b/pjnath/include/pjnath/ice.h
@@ -20,23 +20,28 @@
#define __PJNATH_ICE_SOCK_H__
/**
- * @file ice_sock.h
- * @brief ICE socket.
+ * @file ice.h
+ * @brief ICE.
*/
#include <pjnath/types.h>
#include <pjnath/stun_session.h>
#include <pj/sock.h>
#include <pj/timer.h>
+/**
+ * @defgroup PJNATH_ICE Interactive Connectivity Establishment (ICE)
+ * @brief Interactive Connectivity Establishment (ICE)
+ * @ingroup PJNATH
+ */
+
PJ_BEGIN_DECL
-/* **************************************************************************/
/**
- * @defgroup PJNATH_ICE_SOCK ICE Socket
- * @brief High level ICE socket abstraction.
- * @ingroup PJNATH
+ * @defgroup PJNATH_ICE_STREAM Transport Independent ICE Media Stream
+ * @brief Transport Independent ICE Media Stream
+ * @ingroup PJNATH_ICE
* @{
*/
@@ -165,9 +170,8 @@ struct pj_ice
char obj_name[PJ_MAX_OBJ_NAME];
pj_pool_t *pool;
+ void *user_data;
pj_mutex_t *mutex;
- int af;
- int sock_type;
pj_ice_role role;
pj_bool_t is_complete;
pj_status_t ice_status;
@@ -176,8 +180,10 @@ struct pj_ice
pj_stun_config stun_cfg;
/* STUN credentials */
+ pj_str_t tx_ufrag;
pj_str_t tx_uname;
pj_str_t tx_pass;
+ pj_str_t rx_ufrag;
pj_str_t rx_uname;
pj_str_t rx_pass;
@@ -206,17 +212,12 @@ PJ_DECL(pj_status_t) pj_ice_create(pj_stun_config *stun_cfg,
const char *name,
pj_ice_role role,
const pj_ice_cb *cb,
- 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_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_set_credentials(pj_ice *ice,
const pj_str_t *local_ufrag,
const pj_str_t *local_pass,
diff --git a/pjnath/include/pjnath/ice_mt.h b/pjnath/include/pjnath/ice_mt.h
new file mode 100644
index 00000000..d96f39b6
--- /dev/null
+++ b/pjnath/include/pjnath/ice_mt.h
@@ -0,0 +1,114 @@
+/* $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_ICE_MT_H__
+#define __PJNATH_ICE_MT_H__
+
+
+/**
+ * @file ice_mt.h
+ * @brief ICE Media Transport.
+ */
+#include <pjnath/ice.h>
+#include <pj/ioqueue.h>
+
+
+PJ_BEGIN_DECL
+
+
+/**
+ * @defgroup PJNATH_ICE_MEDIA_TRANSPORT ICE Media Transport
+ * @brief ICE Media Transport
+ * @ingroup PJNATH_ICE
+ * @{
+ */
+
+typedef struct pj_icemt pj_icemt;
+
+typedef struct pj_icemt_cb
+{
+ void (*on_ice_complete)(pj_icemt *icemt,
+ pj_status_t status);
+ void (*on_rx_rtp)(pj_icemt *icemt,
+ void *pkt, pj_size_t size,
+ const pj_sockaddr_t *src_addr,
+ unsigned src_addr_len);
+ void (*on_rx_rtcp)(pj_icemt *icemt,
+ void *pkt, pj_size_t size,
+ const pj_sockaddr_t *src_addr,
+ unsigned src_addr_len);
+
+} pj_icemt_cb;
+
+
+typedef struct pj_icemt_sock
+{
+ pj_icemt *icemt;
+ unsigned comp_id;
+ pj_sock_t sock;
+ pj_sockaddr addr;
+ pj_sockaddr base_addr;
+ pj_ioqueue_key_t *key;
+ pj_uint8_t pkt[1500];
+ pj_ioqueue_op_key_t read_op;
+ pj_ioqueue_op_key_t write_op;
+ pj_sockaddr src_addr;
+ int src_addr_len;
+} pj_icemt_sock;
+
+
+struct pj_icemt
+{
+ pj_pool_t *pool;
+ pj_ice *ice;
+ void *user_data;
+
+ pj_icemt_cb cb;
+
+ pj_icemt_sock rtp;
+ pj_icemt_sock rtcp;
+
+ pj_bool_t has_turn;
+ pj_sockaddr stun_srv;
+};
+
+
+PJ_DECL(pj_status_t) pj_icemt_create(pj_stun_config *stun_cfg,
+ const char *name,
+ pj_ice_role role,
+ const pj_icemt_cb *cb,
+ unsigned rtp_port,
+ pj_bool_t has_rtcp,
+ pj_bool_t has_turn,
+ const pj_sockaddr *srv,
+ pj_icemt **p_icemt);
+PJ_DECL(pj_status_t) pj_icemt_destroy(pj_icemt *icemt);
+
+
+
+/**
+ * @}
+ */
+
+
+PJ_END_DECL
+
+
+
+#endif /* __PJNATH_ICE_MT_H__ */
+