- Timestamp:
- Sep 14, 2007 10:19:47 AM (17 years ago)
- Location:
- pjproject/trunk/pjnath
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/include/pjnath/ice_strans.h
r1242 r1434 163 163 pj_status_t status); 164 164 165 /** 166 * This callback will be called when ICE transport has detected that 167 * the STUN mapped address of a candidate has changed. 168 * 169 * @param ice_st The ICE stream transport. 170 * @param comp_id Component ID. 171 * @param cand_id Candidate ID. 172 */ 173 void (*on_addr_change)(pj_ice_strans *ice_st, 174 unsigned comp_id, 175 unsigned cand_id); 176 165 177 } pj_ice_strans_cb; 166 178 -
pjproject/trunk/pjnath/src/pjnath/ice_strans.c
r1433 r1434 583 583 584 584 /* tdata->user_data is NULL for keep-alive */ 585 tdata->user_data = NULL; 585 //tdata->user_data = NULL; 586 587 // We need this to support mapped address change 588 tdata->user_data = &comp->cand_list[j]; 589 ++comp->pending_cnt; 590 586 591 587 592 /* Send STUN binding request */ … … 590 595 &ice_st->stun_srv, 591 596 sizeof(pj_sockaddr_in), tdata); 597 if (status != PJ_SUCCESS) { 598 --comp->pending_cnt; 599 } 592 600 } 593 601 … … 1086 1094 pj_stun_mapped_addr_attr *ma; 1087 1095 pj_sockaddr *mapped_addr; 1096 char ip[20]; 1088 1097 1089 1098 comp = (pj_ice_strans_comp*) pj_stun_session_get_user_data(sess); … … 1129 1138 } 1130 1139 1140 /* Ignore response if it reports the same address */ 1141 if (cand->addr.ipv4.sin_addr.s_addr == mapped_addr->ipv4.sin_addr.s_addr && 1142 cand->addr.ipv4.sin_port == mapped_addr->ipv4.sin_port) 1143 { 1144 return; 1145 } 1146 1147 pj_ansi_strcpy(ip, pj_inet_ntoa(comp->local_addr.ipv4.sin_addr)); 1148 1131 1149 PJ_LOG(4,(comp->ice_st->obj_name, 1132 "STUN mapped address: %s:%d", 1150 "STUN mapped address for %s:%d is %s:%d", 1151 ip, (int)pj_ntohs(comp->local_addr.ipv4.sin_port), 1133 1152 pj_inet_ntoa(mapped_addr->ipv4.sin_addr), 1134 1153 (int)pj_ntohs(mapped_addr->ipv4.sin_port))); … … 1142 1161 /* We have STUN, so we must start the keep-alive timer */ 1143 1162 start_ka_timer(comp->ice_st); 1144 } 1145 1163 1164 /* Notify app that STUN address has changed. */ 1165 if (comp->ice_st->cb.on_addr_change) 1166 (*comp->ice_st->cb.on_addr_change)(comp->ice_st, comp->comp_id, 1167 (cand - comp->cand_list)); 1168 } 1169
Note: See TracChangeset
for help on using the changeset viewer.