blob: cf94100820d9620bdbe0040d9942ec22e0764481 [file] [log] [blame]
Harald Welte9ee48252009-07-23 21:25:08 +02001#ifndef _TRANSACT_H
2#define _TRANSACT_H
3
4#include <openbsc/gsm_data.h>
5#include <openbsc/gsm_subscriber.h>
Harald Welte0803b982009-07-26 14:24:11 +02006#include <openbsc/linuxlist.h>
7#include <openbsc/gsm_04_11.h>
8
9/* One transaction */
10struct gsm_trans {
11 /* Entry in list of all transactions */
12 struct llist_head entry;
13
14 /* The protocol within which we live */
15 u_int8_t protocol;
16
17 /* The current transaction ID */
18 u_int8_t transaction_id;
19
20 /* To whom we belong, unique identifier of remote MM entity */
21 struct gsm_subscriber *subscr;
22
23 /* The LCHAN that we're currently using to transmit messages */
24 struct gsm_lchan *lchan;
25
26 /* reference from MNCC or other application */
27 u_int32_t callref;
28
Harald Welteda7ab742009-12-19 22:23:05 +010029 /* if traffic channel receive was requested */
30 int tch_recv;
31
Harald Welte0803b982009-07-26 14:24:11 +020032 union {
33 struct {
34
35 /* current call state */
36 int state;
37
38 /* current timer and message queue */
39 int Tcurrent; /* current CC timer */
40 int T308_second; /* used to send release again */
41 struct timer_list timer;
42 struct gsm_mncc msg; /* stores setup/disconnect/release message */
43 } cc;
44 struct {
Harald Welte (local)daef6062009-08-14 11:41:12 +020045 u_int8_t link_id; /* RSL Link ID to be used for this trans */
Harald Weltef3efc592009-07-27 20:11:35 +020046 int is_mt; /* is this a MO (0) or MT (1) transfer */
Harald Welte0803b982009-07-26 14:24:11 +020047 enum gsm411_cp_state cp_state;
Harald Welte41985612009-08-10 00:24:32 +020048 struct timer_list cp_timer;
49
Harald Welte0803b982009-07-26 14:24:11 +020050 enum gsm411_rp_state rp_state;
51
Harald Welte76042182009-08-08 16:03:15 +020052 struct gsm_sms *sms;
Harald Welte0803b982009-07-26 14:24:11 +020053 } sms;
54 };
55};
56
57
Harald Welte9ee48252009-07-23 21:25:08 +020058
Harald Welteb8b40732009-07-23 21:58:40 +020059struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
60 u_int8_t proto, u_int8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020061struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
62 u_int32_t callref);
63
64struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
65 u_int8_t protocol, u_int8_t trans_id,
66 u_int32_t callref);
67void trans_free(struct gsm_trans *trans);
68
Harald Welte78283ef2009-07-23 21:36:44 +020069int trans_assign_trans_id(struct gsm_subscriber *subscr,
70 u_int8_t protocol, u_int8_t ti_flag);
Harald Weltecc9beb52009-12-17 17:13:28 +010071
72/* update all transactions to use a different LCHAN, e.g.
73 * after handover has succeeded */
74int trans_lchan_change(struct gsm_lchan *lchan_old,
75 struct gsm_lchan *lchan_new);
Harald Welte9ee48252009-07-23 21:25:08 +020076#endif