diff options
Diffstat (limited to 'pjnath/include/pjnath/ice_session.h')
-rw-r--r-- | pjnath/include/pjnath/ice_session.h | 77 |
1 files changed, 72 insertions, 5 deletions
diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h index 2af223f3..87b723af 100644 --- a/pjnath/include/pjnath/ice_session.h +++ b/pjnath/include/pjnath/ice_session.h @@ -129,6 +129,11 @@ PJ_BEGIN_DECL */ /** + * Forward declaration for checklist. + */ +typedef struct pj_ice_sess_checklist pj_ice_sess_checklist; + +/** * This enumeration describes the type of an ICE candidate. */ typedef enum pj_ice_cand_type @@ -194,6 +199,24 @@ typedef struct pj_ice_sess_comp /** + * Data structure to be attached to internal message processing. + */ +typedef struct pj_ice_msg_data +{ + unsigned transport_id; + pj_bool_t has_req_data; + + union data { + struct request_data { + pj_ice_sess *ice; + pj_ice_sess_checklist *clist; + unsigned ckid; + } req; + } data; +} pj_ice_msg_data; + + +/** * This structure describes an ICE candidate. * ICE candidate is a transport address that is to be tested by ICE * procedures in order to determine its suitability for usage for @@ -204,16 +227,34 @@ typedef struct pj_ice_sess_comp typedef struct pj_ice_sess_cand { /** + * The candidate type, as described in #pj_ice_cand_type enumeration. + */ + pj_ice_cand_type type; + + /** + * Status of this candidate. The value will be PJ_SUCCESS if candidate + * address has been resolved successfully, PJ_EPENDING when the address + * resolution process is in progress, or other value when the address + * resolution has completed with failure. + */ + pj_status_t status; + + /** * The component ID of this candidate. Note that component IDs starts * with one for RTP and two for RTCP. In other words, it's not zero * based. */ - pj_uint32_t comp_id; + pj_uint8_t comp_id; /** - * The candidate type, as described in #pj_ice_cand_type enumeration. + * Transport ID to be used to send packets for this candidate. */ - pj_ice_cand_type type; + pj_uint8_t transport_id; + + /** + * Local preference value, which typically is 65535. + */ + pj_uint16_t local_pref; /** * The foundation string, which is an identifier which value will be @@ -383,7 +424,7 @@ typedef enum pj_ice_sess_checklist_state * This structure represents ICE check list, that is an ordered set of * candidate pairs that an agent will use to generate checks. */ -typedef struct pj_ice_sess_checklist +struct pj_ice_sess_checklist { /** * The checklist state. @@ -405,7 +446,7 @@ typedef struct pj_ice_sess_checklist */ pj_timer_entry timer; -} pj_ice_sess_checklist; +}; /** @@ -430,12 +471,14 @@ typedef struct pj_ice_sess_cb * * @param ice The ICE session. * @param comp_id ICE component ID. + * @param transport_id Transport ID. * @param pkt The STUN packet. * @param size The size of the packet. * @param dst_addr Packet destination address. * @param dst_addr_len Length of destination address. */ pj_status_t (*on_tx_pkt)(pj_ice_sess *ice, unsigned comp_id, + unsigned transport_id, const void *pkt, pj_size_t size, const pj_sockaddr_t *dst_addr, unsigned dst_addr_len); @@ -446,6 +489,7 @@ typedef struct pj_ice_sess_cb * * @param ice The ICE session. * @param comp_id ICE component ID. + * @param transport_id Transport ID. * @param pkt The whole packet. * @param size Size of the packet. * @param src_addr Source address where this packet was received @@ -453,6 +497,7 @@ typedef struct pj_ice_sess_cb * @param src_addr_len The length of source address. */ void (*on_rx_data)(pj_ice_sess *ice, unsigned comp_id, + unsigned transport_id, void *pkt, pj_size_t size, const pj_sockaddr_t *src_addr, unsigned src_addr_len); @@ -496,6 +541,7 @@ typedef struct pj_ice_rx_check PJ_DECL_LIST_MEMBER(struct pj_ice_rx_check); unsigned comp_id; /**< Component ID. */ + unsigned transport_id; /**< Transport ID. */ pj_sockaddr src_addr; /**< Source address of request */ unsigned src_addr_len; /**< Length of src address. */ @@ -553,6 +599,9 @@ struct pj_ice_sess unsigned rcand_cnt; /**< # of remote cand. */ pj_ice_sess_cand rcand[PJ_ICE_MAX_CAND]; /**< Array of cand. */ + /* Array of transport datas */ + pj_ice_msg_data tp_data[4]; + /* List of eearly checks */ pj_ice_rx_check early_check; /**< Early checks. */ @@ -582,6 +631,17 @@ PJ_DECL(const char*) pj_ice_get_cand_type_name(pj_ice_cand_type type); /** + * This is a utility function to retrieve the string name for the + * particular role type. + * + * @param role Role type. + * + * @return The string representation of the role. + */ +PJ_DECL(const char*) pj_ice_sess_role_name(pj_ice_sess_role role); + + +/** * This is a utility function to calculate the foundation identification * for a candidate. * @@ -685,6 +745,8 @@ PJ_DECL(pj_status_t) pj_ice_sess_set_prefs(pj_ice_sess *ice, * * @param ice ICE session instance. * @param comp_id Component ID of this candidate. + * @param transport_id Transport ID to be used to send packets for this + * candidate. * @param type Candidate type. * @param local_pref Local preference for this candidate, which * normally should be set to 65535. @@ -699,6 +761,7 @@ PJ_DECL(pj_status_t) pj_ice_sess_set_prefs(pj_ice_sess *ice, */ PJ_DECL(pj_status_t) pj_ice_sess_add_cand(pj_ice_sess *ice, unsigned comp_id, + unsigned transport_id, pj_ice_cand_type type, pj_uint16_t local_pref, const pj_str_t *foundation, @@ -797,6 +860,9 @@ PJ_DECL(pj_status_t) pj_ice_sess_send_data(pj_ice_sess *ice, * * @param ice The ICE session. * @param comp_id Component ID. + * @param transport_id Number to identify where this packet was received + * from. This parameter will be returned back to + * application in \a on_tx_pkt() callback. * @param pkt Incoming packet. * @param pkt_size Size of incoming packet. * @param src_addr Source address of the packet. @@ -806,6 +872,7 @@ PJ_DECL(pj_status_t) pj_ice_sess_send_data(pj_ice_sess *ice, */ PJ_DECL(pj_status_t) pj_ice_sess_on_rx_pkt(pj_ice_sess *ice, unsigned comp_id, + unsigned transport_id, void *pkt, pj_size_t pkt_size, const pj_sockaddr_t *src_addr, |