Harald Welte | d8c8e6f | 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 | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 6 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 7 | #include <openbsc/gsm_04_11.h> |
Harald Welte | 28dce91 | 2011-05-24 13:25:38 +0200 | [diff] [blame] | 8 | #include <openbsc/mncc.h> |
Andreas Eversberg | 12c52b7 | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 9 | #include <osmocom/gsm/gsm0411_smc.h> |
Andreas Eversberg | 3bd2ebc | 2011-10-28 11:11:13 +0200 | [diff] [blame] | 10 | #include <osmocom/gsm/gsm0411_smr.h> |
Harald Welte | 15797eb | 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 | |
| 17 | /* The protocol within which we live */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 18 | uint8_t protocol; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 19 | |
| 20 | /* The current transaction ID */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 21 | uint8_t transaction_id; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 22 | |
| 23 | /* To whom we belong, unique identifier of remote MM entity */ |
| 24 | struct gsm_subscriber *subscr; |
| 25 | |
Holger Hans Peter Freyther | 4009da4 | 2010-03-23 07:00:22 +0100 | [diff] [blame] | 26 | /* The associated connection we are using to transmit messages */ |
| 27 | struct gsm_subscriber_connection *conn; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 28 | |
| 29 | /* reference from MNCC or other application */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 30 | uint32_t callref; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 31 | |
Harald Welte | 3971ad5 | 2009-12-19 22:23:05 +0100 | [diff] [blame] | 32 | /* if traffic channel receive was requested */ |
| 33 | int tch_recv; |
| 34 | |
Holger Hans Peter Freyther | 02539b1 | 2010-12-29 17:09:07 +0100 | [diff] [blame] | 35 | /* is thats one paging? */ |
| 36 | struct gsm_network **paging_request; |
| 37 | |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 38 | union { |
| 39 | struct { |
| 40 | |
| 41 | /* current call state */ |
| 42 | int state; |
| 43 | |
| 44 | /* current timer and message queue */ |
| 45 | int Tcurrent; /* current CC timer */ |
| 46 | int T308_second; /* used to send release again */ |
Pablo Neira Ayuso | 840ccf6 | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 47 | struct osmo_timer_list timer; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 48 | struct gsm_mncc msg; /* stores setup/disconnect/release message */ |
| 49 | } cc; |
| 50 | struct { |
Andreas Eversberg | 12c52b7 | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 51 | struct gsm411_smc_inst smc_inst; |
Andreas Eversberg | 3bd2ebc | 2011-10-28 11:11:13 +0200 | [diff] [blame] | 52 | struct gsm411_smr_inst smr_inst; |
Andreas Eversberg | 12c52b7 | 2011-10-28 04:07:07 +0200 | [diff] [blame] | 53 | |
Harald Welte | 68b7df2 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 54 | struct gsm_sms *sms; |
Harald Welte | 15797eb | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 55 | } sms; |
| 56 | }; |
| 57 | }; |
| 58 | |
| 59 | |
Harald Welte | d8c8e6f | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 60 | |
Harald Welte | 0d82416 | 2009-07-23 21:58:40 +0200 | [diff] [blame] | 61 | struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 62 | uint8_t proto, uint8_t trans_id); |
Harald Welte | d8c8e6f | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 63 | struct gsm_trans *trans_find_by_callref(struct gsm_network *net, |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 64 | uint32_t callref); |
Harald Welte | d8c8e6f | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 65 | |
| 66 | struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 67 | uint8_t protocol, uint8_t trans_id, |
| 68 | uint32_t callref); |
Harald Welte | d8c8e6f | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 69 | void trans_free(struct gsm_trans *trans); |
| 70 | |
Harald Welte | 165fc33 | 2009-07-23 21:36:44 +0200 | [diff] [blame] | 71 | int trans_assign_trans_id(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 72 | uint8_t protocol, uint8_t ti_flag); |
Holger Hans Peter Freyther | f8faba7 | 2012-11-23 21:33:15 +0100 | [diff] [blame] | 73 | int trans_has_conn(const struct gsm_subscriber_connection *conn); |
Harald Welte | 2c99807 | 2009-12-17 17:13:28 +0100 | [diff] [blame] | 74 | |
Harald Welte | d8c8e6f | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 75 | #endif |