Harald Welte | 0df904d | 2018-12-03 11:00:04 +0100 | [diff] [blame] | 1 | /* (C) 2018-2019 by sysmocom s.f.m.c. GmbH |
| 2 | * All Rights Reserved |
| 3 | * |
| 4 | * Author: Harald Welte, Philipp Maier |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Affero General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include <arpa/inet.h> |
| 24 | #include <osmocom/gsm/protocol/gsm_29_118.h> |
| 25 | |
| 26 | #define DEFAULT_SGS_SERVER_IP "0.0.0.0" |
| 27 | #define DEFAULT_SGS_SERVER_VLR_NAME "vlr.example.net" |
| 28 | |
| 29 | /* global SGs state */ |
| 30 | struct sgs_state { |
| 31 | /* list of MMEs (sgs_mme_ctx) */ |
| 32 | struct llist_head mme_list; |
| 33 | |
| 34 | /* list of SCTP client connections */ |
| 35 | struct llist_head conn_list; |
| 36 | |
| 37 | /* SCTP server for inbound SGs connections */ |
| 38 | struct osmo_stream_srv_link *srv_link; |
| 39 | |
| 40 | struct { |
| 41 | char local_addr[INET6_ADDRSTRLEN]; |
| 42 | uint16_t local_port; |
| 43 | /* user-configured VLR name (FQDN) */ |
| 44 | char vlr_name[SGS_VLR_NAME_MAXLEN]; |
| 45 | /* timers on VLR side */ |
| 46 | unsigned int timer[_NUM_SGS_STATE_TIMERS]; |
Martin Hauke | 3f07dac | 2019-11-14 17:49:08 +0100 | [diff] [blame] | 47 | /* counters on VLR side */ |
Harald Welte | 0df904d | 2018-12-03 11:00:04 +0100 | [diff] [blame] | 48 | unsigned int counter[_NUM_SGS_STATE_COUNTERS]; |
| 49 | } cfg; |
| 50 | }; |
| 51 | |
| 52 | struct sgs_state *sgs_server_alloc(void *ctx); |
| 53 | int sgs_server_open(struct sgs_state *sgs); |