blob: 7dd8500ac91c9d3232a031925097384480a80068 [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 Hofmeyra5c71bf2017-01-25 16:15:43 +010029#include <openbsc/gsm_data.h>
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010030#include <openbsc/bsc_subscriber.h>
Neels Hofmeyra5c71bf2017-01-25 16:15:43 +010031
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010032/**
33 * A pending paging request
34 */
35struct gsm_paging_request {
36 /* list_head for list of all paging requests */
37 struct llist_head entry;
38 /* the subscriber which we're paging. Later gsm_paging_request
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010039 * should probably become a part of the bsc_subsrc struct? */
40 struct bsc_subscr *bsub;
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010041 /* back-pointer to the BTS on which we are paging */
42 struct gsm_bts *bts;
43 /* what kind of channel type do we ask the MS to establish */
44 int chan_type;
45
46 /* Timer 3113: how long do we try to page? */
Pablo Neira Ayusobf540cb2011-05-06 12:11:06 +020047 struct osmo_timer_list T3113;
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010048
Holger Hans Peter Freytherd3baf412010-12-23 18:19:17 +010049 /* How often did we ask the BTS to page? */
50 int attempts;
51
Holger Hans Peter Freyther85334f12010-11-09 17:00:42 +010052 /* callback to be called in case paging completes */
53 gsm_cbfn *cbfn;
54 void *cbfn_param;
55};
56
Harald Welteb68899d2009-01-06 21:47:18 +000057/* schedule paging request */
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010058int paging_request(struct gsm_network *network, struct bsc_subscr *bsub,
Harald Weltee903edf2009-08-15 03:16:17 +020059 int type, gsm_cbfn *cbfn, void *data);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010060int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub,
61 int type, gsm_cbfn *cbfn, void *data);
Harald Welteb68899d2009-01-06 21:47:18 +000062
Harald Welte763da002009-02-06 12:52:14 +000063/* stop paging requests */
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010064void paging_request_stop(struct llist_head *bts_list,
65 struct gsm_bts *_bts, struct bsc_subscr *bsub,
Sylvain Munautc7ff2572010-12-01 21:41:35 +010066 struct gsm_subscriber_connection *conn,
67 struct msgb *msg);
Harald Welte763da002009-02-06 12:52:14 +000068
Holger Freyther392209c2009-02-10 00:06:19 +000069/* update paging load */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020070void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
Holger Freyther392209c2009-02-10 00:06:19 +000071
Holger Hans Peter Freyther66e14cd2011-04-26 15:52:34 +020072/* pending paging requests */
73unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
74
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010075void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub);
Holger Hans Peter Freyther31f5f712011-06-07 19:53:29 +020076
Harald Welteb68899d2009-01-06 21:47:18 +000077#endif