diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2022-09-24 23:25:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2022-09-25 00:54:39 +0200 |
commit | 2103ee0811e3f606b8129d044e22cd33804e2117 (patch) | |
tree | 80e76fd406e5f6dbf745ca39fa6d55d85790c530 /examples/c-simple/c-simple.c | |
parent | 36f1786bde2572cf7eb44aa1384b61ecfebdeff3 (diff) |
Refactored client distributor C API.
* Still not perfect, but the code before was not even able to deal with JSON arrays.
Use common "speaking" function names for all functions in nDPIsrvd.h
* Provide a more or less generic and easy extendable JSON walk function.
* Modified C examples to align with the changed C API.
* c-collectd: Reduced lot's of code duplication by providing mapping tables.
* nDPId: IAT array requires one slot less (first packet has always an IAT of 0).
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.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/c-simple/c-simple.c b/examples/c-simple/c-simple.c index abf2e3feb..a923d1424 100644 --- a/examples/c-simple/c-simple.c +++ b/examples/c-simple/c-simple.c @@ -150,13 +150,13 @@ static enum nDPIsrvd_callback_return simple_json_callback(struct nDPIsrvd_socket } struct nDPIsrvd_json_token const * const flow_event_name = TOKEN_GET_SZ(sock, "flow_event_name"); - if (TOKEN_VALUE_EQUALS_SZ(flow_event_name, "new") != 0) + if (TOKEN_VALUE_EQUALS_SZ(sock, 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, + nDPIsrvd_get_token_size(sock, alias), + nDPIsrvd_get_token_value(sock, alias), + nDPIsrvd_get_token_size(sock, source), + nDPIsrvd_get_token_value(sock, source), instance->alias_source_key, flow->thread_id, flow->id_as_ull); @@ -185,10 +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, + nDPIsrvd_get_token_size(sock, alias), + nDPIsrvd_get_token_value(sock, alias), + nDPIsrvd_get_token_size(sock, source), + nDPIsrvd_get_token_value(sock, source), instance->alias_source_key, flow->thread_id, flow->id_as_ull, |