- Timestamp:
- Jun 21, 2008 5:52:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_session.c
r1988 r2045 104 104 pj_hash_table_t *peer_table; 105 105 106 pj_uint32_t send_ind_tsx_id[3]; 106 107 /* tx_pkt must be 16bit aligned */ 107 108 pj_uint8_t tx_pkt[PJ_TURN_MAX_PKT_LEN]; … … 801 802 * Indication. 802 803 */ 803 pj_stun_tx_data *tdata; 804 pj_stun_sockaddr_attr peer_attr; 805 pj_stun_binary_attr data_attr; 806 pj_stun_msg send_ind; 807 pj_size_t send_ind_len; 808 809 /* Increment counter */ 810 ++sess->send_ind_tsx_id[3]; 804 811 805 812 /* Create blank SEND-INDICATION */ 806 status = pj_stun_session_create_ind(sess->stun, 807 PJ_STUN_SEND_INDICATION, &tdata); 813 status = pj_stun_msg_init(&send_ind, PJ_STUN_SEND_INDICATION, 814 PJ_STUN_MAGIC, 815 (const pj_uint8_t*)sess->send_ind_tsx_id); 808 816 if (status != PJ_SUCCESS) 809 817 goto on_return; 810 818 811 819 /* Add PEER-ADDRESS */ 812 pj_stun_ msg_add_sockaddr_attr(tdata->pool, tdata->msg,813 PJ_STUN_ATTR_PEER_ADDR, PJ_TRUE,814 addr, addr_len);820 pj_stun_sockaddr_attr_init(&peer_attr, PJ_STUN_ATTR_PEER_ADDR, 821 PJ_TRUE, addr, addr_len); 822 pj_stun_msg_add_attr(&send_ind, (pj_stun_attr_hdr*)&peer_attr); 815 823 816 824 /* Add DATA attribute */ 817 pj_stun_msg_add_binary_attr(tdata->pool, tdata->msg, 818 PJ_STUN_ATTR_DATA, pkt, pkt_len); 819 820 /* Send the indication */ 821 status = pj_stun_session_send_msg(sess->stun, NULL, PJ_FALSE, 822 PJ_FALSE, sess->srv_addr, 823 pj_sockaddr_get_len(sess->srv_addr), 824 tdata); 825 pj_stun_binary_attr_init(&data_attr, NULL, PJ_STUN_ATTR_DATA, NULL, 0); 826 data_attr.data = (void*)pkt; 827 data_attr.length = pkt_len; 828 pj_stun_msg_add_attr(&send_ind, (pj_stun_attr_hdr*)&data_attr); 829 830 /* Encode the message */ 831 status = pj_stun_msg_encode(&send_ind, sess->tx_pkt, 832 sizeof(sess->tx_pkt), 0, 833 NULL, &send_ind_len); 834 if (status != PJ_SUCCESS) 835 goto on_return; 836 837 /* Send the Send Indication */ 838 status = sess->cb.on_send_pkt(sess, sess->tx_pkt, send_ind_len, 839 sess->srv_addr, 840 pj_sockaddr_get_len(sess->srv_addr)); 825 841 } 826 842
Note: See TracChangeset
for help on using the changeset viewer.