Coverage Report

Created: 2025-07-09 06:29

/src/opensips/sdp_ops.h
Line
Count
Source (jump to first uncovered line)
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
30
0
#define SDP_MAX_LINES 500
31
32
struct sdp_pv_idx {
33
  int is_pv_idx;
34
  union {
35
    int idx;
36
    pv_spec_t idx_pv;
37
  };
38
};
39
40
struct sdp_chunk_match {
41
  str prefix;
42
  struct sdp_pv_idx idx;
43
};
44
45
struct sdp_pv_param {
46
  struct sdp_chunk_match match_stream;
47
  struct sdp_chunk_match match_line;
48
  struct sdp_chunk_match match_token;
49
};
50
51
struct sdp_ops_line {
52
  str line;
53
  int newbuf, have_gap;
54
};
55
56
struct sdp_body_part_ops {
57
  str content_type;
58
  str sdp;
59
60
  char sep[2];
61
  int sep_len;
62
63
  struct sdp_ops_line lines[SDP_MAX_LINES];
64
  int lines_sz;
65
  str rebuilt_sdp;
66
67
  int flags;  /* e.g. SDP_OPS_FL_DIRTY */
68
};
69
70
static inline int have_sdp_ops(struct sip_msg *msg)
71
0
{
72
0
  return msg->sdp_ops && (
73
0
    msg->sdp_ops->flags & (SDP_OPS_FL_DIRTY|SDP_OPS_FL_NULL)
74
0
      || msg->sdp_ops->sdp.s || msg->sdp_ops->rebuilt_sdp.s);
75
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
76
void free_sdp_ops(struct sdp_body_part_ops *ops);
77
78
int pv_set_sdp(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
79
int pv_parse_sdp_name(pv_spec_p sp, const str *in);
80
81
int pv_get_sdp_line(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
82
int pv_set_sdp_line(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
83
int pv_parse_sdp_line_name(pv_spec_p sp, const str *in);
84
int pv_parse_sdp_line_index(pv_spec_p sp, const str *in);
85
86
int pv_get_sdp_stream(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
87
int pv_set_sdp_stream(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
88
int pv_parse_sdp_stream_name(pv_spec_p sp, const str *in);
89
90
int pv_get_sdp_stream_idx(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
91
92
int pv_get_sdp_session(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
93
int pv_set_sdp_session(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val);
94
int pv_parse_sdp_session_name(pv_spec_p sp, const str *in);
95
96
#endif /* __SDP_OPS_H__ */