blob: db6a704b1186b56022ca9563e29fb8d9fb87c258 [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>
Harald Welte0803b982009-07-26 14:24:11 +020010
11/* One transaction */
12struct gsm_trans {
13 /* Entry in list of all transactions */
14 struct llist_head entry;
15
16 /* The protocol within which we live */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020017 uint8_t protocol;
Harald Welte0803b982009-07-26 14:24:11 +020018
19 /* The current transaction ID */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020020 uint8_t transaction_id;
Harald Welte0803b982009-07-26 14:24:11 +020021
22 /* To whom we belong, unique identifier of remote MM entity */
23 struct gsm_subscriber *subscr;
24
Holger Hans Peter Freythere95d4822010-03-23 07:00:22 +010025 /* The associated connection we are using to transmit messages */
26 struct gsm_subscriber_connection *conn;
Harald Welte0803b982009-07-26 14:24:11 +020027
28 /* reference from MNCC or other application */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020029 uint32_t callref;
Harald Welte0803b982009-07-26 14:24:11 +020030
Harald Welteda7ab742009-12-19 22:23:05 +010031 /* if traffic channel receive was requested */
32 int tch_recv;
33
Holger Hans Peter Freyther49b3ed22010-12-29 17:09:07 +010034 /* is thats one paging? */
35 struct gsm_network **paging_request;
36
Harald Welte0803b982009-07-26 14:24:11 +020037 union {
38 struct {
39
40 /* current call state */
41 int state;
42
43 /* current timer and message queue */
44 int Tcurrent; /* current CC timer */
45 int T308_second; /* used to send release again */
Pablo Neira Ayusobf540cb2011-05-06 12:11:06 +020046 struct osmo_timer_list timer;
Harald Welte0803b982009-07-26 14:24:11 +020047 struct gsm_mncc msg; /* stores setup/disconnect/release message */
48 } cc;
49 struct {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020050 uint8_t link_id; /* RSL Link ID to be used for this trans */
Harald Weltef3efc592009-07-27 20:11:35 +020051 int is_mt; /* is this a MO (0) or MT (1) transfer */
Harald Welte0803b982009-07-26 14:24:11 +020052 enum gsm411_rp_state rp_state;
53
Andreas Eversbergf7396ea2011-10-28 04:07:07 +020054 struct gsm411_smc_inst smc_inst;
55
Harald Welte76042182009-08-08 16:03:15 +020056 struct gsm_sms *sms;
Harald Welte0803b982009-07-26 14:24:11 +020057 } sms;
58 };
59};
60
61
Harald Welte9ee48252009-07-23 21:25:08 +020062
Harald Welteb8b40732009-07-23 21:58:40 +020063struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020064 uint8_t proto, uint8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020065struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020066 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020067
68struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020069 uint8_t protocol, uint8_t trans_id,
70 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020071void trans_free(struct gsm_trans *trans);
72
Harald Welte78283ef2009-07-23 21:36:44 +020073int trans_assign_trans_id(struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020074 uint8_t protocol, uint8_t ti_flag);
Holger Hans Peter Freyther70ae5d32012-11-23 21:33:15 +010075int trans_has_conn(const struct gsm_subscriber_connection *conn);
Harald Weltecc9beb52009-12-17 17:13:28 +010076
Harald Welte9ee48252009-07-23 21:25:08 +020077#endif