blob: aed7ad096998083f18ec4b28f661ae37cb9c8659 [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
Neels Hofmeyra75d1c22019-11-20 03:35:37 +010022#include <osmocom/gsupclient/gsup_peer_id.h>
23#include <osmocom/mslookup/mslookup.h>
24
Neels Hofmeyr32cc07a2019-11-20 03:35:37 +010025struct osmo_mslookup_query;
26struct osmo_mslookup_result;
27
28/*! mslookup service name used for roaming/proxying between osmo-hlr instances. */
29#define OSMO_MSLOOKUP_SERVICE_HLR_GSUP "gsup.hlr"
30
31/*! What addresses to return to mslookup queries when a subscriber is attached at the local site.
32 * Mapping of service name to IP address and port. This corresponds to the VTY config for
33 * 'mslookup' / 'server' [/ 'msc MSC-1-2-3'] / 'service sip.voice at 1.2.3.4 1234'.
34 */
35struct mslookup_service_host {
36 struct llist_head entry;
37 char service[OSMO_MSLOOKUP_SERVICE_MAXLEN+1];
38 struct osmo_sockaddr_str host_v4;
39 struct osmo_sockaddr_str host_v6;
40};
41
42/*! Sets of mslookup_service_host per connected MSC.
43 * When there are more than one MSC connected to this osmo-hlr, this allows keeping separate sets of service addresses
44 * for each MSC. The entry with mslookup_server_msc_wildcard as MSC name is used for all MSCs (if no match for that
45 * particular MSC is found). This corresponds to the VTY config for
46 * 'mslookup' / 'server' / 'msc MSC-1-2-3'.
47 */
48struct mslookup_server_msc_cfg {
49 struct llist_head entry;
50 struct osmo_ipa_name name;
51 struct llist_head service_hosts;
52};
53
54struct mslookup_service_host *mslookup_server_service_get(const struct osmo_ipa_name *msc_name, const char *service);
55
56struct mslookup_service_host *mslookup_server_msc_service_get(struct mslookup_server_msc_cfg *msc, const char *service,
57 bool create);
58int mslookup_server_msc_service_set(struct mslookup_server_msc_cfg *msc, const char *service,
59 const struct osmo_sockaddr_str *addr);
60int mslookup_server_msc_service_del(struct mslookup_server_msc_cfg *msc, const char *service,
61 const struct osmo_sockaddr_str *addr);
62
63extern const struct osmo_ipa_name mslookup_server_msc_wildcard;
64struct mslookup_server_msc_cfg *mslookup_server_msc_get(const struct osmo_ipa_name *msc_name, bool create);
65
66const struct mslookup_service_host *mslookup_server_get_local_gsup_addr();
67void mslookup_server_rx(const struct osmo_mslookup_query *query,
68 struct osmo_mslookup_result *result);
Neels Hofmeyr647c1062019-11-20 03:35:37 +010069
70bool subscriber_has_done_lu_here(const struct osmo_mslookup_query *query,
71 uint32_t *lu_age_p, struct osmo_ipa_name *local_msc_name,
72 char *ret_imsi, size_t ret_imsi_len);