Changeset 2234 for pjproject/trunk/pjnath/src/pjturn-srv/server.c
- Timestamp:
- Aug 22, 2008 5:46:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjturn-srv/server.c
r1929 r2234 552 552 } 553 553 554 /* Handle STUN Binding request */ 555 static void handle_binding_request(pj_turn_pkt *pkt, 556 unsigned options) 557 { 558 pj_stun_msg *request, *response; 559 pj_uint8_t pdu[200]; 560 pj_size_t len; 561 pj_status_t status; 562 563 /* Decode request */ 564 status = pj_stun_msg_decode(pkt->pool, pkt->pkt, pkt->len, options, 565 &request, NULL, NULL); 566 if (status != PJ_SUCCESS) 567 return; 568 569 /* Create response */ 570 status = pj_stun_msg_create_response(pkt->pool, request, 0, NULL, 571 &response); 572 if (status != PJ_SUCCESS) 573 return; 574 575 /* Add XOR-MAPPED-ADDRESS */ 576 pj_stun_msg_add_sockaddr_attr(pkt->pool, response, 577 PJ_STUN_ATTR_XOR_MAPPED_ADDR, 578 PJ_TRUE, 579 &pkt->src.clt_addr, 580 pkt->src_addr_len); 581 582 /* Encode */ 583 status = pj_stun_msg_encode(response, pdu, sizeof(pdu), 0, NULL, &len); 584 if (status != PJ_SUCCESS) 585 return; 586 587 /* Send response */ 588 pkt->transport->sendto(pkt->transport, pdu, len, 0, 589 &pkt->src.clt_addr, pkt->src_addr_len); 590 } 554 591 555 592 /* … … 616 653 } 617 654 655 /* Special handling for Binding Request. We won't give it to the 656 * STUN session since this request is not authenticated. 657 */ 658 if (pkt->pkt[1] == 1) { 659 handle_binding_request(pkt, options); 660 return; 661 } 662 618 663 /* Hand over processing to STUN session. This will trigger 619 664 * on_rx_stun_request() callback to be called if the STUN
Note: See TracChangeset
for help on using the changeset viewer.