blob: 6314f987f72c71bc38a2e101921ccc857c38bee5 [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
29 union {
30 struct {
31
32 /* current call state */
33 int state;
34
35 /* current timer and message queue */
36 int Tcurrent; /* current CC timer */
37 int T308_second; /* used to send release again */
38 struct timer_list timer;
39 struct gsm_mncc msg; /* stores setup/disconnect/release message */
40 } cc;
41 struct {
Harald Welte (local)daef6062009-08-14 11:41:12 +020042 u_int8_t link_id; /* RSL Link ID to be used for this trans */
Harald Weltef3efc592009-07-27 20:11:35 +020043 int is_mt; /* is this a MO (0) or MT (1) transfer */
Harald Welte0803b982009-07-26 14:24:11 +020044 enum gsm411_cp_state cp_state;
Harald Welte41985612009-08-10 00:24:32 +020045 struct timer_list cp_timer;
46
Harald Welte0803b982009-07-26 14:24:11 +020047 enum gsm411_rp_state rp_state;
48
Harald Welte76042182009-08-08 16:03:15 +020049 struct gsm_sms *sms;
Harald Welte0803b982009-07-26 14:24:11 +020050 } sms;
51 };
52};
53
54
Harald Welte9ee48252009-07-23 21:25:08 +020055
Harald Welteb8b40732009-07-23 21:58:40 +020056struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
57 u_int8_t proto, u_int8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020058struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
59 u_int32_t callref);
60
61struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
62 u_int8_t protocol, u_int8_t trans_id,
63 u_int32_t callref);
64void trans_free(struct gsm_trans *trans);
65
Harald Welte78283ef2009-07-23 21:36:44 +020066int trans_assign_trans_id(struct gsm_subscriber *subscr,
67 u_int8_t protocol, u_int8_t ti_flag);
Harald Weltecc9beb52009-12-17 17:13:28 +010068
69/* update all transactions to use a different LCHAN, e.g.
70 * after handover has succeeded */
71int trans_lchan_change(struct gsm_lchan *lchan_old,
72 struct gsm_lchan *lchan_new);
Harald Welte9ee48252009-07-23 21:25:08 +020073#endif