summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/transport.h2
-rw-r--r--pjmedia/include/pjmedia/transport_ice.h46
-rw-r--r--pjmedia/src/pjmedia/transport_ice.c32
3 files changed, 79 insertions, 1 deletions
diff --git a/pjmedia/include/pjmedia/transport.h b/pjmedia/include/pjmedia/transport.h
index 02105a7c..a6a6ff47 100644
--- a/pjmedia/include/pjmedia/transport.h
+++ b/pjmedia/include/pjmedia/transport.h
@@ -503,7 +503,7 @@ struct pjmedia_transport_info
/**
* Specifies number of transport specific info included.
*/
- int specific_info_cnt;
+ unsigned specific_info_cnt;
/**
* Buffer storage of transport specific info.
diff --git a/pjmedia/include/pjmedia/transport_ice.h b/pjmedia/include/pjmedia/transport_ice.h
index 349bddd9..0e7816fc 100644
--- a/pjmedia/include/pjmedia/transport_ice.h
+++ b/pjmedia/include/pjmedia/transport_ice.h
@@ -63,6 +63,52 @@ typedef struct pjmedia_ice_cb
/**
+ * This structure specifies ICE transport specific info. This structure
+ * will be filled in media transport specific info.
+ */
+typedef struct pjmedia_ice_transport_info
+{
+ /**
+ * ICE sesion state.
+ */
+ pj_ice_strans_state sess_state;
+
+ /**
+ * Session role.
+ */
+ pj_ice_sess_role role;
+
+ /**
+ * Number of components in the component array. Before ICE negotiation
+ * is complete, the number represents the number of components of the
+ * local agent. After ICE negotiation has been completed successfully,
+ * the number represents the number of common components between local
+ * and remote agents.
+ */
+ unsigned comp_cnt;
+
+ /**
+ * Array of ICE components. Typically the first element denotes RTP and
+ * second element denotes RTCP.
+ */
+ struct
+ {
+ /**
+ * Local candidate type.
+ */
+ pj_ice_cand_type lcand_type;
+
+ /**
+ * Remote candidate type.
+ */
+ pj_ice_cand_type rcand_type;
+
+ } comp[2];
+
+} pjmedia_ice_transport_info;
+
+
+/**
* Options that can be specified when creating ICE transport.
*/
enum pjmedia_transport_ice_options
diff --git a/pjmedia/src/pjmedia/transport_ice.c b/pjmedia/src/pjmedia/transport_ice.c
index 7c36787c..7fd0133e 100644
--- a/pjmedia/src/pjmedia/transport_ice.c
+++ b/pjmedia/src/pjmedia/transport_ice.c
@@ -1473,6 +1473,38 @@ static pj_status_t transport_get_info(pjmedia_transport *tp,
info->src_rtcp_name = tp_ice->rtcp_src_addr;
}
+ /* Fill up transport specific info */
+ if (info->specific_info_cnt < PJ_ARRAY_SIZE(info->spc_info)) {
+ pjmedia_transport_specific_info *tsi;
+ pjmedia_ice_transport_info *ii;
+ unsigned i;
+
+ pj_assert(sizeof(*ii) <= sizeof(tsi->buffer));
+ tsi = &info->spc_info[info->specific_info_cnt++];
+ tsi->type = PJMEDIA_TRANSPORT_TYPE_ICE;
+ tsi->cbsize = sizeof(*ii);
+
+ ii = (pjmedia_ice_transport_info*) tsi->buffer;
+ pj_bzero(ii, sizeof(*ii));
+
+ if (pj_ice_strans_has_sess(tp_ice->ice_st))
+ ii->role = pj_ice_strans_get_role(tp_ice->ice_st);
+ else
+ ii->role = PJ_ICE_SESS_ROLE_UNKNOWN;
+ ii->sess_state = pj_ice_strans_get_state(tp_ice->ice_st);
+ ii->comp_cnt = pj_ice_strans_get_running_comp_cnt(tp_ice->ice_st);
+
+ for (i=1; i<=ii->comp_cnt && i<=PJ_ARRAY_SIZE(ii->comp); ++i) {
+ const pj_ice_sess_check *chk;
+
+ chk = pj_ice_strans_get_valid_pair(tp_ice->ice_st, i);
+ if (chk) {
+ ii->comp[i-1].lcand_type = chk->lcand->type;
+ ii->comp[i-1].rcand_type = chk->rcand->type;
+ }
+ }
+ }
+
return PJ_SUCCESS;
}