Example #1
0
static int replace_network_address(struct sdp_chopper *chop, struct network_address *address,
		struct packet_stream *ps, struct sdp_ng_flags *flags)
{
	char buf[64];
	int len;
	struct packet_stream *sink = packet_stream_sink(ps);

	if (is_addr_unspecified(&address->parsed)
			&& !(sink && is_trickle_ice_address(&sink->advertised_endpoint)))
		return 0;

	if (copy_up_to(chop, &address->address_type))
		return -1;

	if (flags->media_address.s && is_addr_unspecified(&flags->parsed_media_address))
		__parse_address(&flags->parsed_media_address, NULL, NULL, &flags->media_address);

	if (!is_addr_unspecified(&flags->parsed_media_address))
		len = sprintf(buf, "%s %s",
				flags->parsed_media_address.family->rfc_name,
				sockaddr_print_buf(&flags->parsed_media_address));
	else
		call_stream_address46(buf, ps, SAF_NG, &len, NULL);
	chopper_append_dup(chop, buf, len);

	if (skip_over(chop, &address->address))
		return -1;

	return 0;
}
Example #2
0
static int insert_ice_address(struct sdp_chopper *chop, struct packet_stream *ps, struct interface_address *ifa) {
	char buf[64];
	int len;

	call_stream_address46(buf, ps, SAF_ICE, &len, ifa);
	chopper_append_dup(chop, buf, len);
	chopper_append_printf(chop, " %hu", ps->sfd->fd.localport);

	return 0;
}
Example #3
0
static int insert_ice_address(struct sdp_chopper *chop, struct stream_fd *sfd) {
	char buf[64];
	int len;

	call_stream_address46(buf, sfd->stream, SAF_ICE, &len, sfd->local_intf);
	chopper_append_dup(chop, buf, len);
	chopper_append_printf(chop, " %u", sfd->socket.local.port);

	return 0;
}
Example #4
0
static int insert_raddr_rport(struct sdp_chopper *chop, struct packet_stream *ps, const struct local_intf *ifa) {
        char buf[64];
        int len;

	chopper_append_c(chop, " raddr ");
	call_stream_address46(buf, ps, SAF_ICE, &len, ifa);
	chopper_append_dup(chop, buf, len);
	chopper_append_c(chop, " rport ");
	chopper_append_printf(chop, "%u", ps->selected_sfd->socket.local.port);

	return 0;
}