blob: e1438ba4c7985c3228bf2310a6530a5274d955e1 [file] [log] [blame]
Harald Welte59b04682009-06-10 05:40:52 +08001/* Paging helper and manager.... */
2/* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
Harald Welte0e3e88e2011-01-01 15:25:50 +01006 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
Harald Welte59b04682009-06-10 05:40:52 +08008 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte0e3e88e2011-01-01 15:25:50 +010013 * GNU Affero General Public License for more details.
Harald Welte59b04682009-06-10 05:40:52 +080014 *
Harald Welte0e3e88e2011-01-01 15:25:50 +010015 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte59b04682009-06-10 05:40:52 +080017 *
18 */
19
20#ifndef PAGING_H
21#define PAGING_H
22
23#include <stdlib.h>
24#include <string.h>
25
Pablo Neira Ayusodd5fff42011-03-22 16:47:59 +010026#include <osmocom/core/linuxlist.h>
Harald Welte59b04682009-06-10 05:40:52 +080027#include "gsm_data.h"
28#include "gsm_subscriber.h"
Pablo Neira Ayusodd5fff42011-03-22 16:47:59 +010029#include <osmocom/core/timer.h>
Harald Welte59b04682009-06-10 05:40:52 +080030
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010031/**
32 * A pending paging request
33 */
34struct gsm_paging_request {
35 /* list_head for list of all paging requests */
36 struct llist_head entry;
37 /* the subscriber which we're paging. Later gsm_paging_request
38 * should probably become a part of the gsm_subscriber struct? */
39 struct gsm_subscriber *subscr;
40 /* back-pointer to the BTS on which we are paging */
41 struct gsm_bts *bts;
42 /* what kind of channel type do we ask the MS to establish */
43 int chan_type;
44
45 /* Timer 3113: how long do we try to page? */
Pablo Neira Ayuso840ccf62011-05-06 12:11:06 +020046 struct osmo_timer_list T3113;
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010047
Holger Hans Peter Freytherab2a9332010-12-23 18:19:17 +010048 /* How often did we ask the BTS to page? */
49 int attempts;
50
Holger Hans Peter Freyther25176f12010-11-09 17:00:42 +010051 /* callback to be called in case paging completes */
52 gsm_cbfn *cbfn;
53 void *cbfn_param;
54};
55
Harald Welte59b04682009-06-10 05:40:52 +080056/* schedule paging request */
Harald Welted363c952009-08-15 03:16:17 +020057int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
58 int type, gsm_cbfn *cbfn, void *data);
Harald Welte59b04682009-06-10 05:40:52 +080059
60/* stop paging requests */
61void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
Sylvain Munautb7b6e782010-12-01 21:41:35 +010062 struct gsm_subscriber_connection *conn,
63 struct msgb *msg);
Harald Welte59b04682009-06-10 05:40:52 +080064
65/* update paging load */
Holger Hans Peter Freyther7eb8a9a2011-04-18 17:04:00 +020066void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
Harald Welte59b04682009-06-10 05:40:52 +080067
Holger Hans Peter Freyther914ff192011-04-26 15:52:34 +020068/* pending paging requests */
69unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
70
Holger Hans Peter Freytherad39db62011-06-07 19:53:29 +020071void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr);
72
Harald Welte59b04682009-06-10 05:40:52 +080073#endif