#include "util-debug.h"
#include "util-mem.h"
-
+#include "app-layer-parser.h"
#include "output.h"
#include "output-dnslog.h"
#include "app-layer-dns-udp.h"
/* check if we have DNS state or not */
FLOWLOCK_WRLOCK(p->flow); /* WRITE lock before we updated flow logged id */
- uint16_t proto = AppLayerGetProtoFromPacket(p);
- if (proto != ALPROTO_DNS_UDP && proto != ALPROTO_DNS_TCP) {
- SCLogDebug("proto not ALPROTO_DNS_UDP: %u", proto);
+ uint16_t proto = FlowGetAppProtocol(p->flow);
+ if (proto != ALPROTO_DNS) {
+ SCLogDebug("proto not ALPROTO_DNS: %u", proto);
goto end;
}
- DNSState *dns_state = (DNSState *)AppLayerGetProtoStateFromPacket(p);
+ DNSState *dns_state = (DNSState *)FlowGetAppState(p->flow);
if (dns_state == NULL) {
SCLogDebug("no dns state, so no request logging");
goto end;
}
- uint64_t total_txs = AppLayerGetTxCnt(proto, dns_state);
- uint64_t tx_id = AppLayerTransactionGetLogId(p->flow);
+ uint64_t total_txs = AppLayerParserGetTxCnt(p->proto, proto, dns_state);
+ uint64_t tx_id = AppLayerParserGetTransactionLogId(p->flow->alparser);
//int tx_progress_done_value_ts = AppLayerGetAlstateProgressCompletionStatus(proto, 0);
//int tx_progress_done_value_tc = AppLayerGetAlstateProgressCompletionStatus(proto, 1);
DNSTransaction *tx = NULL;
for (; tx_id < total_txs; tx_id++)
{
- tx = AppLayerGetTx(proto, dns_state, tx_id);
+ tx = AppLayerParserGetTx(p->proto, proto, dns_state, tx_id);
if (tx == NULL)
continue;
LogAnswers(aft, js, tx);
SCLogDebug("calling AppLayerTransactionUpdateLoggedId");
- AppLayerTransactionUpdateLogId(ALPROTO_DNS_UDP, p->flow);
+ AppLayerParserSetTransactionLogId(p->flow->alparser);
}
}
json_decref(js);
/* check if we have HTTP state or not */
FLOWLOCK_WRLOCK(p->flow); /* WRITE lock before we updated flow logged id */
- uint16_t proto = AppLayerGetProtoFromPacket(p);
+ uint16_t proto = FlowGetAppProtocol(p->flow);
if (proto != ALPROTO_HTTP)
goto end;
- htp_state = (HtpState *)AppLayerGetProtoStateFromPacket(p);
+ htp_state = (HtpState *)FlowGetAppState(p->flow);
if (htp_state == NULL) {
SCLogDebug("no http state, so no request logging");
goto end;
}
total_txs = AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state);
- tx_id = AppLayerTransactionGetLogId(p->flow);
- tx_progress_done_value_ts = AppLayerGetAlstateProgressCompletionStatus(ALPROTO_HTTP, 0);
- tx_progress_done_value_tc = AppLayerGetAlstateProgressCompletionStatus(ALPROTO_HTTP, 1);
+ tx_id = AppLayerParserGetTransactionLogId(p->flow->alparser);
+ tx_progress_done_value_ts = AppLayerParserGetStateProgressCompletionStatus(p->proto, ALPROTO_HTTP, 0);
+ tx_progress_done_value_tc = AppLayerParserGetStateProgressCompletionStatus(p->proto, ALPROTO_HTTP, 1);
json_t *js = CreateJSONHeader(p, 1);
if (unlikely(js == NULL))
continue;
}
- if (!(((AppLayerParserStateStore *)p->flow->alparser)->id_flags & APP_LAYER_TRANSACTION_EOF)) {
- tx_progress = AppLayerGetAlstateProgress(ALPROTO_HTTP, tx, 0);
+ if (!(AppLayerParserStateIssetFlag(p->flow->alparser, APP_LAYER_PARSER_EOF))) {
+ tx_progress = AppLayerParserGetStateProgress(p->proto, ALPROTO_HTTP, tx, 0);
if (tx_progress < tx_progress_done_value_ts)
break;
- tx_progress = AppLayerGetAlstateProgress(ALPROTO_HTTP, tx, 1);
+ tx_progress = AppLayerParserGetStateProgress(p->proto, ALPROTO_HTTP, tx, 1);
if (tx_progress < tx_progress_done_value_tc)
break;
}
OutputJSON(js, aft, &aft->http_cnt);
json_object_del(js, "http");
- AppLayerTransactionUpdateLogId(ALPROTO_HTTP, p->flow);
+ AppLayerParserSetTransactionLogId(p->flow->alparser);
}
json_object_clear(js);
json_decref(js);
#include "output-droplog.h"
#include "output-httplog.h"
#include "output-tlslog.h"
-#include "output-file.h"
+#include "output-json-file.h"
#include "output-json.h"
#include "util-byte.h"
}
if (strcmp(output->val, "dns") == 0) {
SCLogDebug("Enabling DNS output");
- AppLayerRegisterLogger(ALPROTO_DNS_UDP);
- AppLayerRegisterLogger(ALPROTO_DNS_TCP);
+ AppLayerParserRegisterLogger(IPPROTO_TCP,ALPROTO_DNS);
+ AppLayerParserRegisterLogger(IPPROTO_UDP,ALPROTO_DNS);
output_flags |= OUTPUT_DNS;
continue;
}
SCLogDebug("Enabling HTTP output");
ConfNode *child = ConfNodeLookupChild(output, "http");
json_ctx->http_ctx = OutputHttpLogInit(child);
- AppLayerRegisterLogger(ALPROTO_HTTP);
+ AppLayerParserRegisterLogger(IPPROTO_TCP,ALPROTO_HTTP);
output_flags |= OUTPUT_HTTP;
continue;
}
SCLogDebug("Enabling TLS output");
ConfNode *child = ConfNodeLookupChild(output, "tls");
json_ctx->tls_ctx = OutputTlsLogInit(child);
- AppLayerRegisterLogger(ALPROTO_TLS);
+ AppLayerParserRegisterLogger(IPPROTO_TCP,ALPROTO_TLS);
output_flags |= OUTPUT_TLS;
continue;
}
#include "util-unittest.h"
#include "util-debug.h"
-
+#include "app-layer-parser.h"
#include "output.h"
#include "log-tlslog.h"
#include "app-layer-ssl.h"
/* check if we have TLS state or not */
FLOWLOCK_WRLOCK(p->flow);
- uint16_t proto = AppLayerGetProtoFromPacket(p);
+ uint16_t proto = FlowGetAppProtocol(p->flow);
if (proto != ALPROTO_TLS)
goto end;
- SSLState *ssl_state = (SSLState *) AppLayerGetProtoStateFromPacket(p);
+ SSLState *ssl_state = (SSLState *) FlowGetAppState(p->flow);
if (ssl_state == NULL) {
SCLogDebug("no tls state, so no request logging");
goto end;
if (ssl_state->server_connp.cert0_issuerdn == NULL || ssl_state->server_connp.cert0_subject == NULL)
goto end;
- if (AppLayerTransactionGetLogId(p->flow) != 0)
+ if (AppLayerParserGetTransactionLogId(p->flow->alparser) != 0)
goto end;
json_t *js = CreateJSONHeader(p, 0);