blob: 51908b429686458bee4987dd10728dfea265b4a2 [file] [log] [blame]
Maxea8b0d42017-02-14 16:53:04 +01001/* OsmoHLR TX/RX lu operations */
2
3/* (C) 2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
4 * All Rights Reserved
5 *
6 * Author: Harald Welte <laforge@gnumonks.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#pragma once
24
25#include <stdbool.h>
26
27#include <osmocom/core/timer.h>
28#include <osmocom/gsm/gsup.h>
29
30#include "db.h"
Neels Hofmeyr9d307ec2018-05-04 16:06:32 +020031#include "gsup_server.h"
Maxea8b0d42017-02-14 16:53:04 +010032
33#define CANCEL_TIMEOUT_SECS 30
34#define ISD_TIMEOUT_SECS 30
35
36enum lu_state {
37 LU_S_NULL,
38 LU_S_LU_RECEIVED,
39 LU_S_CANCEL_SENT,
40 LU_S_CANCEL_ACK_RECEIVED,
41 LU_S_ISD_SENT,
42 LU_S_ISD_ACK_RECEIVED,
43 LU_S_COMPLETE,
44};
45
46extern const struct value_string lu_state_names[];
47
48struct lu_operation {
49 /*! entry in global list of location update operations */
50 struct llist_head list;
51 /*! to which gsup_server do we belong */
52 struct osmo_gsup_server *gsup_server;
53 /*! state of the location update */
54 enum lu_state state;
55 /*! CS (false) or PS (true) Location Update? */
56 bool is_ps;
Piotr Krysik0b497962019-08-22 11:18:15 +020057 /*! RAT type indicator: coming in on GERAN-A? UTRAN-Iu? E-UTRAN?*/
Neels Hofmeyrf1949f72018-12-26 01:49:53 +010058 enum osmo_rat_type via_rat;
59
Maxea8b0d42017-02-14 16:53:04 +010060 /*! currently running timer */
61 struct osmo_timer_list timer;
62
63 /*! subscriber related to this operation */
64 struct hlr_subscriber subscr;
65 /*! peer VLR/SGSN starting the request */
66 uint8_t *peer;
67};
68
Maxea8b0d42017-02-14 16:53:04 +010069
70struct lu_operation *lu_op_alloc(struct osmo_gsup_server *srv);
71struct lu_operation *lu_op_alloc_conn(struct osmo_gsup_conn *conn);
72void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state);
73bool lu_op_fill_subscr(struct lu_operation *luop, struct db_context *dbc,
74 const char *imsi);
75struct lu_operation *lu_op_by_imsi(const char *imsi,
76 const struct llist_head *lst);
77
78void lu_op_tx_error(struct lu_operation *luop, enum gsm48_gmm_cause cause);
79void lu_op_tx_ack(struct lu_operation *luop);
80void lu_op_tx_cancel_old(struct lu_operation *luop);
81void lu_op_tx_insert_subscr_data(struct lu_operation *luop);
Max9cacb6f2017-02-20 17:22:56 +010082void lu_op_tx_del_subscr_data(struct lu_operation *luop);
Neels Hofmeyr200f56e2017-10-17 01:46:04 +020083
84void lu_op_free(struct lu_operation *luop);