blob: 77328655d3a38d5d6099fa09dc573f87a5bd598e [file] [log] [blame]
Philipp Maier87bd9be2017-08-22 16:35:41 +02001/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
2/* Message parser/generator utilities */
3
4/*
5 * (C) 2009-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
6 * (C) 2009-2012 by On-Waves
7 * (C) 2017 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
8 * All Rights Reserved
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
19 *
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25#pragma once
26
27#include <stdint.h>
28
29struct mgcp_conn;
30struct mgcp_parse_data;
31struct mgcp_endpoint;
32
33void mgcp_disp_msg(unsigned char *message, unsigned int len, char *preamble);
34
35int mgcp_parse_conn_mode(const char *msg, struct mgcp_endpoint *endp,
36 struct mgcp_conn *conn);
37
38int mgcp_parse_header(struct mgcp_parse_data *pdata, char *data);
39
40int mgcp_parse_osmux_cid(const char *line);
41
42int mgcp_check_param(const struct mgcp_endpoint *endp, const char *line);
43
44int mgcp_verify_call_id(struct mgcp_endpoint *endp, const char *callid);
45
Philipp Maier01d24a32017-11-21 17:26:09 +010046int mgcp_verify_ci(struct mgcp_endpoint *endp, const char *conn_id);
Philipp Maier87bd9be2017-08-22 16:35:41 +020047
48char *mgcp_strline(char *str, char **saveptr);
49
50#define for_each_line(line, save)\
51 for (line = mgcp_strline(NULL, &save); line;\
52 line = mgcp_strline(NULL, &save))
53
54#define for_each_non_empty_line(line, save)\
55 for (line = strtok_r(NULL, "\r\n", &save); line;\
56 line = strtok_r(NULL, "\r\n", &save))