Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [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 | 0e3e88e | 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 | 59b0468 | 2009-06-10 05:40:52 +0800 | [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 | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 13 | * GNU Affero General Public License for more details. |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 14 | * |
Harald Welte | 0e3e88e | 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 | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 17 | * |
| 18 | */ |
| 19 | |
| 20 | #ifndef PAGING_H |
| 21 | #define PAGING_H |
| 22 | |
| 23 | #include <stdlib.h> |
| 24 | #include <string.h> |
| 25 | |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 26 | #include <osmocom/core/linuxlist.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 27 | #include "gsm_data.h" |
| 28 | #include "gsm_subscriber.h" |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 29 | #include <osmocom/core/timer.h> |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 30 | |
Holger Hans Peter Freyther | 25176f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 31 | /** |
| 32 | * A pending paging request |
| 33 | */ |
| 34 | struct 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 Ayuso | 840ccf6 | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 46 | struct osmo_timer_list T3113; |
Holger Hans Peter Freyther | 25176f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 47 | |
Holger Hans Peter Freyther | ab2a933 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 48 | /* How often did we ask the BTS to page? */ |
| 49 | int attempts; |
| 50 | |
Holger Hans Peter Freyther | 25176f1 | 2010-11-09 17:00:42 +0100 | [diff] [blame] | 51 | /* callback to be called in case paging completes */ |
| 52 | gsm_cbfn *cbfn; |
| 53 | void *cbfn_param; |
| 54 | }; |
| 55 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 56 | /* schedule paging request */ |
Harald Welte | d363c95 | 2009-08-15 03:16:17 +0200 | [diff] [blame] | 57 | int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, |
| 58 | int type, gsm_cbfn *cbfn, void *data); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 59 | |
| 60 | /* stop paging requests */ |
| 61 | void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, |
Sylvain Munaut | b7b6e78 | 2010-12-01 21:41:35 +0100 | [diff] [blame] | 62 | struct gsm_subscriber_connection *conn, |
| 63 | struct msgb *msg); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 64 | |
| 65 | /* update paging load */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 66 | void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 67 | |
Holger Hans Peter Freyther | 914ff19 | 2011-04-26 15:52:34 +0200 | [diff] [blame] | 68 | /* pending paging requests */ |
| 69 | unsigned int paging_pending_requests_nr(struct gsm_bts *bts); |
| 70 | |
Holger Hans Peter Freyther | ad39db6 | 2011-06-07 19:53:29 +0200 | [diff] [blame] | 71 | void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr); |
| 72 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 73 | #endif |