blob: a79d5f505756312ce056807507d142d09f959fce [file] [log] [blame]
Harald Welte87ffeb92015-12-25 15:34:22 +01001/* Common osmo-iuh test stub code */
2
3/* (C) 2015 by Sysmocom s.f.m.c. GmbH
4 * Author: Daniel Willmann <dwillmann@sysmocom.de>
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include <unistd.h>
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26#include <getopt.h>
27#include <errno.h>
28#include <signal.h>
29
30#include <sys/types.h>
31#include <sys/socket.h>
32#include <netinet/in.h>
33#include <netinet/sctp.h>
34#include <arpa/inet.h>
35
36#include <osmocom/core/application.h>
37#include <osmocom/core/talloc.h>
38#include <osmocom/core/logging.h>
39
40#include "hnbgw.h"
41
42void *talloc_asn1_ctx;
43
44static const struct log_info_cat log_cat[] = {
45 [DMAIN] = {
46 .name = "DMAIN", .loglevel = LOGL_INFO, .enabled = 1,
47 .color = "",
48 .description = "Main program",
49 },
50 [DHNBAP] = {
51 .name = "DHNBAP", .loglevel = LOGL_DEBUG, .enabled = 1,
52 .color = "",
53 .description = "Home Node B Application Part",
54 },
55 [DRANAP] = {
56 .name = "RANAP", .loglevel = LOGL_DEBUG, .enabled = 1,
57 .color = "",
58 .description = "RAN Application Part",
59 },
60 [DRUA] = {
61 .name = "RUA", .loglevel = LOGL_DEBUG, .enabled = 1,
62 .color = "",
63 .description = "RANAP User Adaptation",
64 },
65 [DSUA] = {
66 .name = "SUA", .loglevel = LOGL_DEBUG, .enabled = 1,
67 .color = "",
68 .description = "SCCP User Adaptation",
69 },
70};
71
72static const struct log_info test_log_info = {
73 .cat = log_cat,
74 .num_cat = ARRAY_SIZE(log_cat),
75};
76
77int test_common_init(void)
78{
79 int rc;
80
81 talloc_asn1_ctx = talloc_named_const(NULL, 0, "asn1_context");
82
83 rc = osmo_init_logging(&test_log_info);
84 if (rc < 0)
85 exit(1);
86
Harald Weltebdf3fd12016-01-03 17:04:09 +010087 ranap_set_log_area(DRANAP);
Neels Hofmeyr52c6ae22016-08-26 14:08:51 +020088
89 log_set_print_filename(osmo_stderr_target, 0);
90 log_set_use_color(osmo_stderr_target, 0);
Harald Welte87ffeb92015-12-25 15:34:22 +010091}