blob: 6ef1612a966085e1e88c33d23aeb5fadbc964f4d [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>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +01006#include <osmocom/core/linuxlist.h>
Harald Welte0803b982009-07-26 14:24:11 +02007#include <openbsc/gsm_04_11.h>
Harald Weltef142c972011-05-24 13:25:38 +02008#include <openbsc/mncc.h>
Andreas Eversbergf7396ea2011-10-28 04:07:07 +02009#include <osmocom/gsm/gsm0411_smc.h>
Andreas Eversbergbc6c43f2011-10-28 11:11:13 +020010#include <osmocom/gsm/gsm0411_smr.h>
Harald Welte0803b982009-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
Jacob Erlbeckf07c6052014-12-02 11:58:00 +010017 /* Back pointer to the netweork struct */
18 struct gsm_network *net;
19
Harald Welte0803b982009-07-26 14:24:11 +020020 /* The protocol within which we live */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020021 uint8_t protocol;
Harald Welte0803b982009-07-26 14:24:11 +020022
23 /* The current transaction ID */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020024 uint8_t transaction_id;
Harald Welte0803b982009-07-26 14:24:11 +020025
26 /* To whom we belong, unique identifier of remote MM entity */
27 struct gsm_subscriber *subscr;
28
Holger Hans Peter Freythere95d4822010-03-23 07:00:22 +010029 /* The associated connection we are using to transmit messages */
30 struct gsm_subscriber_connection *conn;
Harald Welte0803b982009-07-26 14:24:11 +020031
32 /* reference from MNCC or other application */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020033 uint32_t callref;
Harald Welte0803b982009-07-26 14:24:11 +020034
Harald Welteda7ab742009-12-19 22:23:05 +010035 /* if traffic channel receive was requested */
36 int tch_recv;
37
Holger Hans Peter Freyther49b3ed22010-12-29 17:09:07 +010038 /* is thats one paging? */
Holger Hans Peter Freytherd6d7aff2015-04-06 12:03:45 +020039 struct subscr_request *paging_request;
Holger Hans Peter Freyther49b3ed22010-12-29 17:09:07 +010040
Harald Welte0803b982009-07-26 14:24:11 +020041 union {
42 struct {
43
44 /* current call state */
45 int state;
46
47 /* current timer and message queue */
48 int Tcurrent; /* current CC timer */
49 int T308_second; /* used to send release again */
Pablo Neira Ayusobf540cb2011-05-06 12:11:06 +020050 struct osmo_timer_list timer;
Harald Welte0803b982009-07-26 14:24:11 +020051 struct gsm_mncc msg; /* stores setup/disconnect/release message */
52 } cc;
53 struct {
Andreas Eversbergf7396ea2011-10-28 04:07:07 +020054 struct gsm411_smc_inst smc_inst;
Andreas Eversbergbc6c43f2011-10-28 11:11:13 +020055 struct gsm411_smr_inst smr_inst;
Andreas Eversbergf7396ea2011-10-28 04:07:07 +020056
Harald Welte76042182009-08-08 16:03:15 +020057 struct gsm_sms *sms;
Harald Welte0803b982009-07-26 14:24:11 +020058 } sms;
59 };
60};
61
62
Harald Welte9ee48252009-07-23 21:25:08 +020063
Jacob Erlbeckdae1f642014-12-02 14:22:53 +010064struct gsm_trans *trans_find_by_id(struct gsm_subscriber_connection *conn,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020065 uint8_t proto, uint8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020066struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020067 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020068
Jacob Erlbeckaf792d62014-12-02 14:22:53 +010069struct gsm_trans *trans_alloc(struct gsm_network *net,
70 struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020071 uint8_t protocol, uint8_t trans_id,
72 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020073void trans_free(struct gsm_trans *trans);
74
Jacob Erlbeckdae1f642014-12-02 14:22:53 +010075int trans_assign_trans_id(struct gsm_network *net, struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020076 uint8_t protocol, uint8_t ti_flag);
Holger Hans Peter Freyther70ae5d32012-11-23 21:33:15 +010077int trans_has_conn(const struct gsm_subscriber_connection *conn);
Harald Weltecc9beb52009-12-17 17:13:28 +010078
Harald Welte9ee48252009-07-23 21:25:08 +020079#endif