Coverage Report

Created: 2025-10-13 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opensips/sdp_ops.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2024-2025 OpenSIPS Solutions
3
 *
4
 * This file is part of opensips, a free SIP server.
5
 *
6
 * opensips is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version
10
 *
11
 * opensips is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
21
#ifndef __SDP_OPS_H__
22
#define __SDP_OPS_H__
23
24
#include "pvar.h"
25
26
0
#define SDP_OPS_FL_DIRTY  (1<<0) /* the SDP buffer requires a rebuild */
27
0
#define SDP_OPS_FL_NULL   (1<<1) /* a NULL SDP body has been forced */
28
0
#define SDP_OPS_FL_PARSED (1<<2) /* all lines in .sdp are parsed */
29
0
#define SDP_OPS_FL_NO_LLF (1<<3) /* the input SDP had no LF on last line
30
                                    ; for now not used, output is normalized */
31
32
0
#define SDP_MAX_LINES 500
33
34
struct sdp_pv_idx {
35
  int is_pv_idx;
36
  union {
37
    int idx;
38
    pv_spec_t idx_pv;
39
  };
40
};
41
42
struct sdp_chunk_match {
43
  str prefix;
44
  struct sdp_pv_idx idx;
45
};
46
47
struct sdp_pv_param {
48
  struct sdp_chunk_match match_stream;
49
  struct sdp_chunk_match match_line;
50
  struct sdp_chunk_match match_token;
51
};
52
53
struct sdp_ops_line {
54
  str line;
55
  int newbuf, have_gap;
56
};
57
58
struct sdp_body_part_ops {
59
  str content_type;
60
  str sdp;
61
62
  char sep[2];
63
  int sep_len;
64
65
  struct sdp_ops_line lines[SDP_MAX_LINES];
66
  int lines_sz;
67
  str rebuilt_sdp;
68
69
  int flags;  /* e.g. SDP_OPS_FL_DIRTY */
70
};
71
72
static inline int have_sdp_ops(struct sip_msg *msg)
73
0
{
74
0
  return msg->sdp_ops && (
75
0
    msg->sdp_ops->flags & (SDP_OPS_FL_DIRTY|SDP_OPS_FL_NULL)
76
0
      || msg->sdp_ops->sdp.s || msg->sdp_ops->rebuilt_sdp.s);
77
0
}
Unexecuted instantiation: msg_parser.c:have_sdp_ops
Unexecuted instantiation: sdp_ops.c:have_sdp_ops
Unexecuted instantiation: pvar.c:have_sdp_ops
Unexecuted instantiation: parse_body.c:have_sdp_ops
Unexecuted instantiation: msg_translator.c:have_sdp_ops
78
void free_sdp_ops(struct sdp_body_part_ops *ops);
79
80
int pv_set_sdp(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
81
int pv_parse_sdp_name(pv_spec_p sp, const str *in);
82
83
int pv_get_sdp_line(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
84
int pv_set_sdp_line(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
85
int pv_parse_sdp_line_name(pv_spec_p sp, const str *in);
86
int pv_parse_sdp_line_index(pv_spec_p sp, const str *in);
87
88
int pv_get_sdp_stream(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
89
int pv_set_sdp_stream(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
90
int pv_parse_sdp_stream_name(pv_spec_p sp, const str *in);
91
92
int pv_get_sdp_stream_idx(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
93
94
int pv_get_sdp_session(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
95
int pv_set_sdp_session(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
96
int pv_parse_sdp_session_name(pv_spec_p sp, const str *in);
97
98
#endif /* __SDP_OPS_H__ */