blob: 5f11ef236491901771b0a740ba152ab6317ba2e6 [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>
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 */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020015 uint8_t protocol;
Harald Welte0803b982009-07-26 14:24:11 +020016
17 /* The current transaction ID */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020018 uint8_t transaction_id;
Harald Welte0803b982009-07-26 14:24:11 +020019
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 */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020027 uint32_t callref;
Harald Welte0803b982009-07-26 14:24:11 +020028
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 {
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020048 uint8_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,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020063 uint8_t proto, uint8_t trans_id);
Harald Welte9ee48252009-07-23 21:25:08 +020064struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020065 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020066
67struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020068 uint8_t protocol, uint8_t trans_id,
69 uint32_t callref);
Harald Welte9ee48252009-07-23 21:25:08 +020070void trans_free(struct gsm_trans *trans);
71
Harald Welte78283ef2009-07-23 21:36:44 +020072int trans_assign_trans_id(struct gsm_subscriber *subscr,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020073 uint8_t protocol, uint8_t ti_flag);
Harald Weltecc9beb52009-12-17 17:13:28 +010074
Harald Welte9ee48252009-07-23 21:25:08 +020075#endif