Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 1 | #ifndef _TRANSACT_H |
| 2 | #define _TRANSACT_H |
| 3 | |
| 4 | #include <openbsc/gsm_data.h> |
| 5 | #include <openbsc/gsm_subscriber.h> |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 6 | #include <osmocom/core/linuxlist.h> |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 7 | #include <openbsc/gsm_04_11.h> |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 8 | #include <openbsc/mncc.h> |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 9 | |
| 10 | /* One transaction */ |
| 11 | struct gsm_trans { |
| 12 | /* Entry in list of all transactions */ |
| 13 | struct llist_head entry; |
| 14 | |
| 15 | /* The protocol within which we live */ |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 16 | uint8_t protocol; |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 17 | |
| 18 | /* The current transaction ID */ |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 19 | uint8_t transaction_id; |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 20 | |
| 21 | /* To whom we belong, unique identifier of remote MM entity */ |
| 22 | struct gsm_subscriber *subscr; |
| 23 | |
| 24 | /* The associated connection we are using to transmit messages */ |
| 25 | struct gsm_subscriber_connection *conn; |
| 26 | |
| 27 | /* reference from MNCC or other application */ |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 28 | uint32_t callref; |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 29 | |
| 30 | /* if traffic channel receive was requested */ |
| 31 | int tch_recv; |
| 32 | |
| 33 | /* is thats one paging? */ |
| 34 | struct gsm_network **paging_request; |
| 35 | |
| 36 | union { |
| 37 | struct { |
| 38 | |
| 39 | /* current call state */ |
| 40 | int state; |
| 41 | |
| 42 | /* current timer and message queue */ |
| 43 | int Tcurrent; /* current CC timer */ |
| 44 | int T308_second; /* used to send release again */ |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 45 | struct osmo_timer_list timer; |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 46 | struct gsm_mncc msg; /* stores setup/disconnect/release message */ |
| 47 | } cc; |
| 48 | struct { |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 49 | uint8_t link_id; /* RSL Link ID to be used for this trans */ |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 50 | int is_mt; /* is this a MO (0) or MT (1) transfer */ |
| 51 | enum gsm411_cp_state cp_state; |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 52 | struct osmo_timer_list cp_timer; |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 53 | |
| 54 | enum gsm411_rp_state rp_state; |
| 55 | |
| 56 | struct gsm_sms *sms; |
| 57 | } sms; |
| 58 | }; |
| 59 | }; |
| 60 | |
| 61 | |
| 62 | |
| 63 | struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr, |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 64 | uint8_t proto, uint8_t trans_id); |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 65 | struct gsm_trans *trans_find_by_callref(struct gsm_network *net, |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 66 | uint32_t callref); |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 67 | |
| 68 | struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 69 | uint8_t protocol, uint8_t trans_id, |
| 70 | uint32_t callref); |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 71 | void trans_free(struct gsm_trans *trans); |
| 72 | |
| 73 | int trans_assign_trans_id(struct gsm_subscriber *subscr, |
Jonathan Santos | 5a45b15 | 2011-08-17 15:33:57 -0400 | [diff] [blame^] | 74 | uint8_t protocol, uint8_t ti_flag); |
Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 75 | |
| 76 | #endif |