blob: 54253283b27efbda1efefc28e0916a60463e16ca [file] [log] [blame]
Neels Hofmeyr32cc07a2019-11-20 03:35:37 +01001/* Copyright 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
2 *
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#pragma once
21
22struct osmo_mslookup_query;
23struct osmo_mslookup_result;
24
25/*! mslookup service name used for roaming/proxying between osmo-hlr instances. */
26#define OSMO_MSLOOKUP_SERVICE_HLR_GSUP "gsup.hlr"
27
28/*! What addresses to return to mslookup queries when a subscriber is attached at the local site.
29 * Mapping of service name to IP address and port. This corresponds to the VTY config for
30 * 'mslookup' / 'server' [/ 'msc MSC-1-2-3'] / 'service sip.voice at 1.2.3.4 1234'.
31 */
32struct mslookup_service_host {
33 struct llist_head entry;
34 char service[OSMO_MSLOOKUP_SERVICE_MAXLEN+1];
35 struct osmo_sockaddr_str host_v4;
36 struct osmo_sockaddr_str host_v6;
37};
38
39/*! Sets of mslookup_service_host per connected MSC.
40 * When there are more than one MSC connected to this osmo-hlr, this allows keeping separate sets of service addresses
41 * for each MSC. The entry with mslookup_server_msc_wildcard as MSC name is used for all MSCs (if no match for that
42 * particular MSC is found). This corresponds to the VTY config for
43 * 'mslookup' / 'server' / 'msc MSC-1-2-3'.
44 */
45struct mslookup_server_msc_cfg {
46 struct llist_head entry;
47 struct osmo_ipa_name name;
48 struct llist_head service_hosts;
49};
50
51struct mslookup_service_host *mslookup_server_service_get(const struct osmo_ipa_name *msc_name, const char *service);
52
53struct mslookup_service_host *mslookup_server_msc_service_get(struct mslookup_server_msc_cfg *msc, const char *service,
54 bool create);
55int mslookup_server_msc_service_set(struct mslookup_server_msc_cfg *msc, const char *service,
56 const struct osmo_sockaddr_str *addr);
57int mslookup_server_msc_service_del(struct mslookup_server_msc_cfg *msc, const char *service,
58 const struct osmo_sockaddr_str *addr);
59
60extern const struct osmo_ipa_name mslookup_server_msc_wildcard;
61struct mslookup_server_msc_cfg *mslookup_server_msc_get(const struct osmo_ipa_name *msc_name, bool create);
62
63const struct mslookup_service_host *mslookup_server_get_local_gsup_addr();
64void mslookup_server_rx(const struct osmo_mslookup_query *query,
65 struct osmo_mslookup_result *result);