blob: 2ed30ff5aaadd8f99a774a0759fe3b5ceb022822 [file] [log] [blame]
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +02001#include <stdio.h>
Harald Welte71d87b22011-07-18 14:49:56 +02002#include <osmocom/core/talloc.h>
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +02003#include <osmocom/abis/abis.h>
4#include <osmocom/abis/e1_input.h>
5#include <osmocom/abis/ipa_proxy.h>
6#include <osmocom/core/logging.h>
7#include <osmocom/core/application.h>
8#include <osmocom/vty/vty.h>
9#include <osmocom/vty/command.h>
10#include <osmocom/vty/telnet_interface.h>
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020011
12static void *tall_test;
13
Pablo Neira Ayusofe8ab0a2011-07-02 18:48:45 +020014#define DIPA_PROXY_TEST 0
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020015
16struct log_info_cat ipa_proxy_test_cat[] = {
17 [DIPA_PROXY_TEST] = {
Harald Weltecc2241b2011-07-19 16:06:06 +020018 .name = "DLINP_IPA_PROXY_TEST",
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020019 .description = "IPA proxy test",
20 .color = "\033[1;35m",
21 .enabled = 1, .loglevel = LOGL_NOTICE,
22 },
23};
24
25const struct log_info ipa_proxy_test_log_info = {
26 .filter_fn = NULL,
27 .cat = ipa_proxy_test_cat,
28 .num_cat = ARRAY_SIZE(ipa_proxy_test_cat),
29};
30
31static int bsc_vty_is_config_node(struct vty *vty, int node)
32{
33 switch(node) {
Harald Weltecc2241b2011-07-19 16:06:06 +020034 case L_IPA_NODE:
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020035 return 1;
36 break;
37 }
38 return 0;
39}
40
41static enum node_type bsc_vty_go_parent(struct vty *vty)
42{
43 switch (vty->node) {
Harald Weltecc2241b2011-07-19 16:06:06 +020044 case L_IPA_NODE:
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020045 vty->node = VIEW_NODE;
46 break;
47 }
48 return vty->node;
49}
50
51static struct vty_app_info vty_info = {
52 .name = "ipa-proxy-test",
Pablo Neira Ayuso8fc277b2011-09-08 13:22:26 +020053 .version = "1.0",
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020054 .go_parent_cb = bsc_vty_go_parent,
55 .is_config_node = bsc_vty_is_config_node,
56};
57
58#define IPA_PROXY_TEST_TELNET_PORT 4260
59
60int main(void)
61{
62 tall_test = talloc_named_const(NULL, 1, "ipa proxy test");
63 libosmo_abis_init(tall_test);
64
65 osmo_init_logging(&ipa_proxy_test_log_info);
66
67 vty_init(&vty_info);
68 ipa_proxy_vty_init();
69
70 telnet_init(tall_test, NULL, IPA_PROXY_TEST_TELNET_PORT);
71
72 LOGP(DIPA_PROXY_TEST, LOGL_NOTICE, "entering main loop\n");
73
74 while (1) {
75 osmo_select_main(0);
76 }
77}