MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_parse_sdp_stream_name

Function pv_parse_sdp_stream_name

sdp_ops.c:877–978  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875
876
877int pv_parse_sdp_stream_name(pv_spec_p sp, const str *_in)
878{
879 str in = *_in, tok;
880 int escape = 0, i, midx = 0;
881 struct sdp_pv_param *param;
882 struct sdp_chunk_match *matches[4];
883 char *p;
884
885 if (!sp)
886 return -1;
887
888 if (!in.s || in.len == 0)
889 goto done;
890
891 if (in.s[0] == PV_MARKER) {
892 LM_ERR("no support for dynamic names in $sdp.line\n");
893 return -1;
894 } else if (in.s[0] == '@') {
895 // TODO: impl custom SDP holders (perhaps using a map)
896 return -1;
897 }
898
899 param = pkg_malloc(sizeof *param);
900 if (!param) {
901 LM_ERR("oom\n");
902 return -1;
903 }
904 memset(param, 0, sizeof *param);
905
906 matches[0] = &param->match_stream;
907 matches[1] = &param->match_line;
908 matches[2] = &param->match_token;
909 matches[3] = NULL;
910
911 tok.s = in.s;
912 for (i = 0; i < in.len; i++) {
913 if (!matches[midx])
914 break;
915
916 if (escape && (in.s[i] == '\\' || in.s[i] == '/')) {
917 memmove(&in.s[i-1], &in.s[i], in.len - i);
918 in.len--;
919 i--;
920 escape = 0;
921 continue;
922 }
923
924 if (in.s[i] == '\\') {
925 escape = 1;
926 continue;
927 }
928 escape = 0;
929
930 if (in.s[i] == '[' || in.s[i] == '/') {
931 tok.len = i - (tok.s - in.s);
932 trim_leading(&tok);
933
934 if (in.s[i] == '[') {

Callers

nothing calls this directly

Calls 4

trim_leadingFunction · 0.85
parse_sdp_pv_indexFunction · 0.85
q_memchrFunction · 0.85
IDX_STRFunction · 0.85

Tested by

no test coverage detected