blob: 6288a3a9f18618de6012f02052b277b4d097eb19 [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>
11#include "internal.h"
12#include "config.h"
13
14static void *tall_test;
15
Pablo Neira Ayusofe8ab0a2011-07-02 18:48:45 +020016#define DIPA_PROXY_TEST 0
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020017
18struct log_info_cat ipa_proxy_test_cat[] = {
19 [DIPA_PROXY_TEST] = {
Harald Weltecc2241b2011-07-19 16:06:06 +020020 .name = "DLINP_IPA_PROXY_TEST",
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020021 .description = "IPA proxy test",
22 .color = "\033[1;35m",
23 .enabled = 1, .loglevel = LOGL_NOTICE,
24 },
25};
26
27const struct log_info ipa_proxy_test_log_info = {
28 .filter_fn = NULL,
29 .cat = ipa_proxy_test_cat,
30 .num_cat = ARRAY_SIZE(ipa_proxy_test_cat),
31};
32
33static int bsc_vty_is_config_node(struct vty *vty, int node)
34{
35 switch(node) {
Harald Weltecc2241b2011-07-19 16:06:06 +020036 case L_IPA_NODE:
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020037 return 1;
38 break;
39 }
40 return 0;
41}
42
43static enum node_type bsc_vty_go_parent(struct vty *vty)
44{
45 switch (vty->node) {
Harald Weltecc2241b2011-07-19 16:06:06 +020046 case L_IPA_NODE:
Pablo Neira Ayuso130c4fb2011-06-23 21:15:53 +020047 vty->node = VIEW_NODE;
48 break;
49 }
50 return vty->node;
51}
52
53static struct vty_app_info vty_info = {
54 .name = "ipa-proxy-test",
55 .version = PACKAGE_VERSION,
56 .go_parent_cb = bsc_vty_go_parent,
57 .is_config_node = bsc_vty_is_config_node,
58};
59
60#define IPA_PROXY_TEST_TELNET_PORT 4260
61
62int main(void)
63{
64 tall_test = talloc_named_const(NULL, 1, "ipa proxy test");
65 libosmo_abis_init(tall_test);
66
67 osmo_init_logging(&ipa_proxy_test_log_info);
68
69 vty_init(&vty_info);
70 ipa_proxy_vty_init();
71
72 telnet_init(tall_test, NULL, IPA_PROXY_TEST_TELNET_PORT);
73
74 LOGP(DIPA_PROXY_TEST, LOGL_NOTICE, "entering main loop\n");
75
76 while (1) {
77 osmo_select_main(0);
78 }
79}