blob: 933df9c9d22200cdb6ae6bd716c9d0d6eb39c678 [file] [log] [blame]
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +02001/*
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
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +02008 * (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
13 * GNU General Public License for more details.
14 *
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/>.
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +020017 *
18 */
19
20#include <stdio.h>
Harald Welte6bfda782009-06-26 20:30:46 +020021#include <stdlib.h>
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +020022
23#include <assert.h>
24
Holger Hans Peter Freyther08e324f2012-01-06 14:06:56 +010025#include <osmocom/core/application.h>
Pablo Neira Ayuso136f4532011-03-22 16:47:59 +010026#include <osmocom/core/select.h>
Holger Hans Peter Freyther08e324f2012-01-06 14:06:56 +010027
Neels Hofmeyrc0164792017-09-04 15:15:32 +020028#include <osmocom/bsc/common_bsc.h>
29#include <osmocom/bsc/abis_rsl.h>
30#include <osmocom/bsc/debug.h>
Neels Hofmeyr8d878e82016-09-25 15:47:36 +020031
Alexander Chemeris0796a6c2017-07-11 01:42:41 +063032void test_bts_debug_print(void)
33{
34 struct gsm_network *network;
35 struct gsm_bts *bts;
36 struct gsm_bts_trx *trx;
37
38 printf("Testing the lchan printing:");
39
40 /* Create a dummy network */
Harald Welted9956d92017-12-17 21:48:47 +010041 network = bsc_network_init(tall_bsc_ctx, 1, 1);
Alexander Chemeris0796a6c2017-07-11 01:42:41 +063042 if (!network)
43 exit(1);
44 /* Add a BTS with some reasonanbly non-zero id */
45 bts = gsm_bts_alloc(network, 45);
46 /* Add a second TRX to test on multiple TRXs */
47 gsm_bts_trx_alloc(bts);
48
49 llist_for_each_entry(trx, &bts->trx_list, list) {
50 char *name = gsm_lchan_name(&trx->ts[3].lchan[4]);
51
52 if (name)
53 printf(" %s", name);
54 else
55 printf("NULL name");
56 }
57 printf("\n");
58}
59
60
Neels Hofmeyre289a2a2016-09-25 15:58:01 +020061void test_dyn_ts_subslots(void)
62{
63 struct gsm_bts_trx_ts ts;
64
65 printf("Testing subslot numbers for pchan types\n");
66
67 ts.pchan = GSM_PCHAN_TCH_F;
68 OSMO_ASSERT(ts_subslots(&ts) == 1);
69
70 ts.pchan = GSM_PCHAN_TCH_H;
71 OSMO_ASSERT(ts_subslots(&ts) == 2);
72
73 ts.pchan = GSM_PCHAN_PDCH;
74 OSMO_ASSERT(ts_subslots(&ts) == 0);
75
76 ts.pchan = GSM_PCHAN_TCH_F_PDCH;
77 ts.flags = 0; /* TCH_F mode */
78 OSMO_ASSERT(ts_subslots(&ts) == 1);
79 ts.flags = TS_F_PDCH_ACTIVE;
Neels Hofmeyrc3f72f62016-09-25 15:33:02 +020080 OSMO_ASSERT(ts_subslots(&ts) == 0);
Neels Hofmeyre289a2a2016-09-25 15:58:01 +020081
82 ts.pchan = GSM_PCHAN_TCH_F_TCH_H_PDCH;
83 ts.dyn.pchan_is = GSM_PCHAN_TCH_F;
84 OSMO_ASSERT(ts_subslots(&ts) == 1);
85 ts.dyn.pchan_is = GSM_PCHAN_TCH_H;
86 OSMO_ASSERT(ts_subslots(&ts) == 2);
87 ts.dyn.pchan_is = GSM_PCHAN_PDCH;
88 OSMO_ASSERT(ts_subslots(&ts) == 0);
89}
90
Neels Hofmeyr8d878e82016-09-25 15:47:36 +020091int main(int argc, char **argv)
92{
93 osmo_init_logging(&log_info);
94
Neels Hofmeyre289a2a2016-09-25 15:58:01 +020095 test_dyn_ts_subslots();
Alexander Chemeris0796a6c2017-07-11 01:42:41 +063096 test_bts_debug_print();
Holger Hans Peter Freyther08e324f2012-01-06 14:06:56 +010097
98 return EXIT_SUCCESS;
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +020099}
100
Holger Hans Peter Freyther7673ce42009-08-10 06:40:05 +0200101void sms_alloc() {}
Holger Hans Peter Freyther900394a2013-12-27 20:10:24 +0100102void sms_free() {}
Holger Hans Peter Freytherd9cdd052010-12-21 13:43:52 +0100103void gsm48_secure_channel() {}
Holger Hans Peter Freyther763b42a2010-12-29 11:07:22 +0100104void vty_out() {}
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200105
Harald Weltea43e0b42016-06-19 18:06:02 +0200106void ipa_client_conn_clear_queue() {}
107void ipa_client_conn_close() {}
108void ipa_client_conn_create() {}
109void ipa_client_conn_destroy() {}
110void ipa_client_conn_open() {}
111void ipa_client_conn_send() {}
112void ipa_msg_push_header() {}
113void ipaccess_bts_handle_ccm() {}
Holger Hans Peter Freyther98657d52010-01-11 16:42:07 +0100114
Harald Weltea43e0b42016-06-19 18:06:02 +0200115struct tlv_definition nm_att_tlvdef;