if (p->alerts.cnt == 0 && !(p->flags & PKT_HAS_TAG))
return TM_ECODE_OK;
- json_t *js = CreateJSONHeader((Packet *)p, 0, "alert");
+ json_t *js = CreateJSONHeader(p, 0, "alert");
if (unlikely(js == NULL))
return TM_ECODE_OK;
if ((p->flags & PKT_HAS_TAG) && (json_output_ctx->flags &
LOG_JSON_TAGGED_PACKETS)) {
MemBufferReset(aft->json_buffer);
- json_t *packetjs = CreateJSONHeader((Packet *)p, 0, "packet");
+ json_t *packetjs = CreateJSONHeader(p, 0, "packet");
if (unlikely(packetjs != NULL)) {
AlertJsonPacket(p, packetjs);
OutputJSONBuffer(packetjs, aft->file_ctx, &aft->json_buffer);
MemBufferReset(buffer);
if (tx->has_request && tx->request_done) {
- json_t *js = CreateJSONHeader((Packet *)p, 1, "dnp3");
+ json_t *js = CreateJSONHeader(p, 1, "dnp3");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
MemBufferReset(buffer);
if (tx->has_response && tx->response_done) {
- json_t *js = CreateJSONHeader((Packet *)p, 1, "dnp3");
+ json_t *js = CreateJSONHeader(p, 1, "dnp3");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
#ifdef HAVE_RUST
for (uint16_t i = 0; i < 0xffff; i++) {
- js = CreateJSONHeader((Packet *)p, 1, "dns");
+ js = CreateJSONHeader(p, 1, "dns");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
DNSTransaction *tx = txptr;
DNSQueryEntry *query = NULL;
TAILQ_FOREACH(query, &tx->query_list, next) {
- js = CreateJSONHeader((Packet *)p, 1, "dns");
+ js = CreateJSONHeader(p, 1, "dns");
if (unlikely(js == NULL))
return TM_ECODE_OK;
if (dnslog_ctx->include_metadata) {
return TM_ECODE_OK;
}
- js = CreateJSONHeader((Packet *)p, 0, "dns");
+ js = CreateJSONHeader(p, 0, "dns");
if (dnslog_ctx->include_metadata) {
JsonAddMetadata(p, f, js);
{
JsonDropOutputCtx *drop_ctx = aft->drop_ctx;
uint16_t proto = 0;
- json_t *js = CreateJSONHeader((Packet *)p, 0, "drop");//TODO const
+ json_t *js = CreateJSONHeader(p, 0, "drop");
if (unlikely(js == NULL))
return TM_ECODE_OK;
json_t *JsonBuildFileInfoRecord(const Packet *p, const File *ff,
const bool stored)
{
- json_t *js = CreateJSONHeader((Packet *)p, 0, "fileinfo"); //TODO const
+ json_t *js = CreateJSONHeader(p, 0, "fileinfo");
json_t *hjs = NULL;
if (unlikely(js == NULL))
return NULL;
MemBuffer *buffer;
} JsonFlowLogThread;
-static json_t *CreateJSONHeaderFromFlow(Flow *f, const char *event_type)
+static json_t *CreateJSONHeaderFromFlow(const Flow *f, const char *event_type)
{
char timebuf[64];
char srcip[46], dstip[46];
/* reset */
MemBufferReset(jhl->buffer);
- json_t *js = CreateJSONHeaderFromFlow(f, "flow"); //TODO const
+ json_t *js = CreateJSONHeaderFromFlow(f, "flow");
if (unlikely(js == NULL))
return TM_ECODE_OK;
htp_tx_t *tx = txptr;
JsonHttpLogThread *jhl = (JsonHttpLogThread *)thread_data;
- json_t *js = CreateJSONHeaderWithTxId((Packet *)p, 1, "http", tx_id); //TODO const
+ json_t *js = CreateJSONHeaderWithTxId(p, 1, "http", tx_id);
if (unlikely(js == NULL))
return TM_ECODE_OK;
static int MetadataJson(ThreadVars *tv, JsonMetadataLogThread *aft, const Packet *p)
{
- json_t *js = CreateJSONHeader((Packet *)p, 0, "metadata");
+ json_t *js = CreateJSONHeader(p, 0, "metadata");
if (unlikely(js == NULL))
return TM_ECODE_OK;
} JsonNetFlowLogThread;
-static json_t *CreateJSONHeaderFromFlow(Flow *f, const char *event_type, int dir)
+static json_t *CreateJSONHeaderFromFlow(const Flow *f, const char *event_type, int dir)
{
char timebuf[64];
char srcip[46], dstip[46];
/* reset */
MemBufferReset(jhl->buffer);
- json_t *js = CreateJSONHeaderFromFlow(f, "netflow", 0); //TODO const
+ json_t *js = CreateJSONHeaderFromFlow(f, "netflow", 0);
if (unlikely(js == NULL))
return TM_ECODE_OK;
JsonNetFlowLogJSONToServer(jhl, js, f);
/* reset */
MemBufferReset(jhl->buffer);
- js = CreateJSONHeaderFromFlow(f, "netflow", 1); //TODO const
+ js = CreateJSONHeaderFromFlow(f, "netflow", 1);
if (unlikely(js == NULL))
return TM_ECODE_OK;
JsonNetFlowLogJSONToClient(jhl, js, f);
if (rs_nfs_tx_logging_is_filtered(nfstx))
return TM_ECODE_OK;
- js = CreateJSONHeader((Packet *)p, 0, "nfs");
+ js = CreateJSONHeader(p, 0, "nfs");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
SCEnter();
JsonEmailLogThread *jhl = (JsonEmailLogThread *)thread_data;
- json_t *sjs;
- json_t *js = CreateJSONHeaderWithTxId((Packet *)p, 1, "smtp", tx_id);
+ json_t *js = CreateJSONHeaderWithTxId(p, 1, "smtp", tx_id);
if (unlikely(js == NULL))
return TM_ECODE_OK;
JsonAddMetadata(p, f, js);
}
- sjs = JsonSmtpDataLogger(f, state, tx, tx_id);
+ json_t *sjs = JsonSmtpDataLogger(f, state, tx, tx_id);
if (sjs) {
json_object_set_new(js, "smtp", sjs);
}
}
if (ssh_state->cli_hdr.software_version == NULL ||
- ssh_state->srv_hdr.software_version == NULL)
+ ssh_state->srv_hdr.software_version == NULL)
return 0;
- json_t *js = CreateJSONHeader((Packet *)p, 1, "ssh");//TODO
+ json_t *js = CreateJSONHeader(p, 1, "ssh");
if (unlikely(js == NULL))
return 0;
{
TemplateTransaction *templatetx = tx;
LogTemplateLogThread *thread = thread_data;
- json_t *js, *templatejs;
SCLogNotice("Logging template transaction %"PRIu64".", templatetx->tx_id);
-
- js = CreateJSONHeader((Packet *)p, 0, "template");
+
+ json_t *js = CreateJSONHeader(p, 0, "template");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
- templatejs = json_object();
+ json_t *templatejs = json_object();
if (unlikely(templatejs == NULL)) {
goto error;
}
const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
{
LogTFTPLogThread *thread = thread_data;
- json_t *js, *tftpjs;
- js = CreateJSONHeader((Packet *)p, 0, "tftp");
+ json_t *js = CreateJSONHeader(p, 0, "tftp");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
- tftpjs = rs_tftp_log_json_request(tx);
+ json_t *tftpjs = rs_tftp_log_json_request(tx);
if (unlikely(tftpjs == NULL)) {
goto error;
}
return 0;
}
- json_t *js = CreateJSONHeader((Packet *)p, 1, "tls");
+ json_t *js = CreateJSONHeader(p, 1, "tls");
if (unlikely(js == NULL)) {
return 0;
}