blob: 1121dd5ad45a6ffe5bae69845748168c88519cd8 [file] [log] [blame]
Jonathan Santos03fd8d02011-05-25 13:54:02 -04001/*
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
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
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
13 * GNU General Public License for more details.
14 *
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/>.
17 *
18 */
19
20#include <stdio.h>
21#include <stdlib.h>
22
23#include <assert.h>
24
Jonathan Santos5a45b152011-08-17 15:33:57 -040025#include <osmocom/core/select.h>
Jonathan Santos03fd8d02011-05-25 13:54:02 -040026#include <openbsc/gsm_subscriber.h>
27#include <openbsc/abis_rsl.h>
28
29/* our handler */
30static int subscr_cb(unsigned int hook, unsigned int event, struct msgb *msg, void *data, void *param)
31{
32 assert(hook == 101);
33 assert(event == 200);
34 assert(msg == (void*)0x1323L);
35 assert(data == (void*)0x4242L);
36 assert(param == (void*)0x2342L);
37 printf("Reached, didn't crash, test passed\n");
38 return 0;
39}
40
41/* mock object for testing, directly invoke the cb... maybe later through the timer */
42void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscriber, int type, gsm_cbfn *cbfn, void *data)
43{
44 cbfn(101, 200, (void*)0x1323L, (void*)0x4242L, data);
45}
46
47
48int main(int argc, char **argv)
49{
50 struct gsm_network *network;
51 struct gsm_bts *bts;
52
53 printf("Testing the gsm_subscriber chan logic\n");
54
55 /* Create a dummy network */
56 network = gsm_network_init(1, 1, NULL);
57 if (!network)
58 exit(1);
Jonathan Santos5a45b152011-08-17 15:33:57 -040059 bts = gsm_bts_alloc(network);
Jonathan Santos03fd8d02011-05-25 13:54:02 -040060 bts->location_area_code = 23;
61
62 /* Create a dummy subscriber */
63 struct gsm_subscriber *subscr = subscr_alloc();
64 subscr->lac = 23;
65 subscr->net = network;
66
67 /* Ask for a channel... */
68 subscr_get_channel(subscr, RSL_CHANNEED_TCH_F, subscr_cb, (void*)0x2342L);
69
70 while (1) {
Jonathan Santos5a45b152011-08-17 15:33:57 -040071 osmo_select_main(0);
Jonathan Santos03fd8d02011-05-25 13:54:02 -040072 }
73}
74
75void _abis_nm_sendmsg() {}
76void sms_alloc() {}
77void gsm_net_update_ctype(struct gsm_network *network) {}
78void gsm48_secure_channel() {}
79void paging_request_stop() {}
80void vty_out() {}
81
82
83struct tlv_definition nm_att_tlvdef;
84