blob: 2be71c39f48c9f010a2b5ad5c42c242e491cbad1 [file] [log] [blame]
Harald Welteb68899d2009-01-06 21:47:18 +00001/* 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 Welte9af6ddf2011-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 Welteb68899d2009-01-06 21:47:18 +00008 * (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 Welte9af6ddf2011-01-01 15:25:50 +010013 * GNU Affero General Public License for more details.
Harald Welteb68899d2009-01-06 21:47:18 +000014 *
Harald Welte9af6ddf2011-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 Welteb68899d2009-01-06 21:47:18 +000017 *
18 */
19
20#ifndef PAGING_H
21#define PAGING_H
22
Harald Welte12247c62009-05-21 07:23:02 +000023#include <stdlib.h>
Harald Welteb68899d2009-01-06 21:47:18 +000024#include <string.h>
25
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010026#include <osmocom/core/linuxlist.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010027#include <osmocom/core/timer.h>
Harald Welteb68899d2009-01-06 21:47:18 +000028
Neels Hofmeyrc0164792017-09-04 15:15:32 +020029#include <osmocom/bsc/gsm_data.h>
30#include <osmocom/bsc/bsc_subscriber.h>
Neels Hofmeyra5c71bf2017-01-25 16:15:43 +010031
Harald Weltef4b66fb2017-12-11 15:21:48 +010032struct bsc_msc_data;
33
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010034/**
35 * A pending paging request
36 */
37struct gsm_paging_request {
38 /* list_head for list of all paging requests */
39 struct llist_head entry;
40 /* the subscriber which we're paging. Later gsm_paging_request
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010041 * should probably become a part of the bsc_subsrc struct? */
42 struct bsc_subscr *bsub;
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010043 /* back-pointer to the BTS on which we are paging */
44 struct gsm_bts *bts;
45 /* what kind of channel type do we ask the MS to establish */
46 int chan_type;
47
48 /* Timer 3113: how long do we try to page? */
Pablo Neira Ayusobf540cb2011-05-06 12:11:06 +020049 struct osmo_timer_list T3113;
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010050
Holger Hans Peter Freytherd3baf412010-12-23 18:19:17 +010051 /* How often did we ask the BTS to page? */
52 int attempts;
53
Harald Weltef4b66fb2017-12-11 15:21:48 +010054 /* MSC that has issued this paging */
55 struct bsc_msc_data *msc;
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010056};
57
Harald Welteb68899d2009-01-06 21:47:18 +000058/* schedule paging request */
Harald Weltef4b66fb2017-12-11 15:21:48 +010059int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, int type,
60 struct bsc_msc_data *msc);
Harald Welteb68899d2009-01-06 21:47:18 +000061
Harald Welte763da002009-02-06 12:52:14 +000062/* stop paging requests */
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010063void paging_request_stop(struct llist_head *bts_list,
64 struct gsm_bts *_bts, struct bsc_subscr *bsub,
Sylvain Munautc7ff2572010-12-01 21:41:35 +010065 struct gsm_subscriber_connection *conn,
66 struct msgb *msg);
Harald Welte763da002009-02-06 12:52:14 +000067
Holger Freyther392209c2009-02-10 00:06:19 +000068/* update paging load */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020069void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
Holger Freyther392209c2009-02-10 00:06:19 +000070
Holger Hans Peter Freyther66e14cd2011-04-26 15:52:34 +020071/* pending paging requests */
72unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
73
Harald Weltef4b66fb2017-12-11 15:21:48 +010074struct bsc_msc_data *paging_get_msc(struct gsm_bts *bts, struct bsc_subscr *bsub);
Holger Hans Peter Freyther31f5f712011-06-07 19:53:29 +020075
Harald Welted382bf62017-12-11 15:33:35 +010076void paging_flush_bts(struct gsm_bts *bts, struct bsc_msc_data *msc);
77void paging_flush_network(struct gsm_network *net, struct bsc_msc_data *msc);
78
Harald Welteb68899d2009-01-06 21:47:18 +000079#endif