aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-omldummy/main.c
blob: b9334b1b458773a6bc217dc8a0b850e4a3744d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <osmocom/core/talloc.h>
#include <osmo-bts/logging.h>
#include <osmo-bts/abis.h>
#include <osmo-bts/bts.h>
#include <osmo-bts/oml.h>


int main(int argc, char **argv)
{
	struct gsm_bts *bts;
	struct gsm_bts_trx *trx;
	struct e1inp_line *line;
	int rc, i;

	char *dst_host = argv[1];
	int site_id = atoi(argv[2]);

	tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context");
	msgb_talloc_ctx_init(tall_bts_ctx, 10*1024);

	bts_log_init(NULL);

	bts = gsm_bts_alloc(tall_bts_ctx, 0);
	if (!bts)
		exit(1);
	bts->ip_access.site_id = site_id;
	bts->ip_access.bts_id = 0;

	/* Additional TRXs */
	for (i = 1; i < 8; i++) {
		trx = gsm_bts_trx_alloc(bts);
		if (!trx)
			exit(1);
	}

	if (bts_init(bts) < 0)
		exit(1);
	//btsb = bts_role_bts(bts);
	abis_init(bts);


	line = abis_open(bts, dst_host, "OMLdummy");
	if (!line)
		exit(2);

	while (1) {
		osmo_select_main(0);
	}

	return EXIT_SUCCESS;
}