summaryrefslogtreecommitdiff
path: root/titan/hello.cc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-03-26 19:02:08 +0200
committerHarald Welte <laforge@gnumonks.org>2018-03-26 19:02:08 +0200
commit670659c28c298a6383838bdb5c94da36312c26f3 (patch)
tree5cbe04e7c033d857a7bdbb095c97bd558afad2af /titan/hello.cc
parent75e95789179b2efac88fd0f8d6555722695e3f94 (diff)
add TITAN support for MNCC/PCU interface decoding
Diffstat (limited to 'titan/hello.cc')
-rw-r--r--titan/hello.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/titan/hello.cc b/titan/hello.cc
new file mode 100644
index 0000000..cd6179b
--- /dev/null
+++ b/titan/hello.cc
@@ -0,0 +1,44 @@
+#include <errno.h>
+
+extern char *program_invocation_short_name;
+
+#include <iostream>
+#include "MNCC_Types.hh"
+#include "PCUIF_Types.hh"
+
+using namespace std;
+
+extern "C" {
+
+void pcu_dissector(int fd, bool is_out, const char *fn, const uint8_t *data, unsigned int len)
+{
+ OCTETSTRING oct(len, data);
+ PCUIF__Types::PCUIF__Message pdu = PCUIF__Types::dec__PCUIF__Message(oct);
+ TTCN_Logger::begin_event(TTCN_ERROR);
+ TTCN_Logger::log_event("%s(%d) %s: ", fn, fd, is_out ? "Tx" : "Rx");
+ pdu.log();
+ TTCN_Logger::end_event();
+}
+
+
+void mncc_dissector(int fd, bool is_out, const char *fn, const uint8_t *data, unsigned int len)
+{
+ OCTETSTRING oct(len, data);
+ MNCC__Types::MNCC__PDU pdu = MNCC__Types::dec__MNCC__PDU(oct);
+ TTCN_Logger::begin_event(TTCN_ERROR);
+ TTCN_Logger::log_event("%s(%d) %s: ", fn, fd, is_out ? "Tx" : "Rx");
+ pdu.log();
+ TTCN_Logger::end_event();
+}
+
+__attribute__ ((constructor)) static void init_mncc(void)
+{
+ TTCN_Runtime::set_state(TTCN_Runtime::SINGLE_CONTROLPART);
+ //TTCN_Runtime::install_signal_handlers();
+ TTCN_Logger::initialize_logger();
+ TTCN_Logger::set_executable_name(program_invocation_short_name);
+ TTCN_Logger::set_start_time();
+ TTCN_Logger::open_file();
+}
+
+}
personal git repositories of Harald Welte. Your mileage may vary