Neels Hofmeyr | 32cc07a | 2019-11-20 03:35:37 +0100 | [diff] [blame] | 1 | /* 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 Hofmeyr | a75d1c2 | 2019-11-20 03:35:37 +0100 | [diff] [blame] | 22 | #include <osmocom/gsupclient/gsup_peer_id.h> |
| 23 | #include <osmocom/mslookup/mslookup.h> |
| 24 | |
Neels Hofmeyr | 32cc07a | 2019-11-20 03:35:37 +0100 | [diff] [blame] | 25 | struct osmo_mslookup_query; |
| 26 | struct 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 | */ |
| 35 | struct 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 | */ |
| 48 | struct mslookup_server_msc_cfg { |
| 49 | struct llist_head entry; |
| 50 | struct osmo_ipa_name name; |
| 51 | struct llist_head service_hosts; |
| 52 | }; |
| 53 | |
| 54 | struct mslookup_service_host *mslookup_server_service_get(const struct osmo_ipa_name *msc_name, const char *service); |
| 55 | |
| 56 | struct mslookup_service_host *mslookup_server_msc_service_get(struct mslookup_server_msc_cfg *msc, const char *service, |
| 57 | bool create); |
| 58 | int mslookup_server_msc_service_set(struct mslookup_server_msc_cfg *msc, const char *service, |
| 59 | const struct osmo_sockaddr_str *addr); |
| 60 | int mslookup_server_msc_service_del(struct mslookup_server_msc_cfg *msc, const char *service, |
| 61 | const struct osmo_sockaddr_str *addr); |
| 62 | |
| 63 | extern const struct osmo_ipa_name mslookup_server_msc_wildcard; |
| 64 | struct mslookup_server_msc_cfg *mslookup_server_msc_get(const struct osmo_ipa_name *msc_name, bool create); |
| 65 | |
| 66 | const struct mslookup_service_host *mslookup_server_get_local_gsup_addr(); |
| 67 | void mslookup_server_rx(const struct osmo_mslookup_query *query, |
| 68 | struct osmo_mslookup_result *result); |
Neels Hofmeyr | 647c106 | 2019-11-20 03:35:37 +0100 | [diff] [blame] | 69 | |
| 70 | bool 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); |