blob: d51bcebe094c572363ad2e24b86bb85840dce05d [file] [log] [blame]
Neels Hofmeyr72992152020-09-19 02:36:08 +02001/* (C) 2020 by Harald Welte <laforge@gnumonks.org>
2 * All Rights Reserved
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/lienses/>.
16 *
17 */
18
19#include <osmocom/core/stats.h>
20#include <osmocom/smlc/smlc_data.h>
21
22struct osmo_tdef g_smlc_tdefs[] = {
23 { .T=-12, .default_val=5, .desc="Timeout for BSSLAP TA Response from BSC" },
24 {}
25};
26
27static const struct rate_ctr_desc smlc_ctr_description[] = {
28 [SMLC_CTR_BSSMAP_LE_RX_UDT_RESET] = { "bssmap_le:rx_udt_reset", "Rx BSSMAP-LE Reset" },
29 [SMLC_CTR_BSSMAP_LE_RX_UDT_RESET_ACK] = { "bssmap_le:rx_udt_reset_ack", "Rx BSSMAP-LE Reset Acknowledge" },
30 [SMLC_CTR_BSSMAP_LE_RX_UDT_ERR_INVALID_MSG] = { "bssmap_le:rx_udt_err_invalid_msg", "Receive invalid UnitData message" },
31 [SMLC_CTR_BSSMAP_LE_RX_DT1_ERR_INVALID_MSG] = { "bssmap_le:rx_dt1_err_invalid_msg", "Receive invalid DirectTransfer1 message" },
32 [SMLC_CTR_BSSMAP_LE_RX_DT1_PERFORM_LOCATION_REQUEST] = { "bssmap_le:rx_dt1_perform_location_request", "Receive Perform Location Request from BSC" },
33 [SMLC_CTR_BSSMAP_LE_RX_DT1_BSSLAP_TA_RESPONSE] = { "bssmap_le:rx_dt1_bsslap_ta_response", "Receive BSSLAP TA Response from BSC" },
34 [SMLC_CTR_BSSMAP_LE_RX_DT1_BSSLAP_REJECT] = { "bssmap_le:rx_dt1_bsslap_reject", "Rx BSSLAP Reject from BSC" },
35 [SMLC_CTR_BSSMAP_LE_RX_DT1_BSSLAP_RESET] = { "bssmap_le:rx_dt1_bsslap_reset", "Rx BSSLAP Reset (handover) from BSC" },
36 [SMLC_CTR_BSSMAP_LE_RX_DT1_BSSLAP_ABORT] = { "bssmap_le:rx_dt1_bsslap_abort", "Rx BSSLAP Abort from BSC" },
37
38 [SMLC_CTR_BSSMAP_LE_TX_ERR_INVALID_MSG] = { "bssmap_le:tx_err_invalid_msg", "BSSMAP-LE send error: invalid message" },
39 [SMLC_CTR_BSSMAP_LE_TX_ERR_CONN_NOT_READY] = { "bssmap_le:tx_err_conn_not_ready", "BSSMAP-LE send error: conn not ready" },
40 [SMLC_CTR_BSSMAP_LE_TX_ERR_SEND] = { "bssmap_le:tx_err_send", "BSSMAP-LE send error" },
41 [SMLC_CTR_BSSMAP_LE_TX_SUCCESS] = { "bssmap_le:tx_success", "BSSMAP-LE send success" },
42
43 [SMLC_CTR_BSSMAP_LE_TX_UDT_RESET] = { "bssmap_le:tx_udt_reset", "Transmit UnitData Reset" },
44 [SMLC_CTR_BSSMAP_LE_TX_UDT_RESET_ACK] = { "bssmap_le:tx_udt_reset_ack", "Transmit UnitData Reset Acknowledge" },
45 [SMLC_CTR_BSSMAP_LE_TX_DT1_PERFORM_LOCATION_RESPONSE] = { "bssmap_le:tx_dt1_perform_location_response", "Tx Perform Location Response to BSC" },
46 [SMLC_CTR_BSSMAP_LE_TX_DT1_BSSLAP_TA_REQUEST] = { "bssmap_le:tx_dt1_bsslap_ta_request", "Tx BSSLAP TA Request to BSC" },
47};
48
49static const struct rate_ctr_group_desc smlc_ctrg_desc = {
50 "smlc",
51 "serving mobile location center",
52 OSMO_STATS_CLASS_GLOBAL,
53 ARRAY_SIZE(smlc_ctr_description),
54 smlc_ctr_description,
55};
56
57struct smlc_state *smlc_state_alloc(void *ctx)
58{
59 struct smlc_state *smlc = talloc_zero(ctx, struct smlc_state);
60 OSMO_ASSERT(smlc);
61 INIT_LLIST_HEAD(&smlc->subscribers);
62 INIT_LLIST_HEAD(&smlc->cell_locations);
63 smlc->ctrs = rate_ctr_group_alloc(smlc, &smlc_ctrg_desc, 0);
64 return smlc;
65}