MT#58535 rtpp_flags: deprecate `new_list_to_dict()`

Deprecate parsing of generic flags using `new_list_to_dict()`.

Leaving it only for `received-from` as it requires special
handling. Function signature is adopted accordingly.

The funciton itself calls the `call_ng_main_flags()` directly,
without really using intermediate bencode objects.

Change-Id: I320761a4b84da0128981f9b65e3ba69e9b4018ac
pull/1819/head
Donat Zenichev 1 year ago
parent 97f7098459
commit db6bfb9325

@ -137,31 +137,24 @@ static int str_key_val_prefix(const str * p, const char * q,
* Work with bencode objects. * Work with bencode objects.
*/ */
/* parse flags, which have their own sub-list */ /* parse `received-from` */
static bool new_list_to_dict(const char * key_name, static bool parse_received_from(str * key, str * val, bencode_buffer_t * buf,
str * key, sdp_ng_flags * out, enum call_opmode opmode)
str * val,
str * s,
bencode_buffer_t * buf,
bencode_item_t * dict,
bool received_from /* whether received-from is parsed */ )
{ {
bencode_item_t * item; bencode_item_t * item;
int ip_af = AF_UNSPEC; int ip_af = AF_UNSPEC;
str ipfamily; str ipfamily, s;
if(str_key_val_prefix(key, key_name, val, s)) { if(str_key_val_prefix(key, "received-from", val, &s)) {
item = bencode_list(buf); item = bencode_list(buf);
if (received_from) { /* only for received-from parsing */ ip_af = get_ip_type(s.s);
ip_af = get_ip_type(s->s);
ipfamily.len = 3; ipfamily.len = 3;
ipfamily.s = (ip_af == AF_INET) ? "IP4" : "IP6"; ipfamily.s = (ip_af == AF_INET) ? "IP4" : "IP6";
bencode_list_add_str(item, &ipfamily); bencode_list_add_str(item, &ipfamily);
}
bencode_list_add_str(item, s); bencode_list_add_str(item, &s);
bencode_dictionary_add(dict, key_name, item); /* root dict */ call_ng_main_flags(out, &STR_CONST_INIT("received-from"), item, opmode);
return true; return true;
} }
return false; return false;
@ -262,7 +255,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict,
enum call_opmode opmode, sdp_ng_flags * out) enum call_opmode opmode, sdp_ng_flags * out)
{ {
char * start, * end, * eptr, c; char * start, * end, * eptr, c;
str key, val, s; str key, val;
bencode_item_t * direction; bencode_item_t * direction;
bencode_buffer_t * buf; bencode_buffer_t * buf;
unsigned int transport = 0; unsigned int transport = 0;
@ -291,12 +284,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict,
break; break;
/* check for items which have their own sub-list */ /* check for items which have their own sub-list */
if (new_list_to_dict("replace", &key, &val, &s, buf, root_dict, false) || if (parse_received_from(&key, &val, buf, out, opmode))
new_list_to_dict("SDES", &key, &val, &s, buf, root_dict, false) ||
new_list_to_dict("T38", &key, &val, &s, buf, root_dict, false) ||
new_list_to_dict("T.38", &key, &val, &s, buf, root_dict, false) ||
new_list_to_dict("rtcp-mux", &key, &val, &s, buf, root_dict, false) ||
new_list_to_dict("received-from", &key, &val, &s, buf, root_dict, true))
{ {
goto next; goto next;
} }

Loading…
Cancel
Save