blob: 13d611af9ef1ba44b000c1c13eba9636c430be1e [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>
Harald Welteb68899d2009-01-06 21:47:18 +000027#include "gsm_data.h"
28#include "gsm_subscriber.h"
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010029#include <osmocom/core/timer.h>
Harald Welteb68899d2009-01-06 21:47:18 +000030
Holger Hans Peter Freyther85334f12010-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? */
46 struct timer_list T3113;
47
Holger Hans Peter Freytherd3baf412010-12-23 18:19:17 +010048 /* How often did we ask the BTS to page? */
49 int attempts;
50
Holger Hans Peter Freyther85334f12010-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 Welteb68899d2009-01-06 21:47:18 +000056/* call once for every gsm_bts... */
Holger Freyther1fd34142009-02-09 23:42:03 +000057void paging_init(struct gsm_bts *bts);
Harald Welteb68899d2009-01-06 21:47:18 +000058
59/* schedule paging request */
Harald Weltee903edf2009-08-15 03:16:17 +020060int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr,
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 */
Harald Welte75a1fa82009-02-17 01:39:41 +000064void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr,
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 */
69void paging_update_buffer_space(struct gsm_bts *bts, u_int16_t);
70
Harald Welteb68899d2009-01-06 21:47:18 +000071#endif