Index: pjproject/trunk/pjnath/include/pjnath/ice_stream_transport.h
===================================================================
--- pjproject/trunk/pjnath/include/pjnath/ice_mt.h	(revision 1093)
+++ pjproject/trunk/pjnath/include/pjnath/ice_stream_transport.h	(revision 1096)
@@ -17,6 +17,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  */
-#ifndef __PJNATH_ICE_MT_H__
-#define __PJNATH_ICE_MT_H__
+#ifndef __PJNATH_ICE_STREAM_TRANSPORT_H__
+#define __PJNATH_ICE_STREAM_TRANSPORT_H__
 
 
@@ -26,4 +26,5 @@
  */
 #include <pjnath/ice.h>
+#include <pjlib-util/resolver.h>
 #include <pj/ioqueue.h>
 
@@ -33,32 +34,46 @@
 
 /**
- * @defgroup PJNATH_ICE_MEDIA_TRANSPORT ICE Media Transport
- * @brief ICE Media Transport
+ * @defgroup PJNATH_ICE_STREAM_TRANSPORT ICE Stream Transport
+ * @brief Transport for media stream using ICE
  * @ingroup PJNATH_ICE
  * @{
  */
 
-typedef struct pj_icemt pj_icemt;
+typedef struct pj_ice_st pj_ice_st;
 
-typedef struct pj_icemt_cb
+typedef struct pj_ice_st_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);
+    void    (*on_rx_data)(pj_ice_st *ice_st,
+			  unsigned comp_id, unsigned cand_id,
+			  void *pkt, pj_size_t size,
+			  const pj_sockaddr_t *src_addr,
+			  unsigned src_addr_len);
 
-} pj_icemt_cb;
+    void    (*on_stun_srv_resolved)(pj_ice_st *ice_st,
+				    pj_status_t status);
+    void    (*on_interface_status)(pj_ice_st *ice_st,
+				   void *notify_data,
+				   pj_status_t status,
+				   int itf_id);
+    void    (*on_ice_complete)(pj_ice_st *ice_st, 
+			       pj_status_t status);
+
+} pj_ice_st_cb;
 
 
-typedef struct pj_icemt_sock
+typedef struct pj_ice_st_comp
 {
-    pj_icemt		*icemt;
     unsigned		 comp_id;
+} pj_ice_st_comp;
+
+
+typedef struct pj_ice_st_interface
+{
+    pj_ice_st		*ice_st;
+    pj_ice_cand_type	 type;
+    unsigned		 comp_id;
+    int			 cand_id;
+    pj_str_t		 foundation;
+    pj_uint16_t		 local_pref;
     pj_sock_t		 sock;
     pj_sockaddr		 addr;
@@ -70,34 +85,90 @@
     pj_sockaddr		 src_addr;
     int			 src_addr_len;
-} pj_icemt_sock;
+} pj_ice_st_interface;
 
 
-struct pj_icemt
+struct pj_ice_st
 {
-    pj_pool_t	    *pool;
-    pj_ice	    *ice;
-    void	    *user_data;
+    char		     obj_name[PJ_MAX_OBJ_NAME];
+    pj_pool_t		    *pool;
+    void		    *user_data;
+    pj_stun_config	     stun_cfg;
+    pj_ice_st_cb	     cb;
 
-    pj_icemt_cb	     cb;
+    pj_ice		    *ice;
 
-    pj_icemt_sock    rtp;
-    pj_icemt_sock    rtcp;
+    unsigned		     comp_cnt;
+    unsigned		     comps[PJ_ICE_MAX_COMP];
 
-    pj_bool_t	     has_turn;
-    pj_sockaddr	     stun_srv;
+    unsigned		     itf_cnt;
+    pj_ice_st_interface	    *itfs[PJ_ICE_MAX_CAND];
+
+    pj_dns_resolver	    *resolver;
+    pj_bool_t		     relay_enabled;
+    pj_str_t		     stun_domain;
+    pj_sockaddr_in	     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_DECL(pj_status_t) pj_ice_st_create(pj_stun_config *stun_cfg,
+				      const char *name,
+				      void *user_data,
+				      const pj_ice_st_cb *cb,
+				      pj_ice_st **p_ice_st);
+PJ_DECL(pj_status_t) pj_ice_st_destroy(pj_ice_st *ice_st);
 
+PJ_DECL(pj_status_t) pj_ice_st_set_stun(pj_ice_st *ice_st,
+					pj_dns_resolver *resolver,
+					pj_bool_t enable_relay,
+					const pj_str_t *domain);
+PJ_DECL(pj_status_t) pj_ice_st_set_stun_addr(pj_ice_st *ice_st,
+					     pj_bool_t enable_relay,
+					     const pj_sockaddr_in *srv_addr);
+
+PJ_DECL(pj_status_t) pj_ice_st_add_comp(pj_ice_st *ice_st,
+					unsigned comp_id);
+
+PJ_DECL(pj_status_t) pj_ice_st_add_host_interface(pj_ice_st *ice_st,
+						  unsigned comp_id,
+						  pj_uint16_t local_pref,
+					          const pj_sockaddr_in *addr,
+				    		  unsigned *p_itf_id,
+						  pj_bool_t notify,
+						  void *notify_data);
+PJ_DECL(pj_status_t) pj_ice_st_add_all_host_interfaces(pj_ice_st *ice_st,
+						       unsigned comp_id,
+						       unsigned port,
+						       pj_bool_t notify,
+						       void *notify_data);
+PJ_DECL(pj_status_t) pj_ice_st_add_stun_interface(pj_ice_st *ice_st,
+						  unsigned comp_id,
+						  unsigned local_port,
+						  pj_bool_t notify,
+						  void *notify_data);
+PJ_DECL(pj_status_t) pj_ice_st_add_relay_interface(pj_ice_st *ice_st,
+						   unsigned comp_id,
+						   unsigned local_port,
+						   pj_bool_t notify,
+						   void *notify_data);
+
+
+PJ_DECL(pj_status_t) pj_ice_st_init_ice(pj_ice_st *ice_st,
+					pj_ice_role role,
+					const pj_str_t *local_ufrag,
+					const pj_str_t *local_passwd);
+PJ_DECL(pj_status_t) pj_ice_st_enum_cands(pj_ice_st *ice_st,
+					  unsigned *count,
+					  pj_ice_cand cand[]);
+PJ_DECL(pj_status_t) pj_ice_st_start_ice(pj_ice_st *ice_st,
+					 const pj_str_t *rem_ufrag,
+					 const pj_str_t *rem_passwd,
+					 unsigned rem_cand_cnt,
+					 const pj_ice_cand rem_cand[]);
+PJ_DECL(pj_status_t) pj_ice_st_stop_ice(pj_ice_st *ice_st);
+
+PJ_DECL(pj_status_t) pj_ice_st_send_data(pj_ice_st *ice_st,
+					 unsigned comp_id,
+					 const void *data,
+					 pj_size_t data_len);
 
 
@@ -111,4 +182,4 @@
 
 
-#endif	/* __PJNATH_ICE_MT_H__ */
+#endif	/* __PJNATH_ICE_STREAM_TRANSPORT_H__ */
 
