From 4874d5abbbed4403c7d29e468a91c2ab3e988ed2 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 29 Jan 2014 11:32:10 +0100 Subject: [PATCH] Various compile fixes after rebase with master --- src/output-dnslog.c | 18 +++++++++--------- src/output-httplog.c | 18 +++++++++--------- src/output-json.c | 10 +++++----- src/output-tlslog.c | 8 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/output-dnslog.c b/src/output-dnslog.c index 0cbddfcedf..ea2b352e7c 100644 --- a/src/output-dnslog.c +++ b/src/output-dnslog.c @@ -38,7 +38,7 @@ #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" @@ -212,20 +212,20 @@ static TmEcode DnsJsonIPWrapper(ThreadVars *tv, Packet *p, void *data, /* 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); @@ -248,7 +248,7 @@ static TmEcode DnsJsonIPWrapper(ThreadVars *tv, Packet *p, void *data, 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; @@ -260,7 +260,7 @@ static TmEcode DnsJsonIPWrapper(ThreadVars *tv, Packet *p, void *data, LogAnswers(aft, js, tx); SCLogDebug("calling AppLayerTransactionUpdateLoggedId"); - AppLayerTransactionUpdateLogId(ALPROTO_DNS_UDP, p->flow); + AppLayerParserSetTransactionLogId(p->flow->alparser); } } json_decref(js); diff --git a/src/output-httplog.c b/src/output-httplog.c index c7132550c7..228c88b677 100644 --- a/src/output-httplog.c +++ b/src/output-httplog.c @@ -240,20 +240,20 @@ static TmEcode HttpJsonIPWrapper(ThreadVars *tv, Packet *p, void *data) /* 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)) @@ -267,12 +267,12 @@ static TmEcode HttpJsonIPWrapper(ThreadVars *tv, Packet *p, void *data) 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; } @@ -295,7 +295,7 @@ static TmEcode HttpJsonIPWrapper(ThreadVars *tv, Packet *p, void *data) 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); diff --git a/src/output-json.c b/src/output-json.c index d98bdc01b5..f864270716 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -52,7 +52,7 @@ #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" @@ -662,8 +662,8 @@ OutputCtx *OutputJsonInitCtx(ConfNode *conf) } 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; } @@ -683,7 +683,7 @@ OutputCtx *OutputJsonInitCtx(ConfNode *conf) 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; } @@ -691,7 +691,7 @@ OutputCtx *OutputJsonInitCtx(ConfNode *conf) 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; } diff --git a/src/output-tlslog.c b/src/output-tlslog.c index 660fc4c2c0..4a67b67424 100644 --- a/src/output-tlslog.c +++ b/src/output-tlslog.c @@ -37,7 +37,7 @@ #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" @@ -118,11 +118,11 @@ static TmEcode LogTlsLogIPWrapperJSON(ThreadVars *tv, Packet *p, void *data) /* 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; @@ -131,7 +131,7 @@ static TmEcode LogTlsLogIPWrapperJSON(ThreadVars *tv, Packet *p, void *data) 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);