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> |
| 8 | |
| 9 | /* One transaction */ |
| 10 | struct gsm_trans { |
| 11 | /* Entry in list of all transactions */ |
| 12 | struct llist_head entry; |
| 13 | |
| 14 | /* The protocol within which we live */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 15 | uint8_t protocol; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 16 | |
| 17 | /* The current transaction ID */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 18 | uint8_t transaction_id; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 19 | |
| 20 | /* To whom we belong, unique identifier of remote MM entity */ |
| 21 | struct gsm_subscriber *subscr; |
| 22 | |
Holger Hans Peter Freyther | e95d482 | 2010-03-23 07:00:22 +0100 | [diff] [blame] | 23 | /* The associated connection we are using to transmit messages */ |
| 24 | struct gsm_subscriber_connection *conn; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 25 | |
| 26 | /* reference from MNCC or other application */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 27 | uint32_t callref; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 28 | |
Harald Welte | da7ab74 | 2009-12-19 22:23:05 +0100 | [diff] [blame] | 29 | /* if traffic channel receive was requested */ |
| 30 | int tch_recv; |
| 31 | |
Holger Hans Peter Freyther | 49b3ed2 | 2010-12-29 17:09:07 +0100 | [diff] [blame] | 32 | /* is thats one paging? */ |
| 33 | struct gsm_network **paging_request; |
| 34 | |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 35 | union { |
| 36 | struct { |
| 37 | |
| 38 | /* current call state */ |
| 39 | int state; |
| 40 | |
| 41 | /* current timer and message queue */ |
| 42 | int Tcurrent; /* current CC timer */ |
| 43 | int T308_second; /* used to send release again */ |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame^] | 44 | struct osmo_timer_list timer; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 45 | struct gsm_mncc msg; /* stores setup/disconnect/release message */ |
| 46 | } cc; |
| 47 | struct { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 48 | uint8_t link_id; /* RSL Link ID to be used for this trans */ |
Harald Welte | f3efc59 | 2009-07-27 20:11:35 +0200 | [diff] [blame] | 49 | int is_mt; /* is this a MO (0) or MT (1) transfer */ |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 50 | enum gsm411_cp_state cp_state; |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame^] | 51 | struct osmo_timer_list cp_timer; |
Harald Welte | 4198561 | 2009-08-10 00:24:32 +0200 | [diff] [blame] | 52 | |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 53 | enum gsm411_rp_state rp_state; |
| 54 | |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 55 | struct gsm_sms *sms; |
Harald Welte | 0803b98 | 2009-07-26 14:24:11 +0200 | [diff] [blame] | 56 | } sms; |
| 57 | }; |
| 58 | }; |
| 59 | |
| 60 | |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 61 | |
Harald Welte | b8b4073 | 2009-07-23 21:58:40 +0200 | [diff] [blame] | 62 | struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 63 | uint8_t proto, uint8_t trans_id); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 64 | 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] | 65 | uint32_t callref); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 66 | |
| 67 | struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 68 | uint8_t protocol, uint8_t trans_id, |
| 69 | uint32_t callref); |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 70 | void trans_free(struct gsm_trans *trans); |
| 71 | |
Harald Welte | 78283ef | 2009-07-23 21:36:44 +0200 | [diff] [blame] | 72 | int trans_assign_trans_id(struct gsm_subscriber *subscr, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 73 | uint8_t protocol, uint8_t ti_flag); |
Harald Welte | cc9beb5 | 2009-12-17 17:13:28 +0100 | [diff] [blame] | 74 | |
Harald Welte | 9ee4825 | 2009-07-23 21:25:08 +0200 | [diff] [blame] | 75 | #endif |