mirror of
https://github.com/outbackdingo/nDPId.git
synced 2026-01-27 10:19:45 +00:00
nDPIsrvd.h: Provide two additional convenient API functions.
* nDPIsrvd_json_buffer_string * nDPIsrvd_json_buffer_length Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
10
dependencies/nDPIsrvd.h
vendored
10
dependencies/nDPIsrvd.h
vendored
@@ -1645,4 +1645,14 @@ static inline void nDPIsrvd_flow_info(struct nDPIsrvd_socket const * const sock,
|
||||
}
|
||||
}
|
||||
|
||||
static inline int nDPIsrvd_json_buffer_length(struct nDPIsrvd_socket const * const sock)
|
||||
{
|
||||
return (int)sock->buffer.json_string_length;
|
||||
}
|
||||
|
||||
static inline char const *nDPIsrvd_json_buffer_string(struct nDPIsrvd_socket const * const sock)
|
||||
{
|
||||
return sock->buffer.json_string;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -150,7 +150,7 @@ static void csv_buf_add(csv_buf_t buf, size_t * const csv_buf_used, char const *
|
||||
|
||||
if (siz_len > 0 && str != NULL)
|
||||
{
|
||||
len = MIN(BUFFER_REMAINING(*csv_buf_used), siz_len);
|
||||
len = MIN(BUFFER_REMAINING(*csv_buf_used), siz_len - 1);
|
||||
if (len == 0)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -372,7 +372,8 @@ static enum nDPIsrvd_callback_return captured_json_callback(struct nDPIsrvd_sock
|
||||
if (pkt == NULL)
|
||||
{
|
||||
syslog(LOG_DAEMON | LOG_ERR, "%s", "No packet data available.");
|
||||
return CALLBACK_ERROR;
|
||||
syslog(LOG_DAEMON | LOG_ERR, "JSON String: \"%.*s\"", nDPIsrvd_json_buffer_length(sock), nDPIsrvd_json_buffer_string(sock));
|
||||
return CALLBACK_OK;
|
||||
}
|
||||
if (flow_user->packets == NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user