diff options
Diffstat (limited to 'titan/hello.cc')
-rw-r--r-- | titan/hello.cc | 44 |
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(); +} + +} |