blob: e41d8ef91a262d3ac70cf6c3d7e97fa22751d199 [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 Weltedfe6c7d2010-02-20 16:24:02 +01006#include <osmocore/linuxlist.h>
Harald Welte0803b982009-07-26 14:24:11 +02007#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
Holger Hans Peter Freythere95d4822010-03-23 07:00:22 +010023 /* The associated connection we are using to transmit messages */
24 struct gsm_subscriber_connection *conn;
Harald Welte0803b982009-07-26 14:24:11 +020025
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
Holger Hans Peter Freyther49b3ed22010-12-29 17:09:07 +010032 /* is thats one paging? */
33 struct gsm_network **paging_request;
34
Harald Welte0803b982009-07-26 14:24:11 +020035 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 */
44 struct timer_list timer;
45 struct gsm_mncc msg; /* stores setup/disconnect/release message */
46 } cc;
47 struct {
Harald Welte (local)daef6062009-08-14 11:41:12 +020048 u_int8_t link_id; /* RSL Link ID to be used for this trans */
Harald Weltef3efc592009-07-27 20:11:35 +020049 int is_mt; /* is this a MO (0) or MT (1) transfer */
Harald Welte0803b982009-07-26 14:24:11 +020050 enum gsm411_cp_state cp_state;
Harald Welte41985612009-08-10 00:24:32 +020051 struct timer_list cp_timer;
52
Harald Welte0803b982009-07-26 14:24:11 +020053 enum gsm411_rp_state rp_state;
54
Harald Welte76042182009-08-08 16:03:15 +020055 struct gsm_sms *sms;
Harald Welte0803b982009-07-26 14:24:11 +020056 } sms;
57 };
58};
59
60
Harald Welte9ee48252009-07-23 21:25:08 +020061
Harald Welteb8b40732009-07-23 21:58:40 +020062struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
63 u_int8_t proto, u_int8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020064struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
65 u_int32_t callref);
66
67struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
68 u_int8_t protocol, u_int8_t trans_id,
69 u_int32_t callref);
70void trans_free(struct gsm_trans *trans);
71
Harald Welte78283ef2009-07-23 21:36:44 +020072int trans_assign_trans_id(struct gsm_subscriber *subscr,
73 u_int8_t protocol, u_int8_t ti_flag);
Harald Weltecc9beb52009-12-17 17:13:28 +010074
Harald Welte9ee48252009-07-23 21:25:08 +020075#endif