]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: htp_headers_t alias for htp_table_t
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 24 Jan 2025 16:46:33 +0000 (17:46 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 28 Jan 2025 08:32:43 +0000 (09:32 +0100)
In preparation of libhtp rust

src/app-layer-htp-libhtp.h
src/detect-http-header-names.c
src/detect-http-header.c
src/detect-http-start.c
src/output-json-http.c
src/util-lua-http.c

index fe94bb01b20f2194344f265d466d066ab6863a3b..8ae6dcccef73078852f77be2023e0e3aafde7438 100644 (file)
 #define htp_headers_get_index(headers, index) htp_table_get_index(headers, index, NULL)
 #define htp_tx_request_headers_size(tx)       htp_table_size(tx->request_headers)
 #define htp_tx_request_header_index(tx, i)    htp_table_get_index(tx->request_headers, i, NULL);
+#define htp_headers_t                         htp_table_t
 
 bstr *SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, bool uri_include_all);
 
index fa2f1c4be28b50143ff3dc3b4ea28cf1fea3faf3..6f0d30219536090ffe3614ade4f7cf1b599ebcde 100644 (file)
@@ -86,7 +86,7 @@ static uint8_t *GetBufferForTX(
         return NULL;
     }
 
-    htp_table_t *headers;
+    const htp_headers_t *headers;
     if (flags & STREAM_TOSERVER) {
         if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <=
                 HTP_REQUEST_PROGRESS_HEADERS)
index 14cfdc8703adae9e387865469acbb032683fcbe1..4c7d2fbc95932cf00a9ce766ec546ea9b5bc5846 100644 (file)
@@ -79,7 +79,7 @@ static uint8_t *GetBufferForTX(
         return NULL;
     }
 
-    htp_table_t *headers;
+    const htp_headers_t *headers;
     if (flags & STREAM_TOSERVER) {
         if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <=
                 HTP_REQUEST_PROGRESS_HEADERS)
@@ -552,7 +552,7 @@ static InspectionBuffer *GetHttp1HeaderData(DetectEngineThreadCtx *det_ctx,
     }
 
     htp_tx_t *tx = (htp_tx_t *)txv;
-    htp_table_t *headers;
+    const htp_headers_t *headers;
     if (flags & STREAM_TOSERVER) {
         headers = htp_tx_request_headers(tx);
     } else {
index 9d1c539e607d9d817497fe9898cbf2507fe68ba4..3f5920213d0e94824a87279e90523ae1f310c5c4 100644 (file)
@@ -86,7 +86,7 @@ static uint8_t *GetBufferForTX(
     }
 
     const bstr *line = NULL;
-    htp_table_t *headers;
+    const htp_headers_t *headers;
     if (flags & STREAM_TOSERVER) {
         if (AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP1, tx, flags) <=
                 HTP_REQUEST_PROGRESS_HEADERS)
index 1f39cec0a51c31d312d0dc53880e29a710e07ebf..0fa6414668e233efd9220b76ac6f0815da538f33 100644 (file)
@@ -314,8 +314,8 @@ static void EveHttpLogJSONExtended(JsonBuilder *js, htp_tx_t *tx)
 static void EveHttpLogJSONHeaders(
         JsonBuilder *js, uint32_t direction, htp_tx_t *tx, LogHttpFileCtx *http_ctx)
 {
-    htp_table_t *headers = direction & LOG_HTTP_REQ_HEADERS ? htp_tx_request_headers(tx)
-                                                            : htp_tx_response_headers(tx);
+    const htp_headers_t *headers = direction & LOG_HTTP_REQ_HEADERS ? htp_tx_request_headers(tx)
+                                                                    : htp_tx_response_headers(tx);
     char name[MAX_SIZE_HEADER_NAME] = {0};
     char value[MAX_SIZE_HEADER_VALUE] = {0};
     size_t n = htp_headers_size(headers);
index fc5622ddd391363a681ddbdbf980b75fea154e50..d4d056ad03424ed3ff170103b0d8612eb90662ba 100644 (file)
@@ -154,7 +154,7 @@ static int HttpGetHeader(lua_State *luastate, int dir)
     if (name == NULL)
         return LuaCallbackError(luastate, "1st argument missing, empty or wrong type");
 
-    htp_table_t *headers = htp_tx_request_headers(tx);
+    const htp_headers_t *headers = htp_tx_request_headers(tx);
     if (dir == 1)
         headers = htp_tx_response_headers(tx);
     if (headers == NULL)
@@ -223,7 +223,7 @@ static int HttpGetHeaders(lua_State *luastate, int dir)
     if (tx == NULL)
         return LuaCallbackError(luastate, "internal error: no tx");
 
-    htp_table_t *table = htp_tx_request_headers(tx);
+    const htp_headers_t *table = htp_tx_request_headers(tx);
     if (dir == 1)
         table = htp_tx_response_headers(tx);
     if (htp_tx_request_headers(tx) == NULL)