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)) { if (IN6_IS_ADDR_V4MAPPED(&flags->parsed_media_address)) len = sprintf(buf, "IP4 " IPF, IPP(flags->parsed_media_address.s6_addr32[3])); else { memcpy(buf, "IP6 ", 4); inet_ntop(AF_INET6, &flags->parsed_media_address, buf + 4, sizeof(buf)-4); len = strlen(buf); } } else call_stream_address(buf, ps, SAF_NG, &len); chopper_append_dup(chop, buf, len); if (skip_over(chop, &address->address)) return -1; return 0; }
static int call_stream_address_gstring(GString *o, struct packet_stream *ps, enum stream_address_format format) { int len, ret; char buf[64]; /* 64 bytes ought to be enough for anybody */ ret = call_stream_address(buf, ps, format, &len); g_string_append_len(o, buf, len); return ret; }