Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 1 | /* 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 Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 6 | * 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 Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 8 | * (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 Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 13 | * GNU Affero General Public License for more details. |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 14 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * 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 Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | |
| 20 | #ifndef PAGING_H |
| 21 | #define PAGING_H |
| 22 | |
Harald Welte | 12247c6 | 2009-05-21 07:23:02 +0000 | [diff] [blame] | 23 | #include <stdlib.h> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 24 | #include <string.h> |
| 25 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 26 | #include <osmocom/core/linuxlist.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 27 | #include <osmocom/core/timer.h> |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 28 | |
Neels Hofmeyr | a5c71bf | 2017-01-25 16:15:43 +0100 | [diff] [blame] | 29 | #include <openbsc/gsm_data.h> |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 30 | #include <openbsc/bsc_subscriber.h> |
Neels Hofmeyr | a5c71bf | 2017-01-25 16:15:43 +0100 | [diff] [blame] | 31 | |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 32 | /** |
| 33 | * A pending paging request |
| 34 | */ |
| 35 | struct 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 Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 39 | * should probably become a part of the bsc_subsrc struct? */ |
| 40 | struct bsc_subscr *bsub; |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 41 | /* 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 Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 47 | struct osmo_timer_list T3113; |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 48 | |
Holger Hans Peter Freyther | d3baf41 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 49 | /* How often did we ask the BTS to page? */ |
| 50 | int attempts; |
| 51 | |
Holger Hans Peter Freyther | 85334f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 52 | /* callback to be called in case paging completes */ |
| 53 | gsm_cbfn *cbfn; |
| 54 | void *cbfn_param; |
| 55 | }; |
| 56 | |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 57 | /* schedule paging request */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 58 | int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, |
Harald Welte | e903edf | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 59 | int type, gsm_cbfn *cbfn, void *data); |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 60 | int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, |
| 61 | int type, gsm_cbfn *cbfn, void *data); |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 62 | |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 63 | /* stop paging requests */ |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 64 | void paging_request_stop(struct llist_head *bts_list, |
| 65 | struct gsm_bts *_bts, struct bsc_subscr *bsub, |
Sylvain Munaut | c7ff257 | 2010-12-01 21:41:35 +0100 | [diff] [blame] | 66 | struct gsm_subscriber_connection *conn, |
| 67 | struct msgb *msg); |
Harald Welte | 763da00 | 2009-02-06 12:52:14 +0000 | [diff] [blame] | 68 | |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 69 | /* update paging load */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 70 | void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 71 | |
Holger Hans Peter Freyther | 66e14cd | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 72 | /* pending paging requests */ |
| 73 | unsigned int paging_pending_requests_nr(struct gsm_bts *bts); |
| 74 | |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 75 | void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub); |
Holger Hans Peter Freyther | 31f5f71 | 2011-06-07 19:53:29 +0200 | [diff] [blame] | 76 | |
Harald Welte | b68899d | 2009-01-06 21:47:18 +0000 | [diff] [blame] | 77 | #endif |