blob: 78242e5b7af81836cdbac54c4015246c901a977d [file] [log] [blame]
Holger Freytherd0e38c32009-01-04 03:48:30 +00001/* 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
Harald Welte9af6ddf2011-01-01 15:25:50 +01007 * 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
Holger Freytherd0e38c32009-01-04 03:48:30 +00009 * (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
Harald Welte9af6ddf2011-01-01 15:25:50 +010014 * GNU Affero General Public License for more details.
Holger Freytherd0e38c32009-01-04 03:48:30 +000015 *
Harald Welte9af6ddf2011-01-01 15:25:50 +010016 * 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/>.
Holger Freytherd0e38c32009-01-04 03:48:30 +000018 *
19 */
Harald Welte8470bf22008-12-25 23:28:35 +000020#ifndef _CHAN_ALLOC_H
21#define _CHAN_ALLOC_H
22
Holger Hans Peter Freyther35470452010-12-22 18:13:00 +010023#include "gsm_data.h"
Holger Freytherd0e38c32009-01-04 03:48:30 +000024
Holger Hans Peter Freytherb2be1952010-06-16 13:23:55 +080025struct gsm_subscriber_connection;
26
Harald Welte1a6f7982009-08-09 18:52:33 +020027/* Find an allocated channel for a specified subscriber */
Holger Hans Peter Freytherb2be1952010-06-16 13:23:55 +080028struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr);
Harald Welte1a6f7982009-08-09 18:52:33 +020029
Harald Welte8470bf22008-12-25 23:28:35 +000030/* Allocate a logical channel (SDCCH, TCH, ...) */
Holger Hans Peter Freyther457c2a82010-09-06 08:58:42 +080031struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger);
Harald Welte8470bf22008-12-25 23:28:35 +000032
33/* Free a logical channel (SDCCH, TCH, ...) */
34void lchan_free(struct gsm_lchan *lchan);
Holger Hans Peter Freyther135f7972010-04-15 11:21:02 +020035void lchan_reset(struct gsm_lchan *lchan);
Harald Welte8470bf22008-12-25 23:28:35 +000036
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +080037/* Release the given lchan */
Holger Hans Peter Freyther5ca825e2012-12-06 12:01:38 +010038int lchan_release(struct gsm_lchan *lchan, int sacch_deact, enum rsl_rel_mode release_mode);
Holger Freyther67b4b9a2009-01-01 03:46:11 +000039
Harald Welteb908cb72009-12-22 13:09:29 +010040struct load_counter {
41 unsigned int total;
42 unsigned int used;
43};
44
45struct pchan_load {
Daniel Willmann979ac862014-12-30 12:15:08 +010046 struct load_counter pchan[_GSM_PCHAN_MAX];
Harald Welteb908cb72009-12-22 13:09:29 +010047};
48
Neels Hofmeyr2afffd52016-09-25 17:01:20 +020049void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts);
Harald Welteb908cb72009-12-22 13:09:29 +010050void network_chan_load(struct pchan_load *pl, struct gsm_network *net);
51
Harald Welte (local)82ff3972009-12-28 16:36:28 +010052int trx_is_usable(struct gsm_bts_trx *trx);
53
Harald Welte8470bf22008-12-25 23:28:35 +000054#endif /* _CHAN_ALLOC_H */