blob: 51ffff706e35b1b5c7fd5366d2c7acb3ca959b6e [file] [log] [blame]
Oliver Smith10632132023-05-12 12:14:22 +02001/* Filter/overlay data rates for CSD, across MS, RAN and CN limitations */
2/*
3 * (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
4 * All Rights Reserved
5 *
6 * Author: Oliver Smith
7 *
8 * SPDX-License-Identifier: GPL-2.0+
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 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 General Public License for more details.
19 */
20#pragma once
21
22#include <osmocom/gsm/gsm_utils.h>
23#include <osmocom/gsm/mncc.h>
24#include <osmocom/mgcp_client/mgcp_client.h>
25
26#include <osmocom/msc/csd_bs.h>
27#include <osmocom/msc/sdp_msg.h>
28
29/* Combine various data rate selections to obtain a resulting set allowed by
30 * all of them. Members reflect the different entities/stages that select data
31 * rates in CSD. Call csd_filter_run() and obtain the resulting set in
32 * csd_filter.result. */
33struct csd_filter {
34 /* The fixed set available on the RAN type, per definition. */
35 struct csd_bs_list ran;
36 /* The services advertised by the MS Bearer Capabilities */
37 struct csd_bs_list ms;
38 /* If known, the set the current RAN cell allows / has available. This
39 * may not be available if the BSC does not issue this information
40 * early enough. Should be ignored if empty. */
41 struct csd_bs_list bss;
42
43 /* After a channel was assigned, this reflects the chosen BS. */
44 enum csd_bs assignment;
45};
46
47void csd_filter_set_ran(struct csd_filter *filter, enum osmo_rat_type ran_type);
48int csd_filter_run(struct csd_filter *filter, struct sdp_msg *result, const struct sdp_msg *remote);
49
50int csd_filter_to_str_buf(char *buf, size_t buflen, const struct csd_filter *filter,
51 const struct sdp_msg *result, const struct sdp_msg *remote);
52char *csd_filter_to_str_c(void *ctx, const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote);
53const char *csd_filter_to_str(const struct csd_filter *filter, const struct sdp_msg *result, const struct sdp_msg *remote);