Jonathan Santos | 03fd8d0 | 2011-05-25 13:54:02 -0400 | [diff] [blame] | 1 | /* Management functions to allocate/release struct gsm_lchan */ |
| 2 | /* (C) 2008 by Harald Welte <laforge@gnumonks.org> |
| 3 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Affero General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | */ |
| 20 | #ifndef _CHAN_ALLOC_H |
| 21 | #define _CHAN_ALLOC_H |
| 22 | |
| 23 | #include "gsm_data.h" |
| 24 | |
| 25 | struct gsm_subscriber_connection; |
| 26 | |
| 27 | /* Special allocator for C0 of BTS */ |
| 28 | struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, |
| 29 | enum gsm_phys_chan_config pchan); |
| 30 | |
| 31 | /* Regular physical channel allocator */ |
| 32 | struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, |
| 33 | enum gsm_phys_chan_config pchan); |
| 34 | |
| 35 | /* Regular physical channel (TS) */ |
| 36 | void ts_free(struct gsm_bts_trx_ts *ts); |
| 37 | |
| 38 | /* Find an allocated channel for a specified subscriber */ |
| 39 | struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr); |
| 40 | |
| 41 | /* Allocate a logical channel (SDCCH, TCH, ...) */ |
| 42 | struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger); |
| 43 | |
| 44 | /* Free a logical channel (SDCCH, TCH, ...) */ |
| 45 | void lchan_free(struct gsm_lchan *lchan); |
| 46 | void lchan_reset(struct gsm_lchan *lchan); |
| 47 | |
| 48 | /* Release the given lchan */ |
| 49 | int lchan_release(struct gsm_lchan *lchan, int sach_deact, int reason); |
| 50 | |
| 51 | struct load_counter { |
| 52 | unsigned int total; |
| 53 | unsigned int used; |
| 54 | }; |
| 55 | |
| 56 | struct pchan_load { |
| 57 | struct load_counter pchan[GSM_PCHAN_UNKNOWN]; |
| 58 | }; |
| 59 | |
| 60 | void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); |
| 61 | void network_chan_load(struct pchan_load *pl, struct gsm_network *net); |
| 62 | |
| 63 | int trx_is_usable(struct gsm_bts_trx *trx); |
| 64 | |
| 65 | #endif /* _CHAN_ALLOC_H */ |