blob: ad6fe35bed444a750df2a86216b25f3529b09bcb [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 Weltef3efc592009-07-27 20:11:35 +020042 int is_mt; /* is this a MO (0) or MT (1) transfer */
Harald Welte0803b982009-07-26 14:24:11 +020043 enum gsm411_cp_state cp_state;
44 enum gsm411_rp_state rp_state;
45
46 struct timer_list timer;
47 } sms;
48 };
49};
50
51
Harald Welte9ee48252009-07-23 21:25:08 +020052
Harald Welteb8b40732009-07-23 21:58:40 +020053struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
54 u_int8_t proto, u_int8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020055struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
56 u_int32_t callref);
57
58struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
59 u_int8_t protocol, u_int8_t trans_id,
60 u_int32_t callref);
61void trans_free(struct gsm_trans *trans);
62
Harald Welte78283ef2009-07-23 21:36:44 +020063int trans_assign_trans_id(struct gsm_subscriber *subscr,
64 u_int8_t protocol, u_int8_t ti_flag);
Harald Welte9ee48252009-07-23 21:25:08 +020065#endif