Max | ea8b0d4 | 2017-02-14 16:53:04 +0100 | [diff] [blame] | 1 | /* 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 | |
Neels Hofmeyr | 2f75803 | 2019-11-20 00:37:07 +0100 | [diff] [blame] | 30 | #include <osmocom/hlr/db.h> |
| 31 | #include <osmocom/hlr/gsup_server.h> |
Max | ea8b0d4 | 2017-02-14 16:53:04 +0100 | [diff] [blame] | 32 | |
| 33 | #define CANCEL_TIMEOUT_SECS 30 |
| 34 | #define ISD_TIMEOUT_SECS 30 |
| 35 | |
| 36 | enum 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 | |
| 46 | extern const struct value_string lu_state_names[]; |
| 47 | |
| 48 | struct 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; |
| 57 | /*! currently running timer */ |
| 58 | struct osmo_timer_list timer; |
| 59 | |
| 60 | /*! subscriber related to this operation */ |
| 61 | struct hlr_subscriber subscr; |
| 62 | /*! peer VLR/SGSN starting the request */ |
| 63 | uint8_t *peer; |
| 64 | }; |
| 65 | |
Max | ea8b0d4 | 2017-02-14 16:53:04 +0100 | [diff] [blame] | 66 | |
| 67 | struct lu_operation *lu_op_alloc(struct osmo_gsup_server *srv); |
| 68 | struct lu_operation *lu_op_alloc_conn(struct osmo_gsup_conn *conn); |
| 69 | void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state); |
| 70 | bool lu_op_fill_subscr(struct lu_operation *luop, struct db_context *dbc, |
| 71 | const char *imsi); |
| 72 | struct lu_operation *lu_op_by_imsi(const char *imsi, |
| 73 | const struct llist_head *lst); |
| 74 | |
| 75 | void lu_op_tx_error(struct lu_operation *luop, enum gsm48_gmm_cause cause); |
| 76 | void lu_op_tx_ack(struct lu_operation *luop); |
| 77 | void lu_op_tx_cancel_old(struct lu_operation *luop); |
| 78 | void lu_op_tx_insert_subscr_data(struct lu_operation *luop); |
Max | 9cacb6f | 2017-02-20 17:22:56 +0100 | [diff] [blame] | 79 | void lu_op_tx_del_subscr_data(struct lu_operation *luop); |
Neels Hofmeyr | 200f56e | 2017-10-17 01:46:04 +0200 | [diff] [blame] | 80 | |
| 81 | void lu_op_free(struct lu_operation *luop); |