summaryrefslogtreecommitdiff
path: root/examples/c-simple/c-simple.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-09-22 19:07:08 +0200
committerToni Uhlig <matzeton@googlemail.com>2022-09-22 19:07:08 +0200
commit9a28475bba88b711b7075b58473b7e5b5df1f393 (patch)
tree73cdf56320f14b5fe0fbfb2e930cf7ea025f9117 /examples/c-simple/c-simple.c
parent28971cd7647a79253000fb33e52b5d2129e5ba62 (diff)
Improved flown analyse event:
* store packet directions * merged direction based IATs * merged direction based PKTLENs Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/c-simple/c-simple.c')
-rw-r--r--examples/c-simple/c-simple.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/examples/c-simple/c-simple.c b/examples/c-simple/c-simple.c
index 9d1ca54b4..abf2e3feb 100644
--- a/examples/c-simple/c-simple.c
+++ b/examples/c-simple/c-simple.c
@@ -9,6 +9,16 @@ static int main_thread_shutdown = 0;
static struct nDPIsrvd_socket * sock = NULL;
#ifdef ENABLE_MEMORY_PROFILING
+void nDPIsrvd_memprof_log_alloc(size_t alloc_size)
+{
+ (void)alloc_size;
+}
+
+void nDPIsrvd_memprof_log_free(size_t free_size)
+{
+ (void)free_size;
+}
+
void nDPIsrvd_memprof_log(char const * const format, ...)
{
va_list ap;
@@ -106,7 +116,9 @@ static void sighandler(int signum)
if (verification_failed == 0)
{
fprintf(stderr, "%s\n", "Flow verification succeeded.");
- } else {
+ }
+ else
+ {
/* FATAL! */
exit(EXIT_FAILURE);
}
@@ -141,8 +153,10 @@ static enum nDPIsrvd_callback_return simple_json_callback(struct nDPIsrvd_socket
if (TOKEN_VALUE_EQUALS_SZ(flow_event_name, "new") != 0)
{
printf("Instance %.*s/%.*s (HT-Key: 0x%x), Thread %d, Flow %llu new\n",
- alias->value_length, alias->value,
- source->value_length, source->value,
+ alias->value_length,
+ alias->value,
+ source->value_length,
+ source->value,
instance->alias_source_key,
flow->thread_id,
flow->id_as_ull);
@@ -171,8 +185,10 @@ static void simple_flow_cleanup_callback(struct nDPIsrvd_socket * const sock,
char const * const reason_str = nDPIsrvd_enum_to_string(reason);
printf("Instance %.*s/%.*s (HT-Key: 0x%x), Thread %d, Flow %llu cleanup, reason: %s\n",
- alias->value_length, alias->value,
- source->value_length, source->value,
+ alias->value_length,
+ alias->value,
+ source->value_length,
+ source->value,
instance->alias_source_key,
flow->thread_id,
flow->id_as_ull,