Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 1 | #ifndef _TRANSACT_H |
| 2 | #define _TRANSACT_H |
| 3 | |
| 4 | #include <openbsc/gsm_data.h> |
| 5 | #include <openbsc/gsm_subscriber.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 6 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 7 | #include <openbsc/gsm_04_11.h> |
Harald Welte | f142c97 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 8 | #include <openbsc/mncc.h> |
Andreas Eversberg | f7396ea | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 9 | #include <osmocom/gsm/gsm0411_smc.h> |
Andreas Eversberg | bc6c43f | 2011-10-28 11:11:13 +0200 | [diff] [blame] | 10 | #include <osmocom/gsm/gsm0411_smr.h> |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 11 | |
| 12 | /* One transaction */ |
| 13 | struct gsm_trans { |
| 14 | /* Entry in list of all transactions */ |
| 15 | struct llist_head entry; |
| 16 | |
Neels Hofmeyr | 8ce66fd | 2016-08-29 17:52:39 +0200 | [diff] [blame] | 17 | /* Back pointer to the network struct */ |
Jacob Erlbeck | f07c605 | 2014-12-02 11:58:00 +0100 | [diff] [blame] | 18 | struct gsm_network *net; |
| 19 | |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 20 | /* The protocol within which we live */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 21 | uint8_t protocol; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 22 | |
| 23 | /* The current transaction ID */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 24 | uint8_t transaction_id; |
Neels Hofmeyr | 8ce66fd | 2016-08-29 17:52:39 +0200 | [diff] [blame] | 25 | |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 26 | /* To whom we belong, unique identifier of remote MM entity */ |
Harald Welte | 7b423ed | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 27 | struct vlr_subscr *vsub; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 28 | |
Holger Hans Peter Freyther | e95d482 | 2010-03-23 07:00:22 +0100 | [diff] [blame] | 29 | /* The associated connection we are using to transmit messages */ |
| 30 | struct gsm_subscriber_connection *conn; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 31 | |
| 32 | /* reference from MNCC or other application */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 33 | uint32_t callref; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 34 | |
Harald Welte | da7ab74 | 2009-12-19 22:23:05 +0100 | [diff] [blame] | 35 | /* if traffic channel receive was requested */ |
| 36 | int tch_recv; |
| 37 | |
Holger Hans Peter Freyther | 49b3ed2 | 2010-12-29 17:09:07 +0100 | [diff] [blame] | 38 | /* is thats one paging? */ |
Holger Hans Peter Freyther | d6d7aff | 2015-04-06 12:03:45 +0200 | [diff] [blame] | 39 | struct subscr_request *paging_request; |
Holger Hans Peter Freyther | 49b3ed2 | 2010-12-29 17:09:07 +0100 | [diff] [blame] | 40 | |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 41 | union { |
| 42 | struct { |
| 43 | |
| 44 | /* current call state */ |
| 45 | int state; |
| 46 | |
| 47 | /* current timer and message queue */ |
| 48 | int Tcurrent; /* current CC timer */ |
| 49 | int T308_second; /* used to send release again */ |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 50 | struct osmo_timer_list timer; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 51 | struct gsm_mncc msg; /* stores setup/disconnect/release message */ |
| 52 | } cc; |
| 53 | struct { |
Andreas Eversberg | f7396ea | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 54 | struct gsm411_smc_inst smc_inst; |
Andreas Eversberg | bc6c43f | 2011-10-28 11:11:13 +0200 | [diff] [blame] | 55 | struct gsm411_smr_inst smr_inst; |
Andreas Eversberg | f7396ea | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 56 | |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 57 | struct gsm_sms *sms; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 58 | } sms; |
| 59 | }; |
| 60 | }; |
| 61 | |
| 62 | |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 63 | |
Jacob Erlbeck | dae1f64 | 2014-12-02 14:22:53 +0100 | [diff] [blame] | 64 | struct gsm_trans *trans_find_by_id(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 65 | uint8_t proto, uint8_t trans_id); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 66 | struct gsm_trans *trans_find_by_callref(struct gsm_network *net, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 67 | uint32_t callref); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 68 | |
Jacob Erlbeck | af792d6 | 2014-12-02 14:22:53 +0100 | [diff] [blame] | 69 | struct gsm_trans *trans_alloc(struct gsm_network *net, |
Harald Welte | 7b423ed | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 70 | struct vlr_subscr *vsub, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 71 | uint8_t protocol, uint8_t trans_id, |
| 72 | uint32_t callref); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 73 | void trans_free(struct gsm_trans *trans); |
| 74 | |
Harald Welte | 7b423ed | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 75 | int trans_assign_trans_id(struct gsm_network *net, struct vlr_subscr *vsub, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 76 | uint8_t protocol, uint8_t ti_flag); |
Holger Hans Peter Freyther | 70ae5d3 | 2012-11-23 21:33:15 +0100 | [diff] [blame] | 77 | int trans_has_conn(const struct gsm_subscriber_connection *conn); |
Harald Welte | 7b423ed | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 78 | void trans_conn_closed(struct gsm_subscriber_connection *conn); |
Harald Welte | cc9beb5 | 2009-12-17 17:13:28 +0100 | [diff] [blame] | 79 | |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 80 | #endif |