end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
switch_stun_packet_first_attribute(packet, attr);
+ switch_assert(attr);
+
+
do {
switch (attr->type) {
case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
- if (attr->type) {
- if (funny) {
- switch_stun_ip_t *tmp = (switch_stun_ip_t *) attr->value;
- tmp->address ^= ntohl(0xabcdabcd);
- }
- switch_stun_packet_attribute_get_mapped_address(attr, rip, sizeof(rip), &rport);
+ if (funny) {
+ switch_stun_ip_t *tmp = (switch_stun_ip_t *) attr->value;
+ tmp->address ^= ntohl(0xabcdabcd);
}
+ switch_stun_packet_attribute_get_mapped_address(attr, rip, sizeof(rip), &rport);
break;
case SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS:
- if (attr->type) {
- switch_stun_packet_attribute_get_xor_mapped_address(attr, &packet->header, rip, sizeof(rip), &rport);
- }
+ switch_stun_packet_attribute_get_xor_mapped_address(attr, &packet->header, rip, sizeof(rip), &rport);
break;
case SWITCH_STUN_ATTR_USERNAME:
- if (attr->type) {
- switch_stun_packet_attribute_get_username(attr, username, 32);
- }
+ switch_stun_packet_attribute_get_username(attr, username, 32);
break;
}