blob: b6c859c71aba2301bae7526a495672558ca20125 [file] [log] [blame]
Harald Welted8c8e6f2009-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>
Pablo Neira Ayusodd5fff42011-03-22 16:47:59 +01006#include <osmocom/core/linuxlist.h>
Harald Welte15797eb2009-07-26 14:24:11 +02007#include <openbsc/gsm_04_11.h>
Harald Welte28dce912011-05-24 13:25:38 +02008#include <openbsc/mncc.h>
Andreas Eversberg12c52b72011-10-28 04:07:07 +02009#include <osmocom/gsm/gsm0411_smc.h>
Andreas Eversberg3bd2ebc2011-10-28 11:11:13 +020010#include <osmocom/gsm/gsm0411_smr.h>
Harald Welte15797eb2009-07-26 14:24:11 +020011
12/* One transaction */
13struct gsm_trans {
14 /* Entry in list of all transactions */
15 struct llist_head entry;
16
17 /* The protocol within which we live */
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020018 uint8_t protocol;
Harald Welte15797eb2009-07-26 14:24:11 +020019
20 /* The current transaction ID */
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020021 uint8_t transaction_id;
Harald Welte15797eb2009-07-26 14:24:11 +020022
23 /* To whom we belong, unique identifier of remote MM entity */
24 struct gsm_subscriber *subscr;
25
Holger Hans Peter Freyther4009da42010-03-23 07:00:22 +010026 /* The associated connection we are using to transmit messages */
27 struct gsm_subscriber_connection *conn;
Harald Welte15797eb2009-07-26 14:24:11 +020028
29 /* reference from MNCC or other application */
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020030 uint32_t callref;
Harald Welte15797eb2009-07-26 14:24:11 +020031
Harald Welte3971ad52009-12-19 22:23:05 +010032 /* if traffic channel receive was requested */
33 int tch_recv;
34
Holger Hans Peter Freyther02539b12010-12-29 17:09:07 +010035 /* is thats one paging? */
36 struct gsm_network **paging_request;
37
Harald Welte15797eb2009-07-26 14:24:11 +020038 union {
39 struct {
40
41 /* current call state */
42 int state;
43
44 /* current timer and message queue */
45 int Tcurrent; /* current CC timer */
46 int T308_second; /* used to send release again */
Pablo Neira Ayuso840ccf62011-05-06 12:11:06 +020047 struct osmo_timer_list timer;
Harald Welte15797eb2009-07-26 14:24:11 +020048 struct gsm_mncc msg; /* stores setup/disconnect/release message */
49 } cc;
50 struct {
Andreas Eversberg12c52b72011-10-28 04:07:07 +020051 struct gsm411_smc_inst smc_inst;
Andreas Eversberg3bd2ebc2011-10-28 11:11:13 +020052 struct gsm411_smr_inst smr_inst;
Andreas Eversberg12c52b72011-10-28 04:07:07 +020053
Harald Welte68b7df22009-08-08 16:03:15 +020054 struct gsm_sms *sms;
Harald Welte15797eb2009-07-26 14:24:11 +020055 } sms;
56 };
57};
58
59
Harald Welted8c8e6f2009-07-23 21:25:08 +020060
Harald Welte0d824162009-07-23 21:58:40 +020061struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020062 uint8_t proto, uint8_t trans_id);
Harald Welted8c8e6f2009-07-23 21:25:08 +020063struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020064 uint32_t callref);
Harald Welted8c8e6f2009-07-23 21:25:08 +020065
66struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020067 uint8_t protocol, uint8_t trans_id,
68 uint32_t callref);
Harald Welted8c8e6f2009-07-23 21:25:08 +020069void trans_free(struct gsm_trans *trans);
70
Harald Welte165fc332009-07-23 21:36:44 +020071int trans_assign_trans_id(struct gsm_subscriber *subscr,
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020072 uint8_t protocol, uint8_t ti_flag);
Holger Hans Peter Freytherf8faba72012-11-23 21:33:15 +010073int trans_has_conn(const struct gsm_subscriber_connection *conn);
Harald Welte2c998072009-12-17 17:13:28 +010074
Harald Welted8c8e6f2009-07-23 21:25:08 +020075#endif