From 8e9e8b520add265668c81f577b354f57ab14d93d Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 1 Oct 2024 10:52:04 +0200 Subject: [PATCH] MT#60476 Discontinue `process_*_attributes()` Due to no usage just discontinue the following functionality: - `process_session_attributes()` - `process_media_attributes()` Change-Id: Ie1742aaa0155e27f94c72464d527c14c4cf03ee8 --- daemon/sdp.c | 226 --------------------------------------------------- 1 file changed, 226 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 23a6654fa..518ea3425 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -2267,232 +2267,6 @@ void sdp_chopper_destroy_ret(struct sdp_chopper *chop, str *ret) { sdp_chopper_destroy(chop); } -/* processing existing session attributes (those present in offer/answer) */ -static int process_session_attributes(struct sdp_chopper *chop, struct sdp_attributes *attrs, - sdp_ng_flags *flags) -{ - struct sdp_attribute *attr; - - for (__auto_type l = attrs->list.head; l; l = l->next) { - attr = l->data; - - struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, MT_UNKNOWN); - - switch (attr->attr) { - case ATTR_ICE: - case ATTR_ICE_UFRAG: - case ATTR_ICE_PWD: - case ATTR_ICE_OPTIONS: - case ATTR_ICE_LITE: - if (flags->ice_option != ICE_REMOVE && flags->ice_option != ICE_FORCE - && flags->ice_option != ICE_DEFAULT) - break; - goto strip; - - case ATTR_CANDIDATE: - if (flags->ice_option == ICE_FORCE_RELAY) { - if ((attr->candidate.type_str.len == 5) && - (strncasecmp(attr->candidate.type_str.s, "relay", 5) == 0)) - goto strip; - else - break; - } - if (flags->ice_option != ICE_REMOVE && flags->ice_option != ICE_FORCE - && flags->ice_option != ICE_DEFAULT) - break; - goto strip; - - case ATTR_FINGERPRINT: - case ATTR_SETUP: - case ATTR_TLS_ID: - case ATTR_IGNORE: - goto strip; - - case ATTR_INACTIVE: - case ATTR_SENDONLY: - case ATTR_RECVONLY: - case ATTR_SENDRECV: - if (!flags->original_sendrecv) - goto strip; - break; - - case ATTR_GROUP: - if (attr->group.semantics == GROUP_BUNDLE) - goto strip; - break; - - default: - break; - } - - /* if attr is supposed to be removed don't add to the chop->output */ - if (sdp_manipulate_remove_attr(sdp_manipulations, attr)) - goto strip; - - /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ - str *subst_str = sdp_manipulations_subst_attr(sdp_manipulations, attr); - if (subst_str) - goto strip_with_subst; - - continue; - -strip: - if (copy_up_to(chop, &attr->full_line)) - return -1; - if (skip_over(chop, &attr->full_line)) - return -1; - continue; - -strip_with_subst: - if (copy_up_to(chop, &attr->full_line)) - return -1; - if (skip_over(chop, &attr->full_line)) - return -1; - chopper_append_printf(chop, "a=" STR_FORMAT "\r\n", STR_FMT(subst_str)); - } - - return 0; -} - -/* processing existing media attributes (those present in offer/answer) */ -static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media *sdp, - sdp_ng_flags *flags, struct call_media *media) -{ - struct sdp_attributes *attrs = &sdp->attributes; - struct sdp_attribute *attr /* , *a */; - - for (__auto_type l = attrs->list.head; l; l = l->next) { - attr = l->data; - - // strip all attributes if we're sink and generator - make our own clean SDP - if (MEDIA_ISSET(media, GENERATOR)) - goto strip; - - struct sdp_manipulations *sdp_manipulations = sdp_manipulations_get_by_id(flags, - sdp->media_type_id); - - // protocol-agnostic attributes - switch (attr->attr) { - case ATTR_ICE: - case ATTR_ICE_UFRAG: - case ATTR_ICE_PWD: - case ATTR_ICE_OPTIONS: - case ATTR_ICE_LITE: - if (MEDIA_ISSET(media, PASSTHRU)) - break; - if (flags->ice_option != ICE_REMOVE && flags->ice_option != ICE_FORCE - && flags->ice_option != ICE_DEFAULT) - break; - goto strip; - - case ATTR_CANDIDATE: - if (flags->ice_option == ICE_FORCE_RELAY) { - if ((attr->candidate.type_str.len == 5) && - (strncasecmp(attr->candidate.type_str.s, "relay", 5) == 0)) - goto strip; - else - break; - } - if (MEDIA_ISSET(media, PASSTHRU)) - break; - if (flags->ice_option != ICE_REMOVE && flags->ice_option != ICE_FORCE - && flags->ice_option != ICE_DEFAULT) - break; - goto strip; - - case ATTR_IGNORE: - case ATTR_END_OF_CANDIDATES: // we strip it here and re-insert it later - case ATTR_MID: - goto strip; - - case ATTR_INACTIVE: - case ATTR_SENDONLY: - case ATTR_RECVONLY: - case ATTR_SENDRECV: - if (!flags->original_sendrecv) - goto strip; - break; - - /* strip all unknown type attributes if required, additionally: - * ssrc / msid / unknown types - */ - case ATTR_OTHER: - goto strip; - - default: - break; - } - - // leave everything alone if protocol is unsupported - if (!media->protocol) - continue; - - switch (attr->attr) { - case ATTR_RTCP: - case ATTR_RTCP_MUX: - if (flags->ice_option == ICE_FORCE_RELAY) - break; - goto strip; - - case ATTR_RTPMAP: - case ATTR_FMTP: - if (media->codecs.codec_prefs.length > 0) - goto strip; - break; - case ATTR_PTIME: - if (media->ptime) - goto strip; - break; - case ATTR_MAXPTIME: - if (media->maxptime) - goto strip; - break; - case ATTR_RTCP_FB: - if (media->codecs.codec_prefs.length > 0) - goto strip; - break; - - case ATTR_CRYPTO: - case ATTR_FINGERPRINT: - case ATTR_SETUP: - case ATTR_TLS_ID: - if (MEDIA_ISSET(media, PASSTHRU)) - break; - goto strip; - - default: - break; - } - - /* if attr is supposed to be removed don't add to the chop->output */ - if (sdp_manipulate_remove_attr(sdp_manipulations, attr)) - goto strip; - - /* if attr is supposed to be substituted don't add to the chop->output, but add another value */ - str *subst_str = sdp_manipulations_subst_attr(sdp_manipulations, attr); - if (subst_str) - goto strip_with_subst; - - continue; - -strip: - if (copy_up_to(chop, &attr->full_line)) - return -1; - if (skip_over(chop, &attr->full_line)) - return -1; - continue; - -strip_with_subst: - if (copy_up_to(chop, &attr->full_line)) - return -1; - if (skip_over(chop, &attr->full_line)) - return -1; - chopper_append_printf(chop, "a=" STR_FORMAT "\r\n", STR_FMT(subst_str)); - } - - return 0; -} - static void new_priority(struct call_media *media, enum ice_candidate_type type, unsigned int *tprefp, unsigned int *lprefp) {