]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4979: http_inspect: rename request and response buffers
authorAdrian Mamolea (admamole) <admamole@cisco.com>
Fri, 7 Nov 2025 03:04:00 +0000 (03:04 +0000)
committerRayen Mohanty (ramohant) <ramohant@cisco.com>
Fri, 7 Nov 2025 03:04:00 +0000 (03:04 +0000)
Merge in SNORT/snort3 from ~ADMAMOLE/snort3:rename_fields to master

Squashed commit of the following:

commit 6d5aa070aea3445990211f5e2d20d776180f438b
Author: Adrian Mamolea <admamole@cisco.com>
Date:   Wed Nov 5 12:04:55 2025 -0500

    http_inspect: rename request and response buffers

src/log/unified2.h
src/loggers/unified2.cc
src/service_inspectors/http_inspect/http_api.h
src/service_inspectors/http_inspect/http_enum.h
src/service_inspectors/http_inspect/http_msg_section.cc
src/service_inspectors/http_inspect/http_msg_section.h
tools/u2spewfoo/u2spewfoo.cc

index 4db3822c9d8479a551496a1033b032e3f4d50b51..ab8b780fd3d813fb63c33bc30987bc29417134cf 100644 (file)
@@ -96,8 +96,8 @@ struct Unified2Event
 
     char app_name[MAX_EVENT_APPNAME_LEN];
 
-    uint32_t request_size;
-    uint32_t response_size;
+    uint32_t http_request_size;
+    uint32_t http_response_size;
 
     char http_method[MAX_HTTP_METHOD_LEN];
     char http_version[MAX_HTTP_VERSION_LEN];
index 5caf1219916c4bd1dc1879d1ce5f37a34e50bb33..2ca3849308c7af33d788488c152bd3b805f9a0bd 100644 (file)
@@ -242,11 +242,11 @@ static void alert_event(Packet* p, const char*, Unified2Config* config, const Ev
                 strncpy(u2_event.http_method,
                     reinterpret_cast<const char*>(buf.data), MAX_HTTP_METHOD_LEN - 1);
 
-            if ( gadget->get_buf("request_size", p, buf) )
-                u2_event.request_size = htonl(*reinterpret_cast<const uint32_t*>(buf.data));
+            if ( gadget->get_buf("http_request_size", p, buf) )
+                u2_event.http_request_size = htonl(*reinterpret_cast<const uint32_t*>(buf.data));
 
-            if ( gadget->get_buf("response_size", p, buf) )
-                u2_event.response_size = htonl(*reinterpret_cast<const uint32_t*>(buf.data));
+            if ( gadget->get_buf("http_response_size", p, buf) )
+                u2_event.http_response_size = htonl(*reinterpret_cast<const uint32_t*>(buf.data));
 
             if ( gadget->get_buf("http_version_str", p, buf) )
                 strncpy(u2_event.http_version,
index b0e015e7ce34feab2b68f3dd80c838cf604294db..1d0d7a132ef391407463356202068f197b3f5c87 100644 (file)
@@ -49,8 +49,8 @@
     "js_data",                    \
     "vba_data",                   \
     "http_method_str",            \
-    "request_size",               \
-    "response_size",              \
+    "http_request_size",          \
+    "http_response_size",         \
     "http_version_str",           \
     "http_user_agent_str",        \
     "http_referer_str",           \
index 1a18a498266e42d52aa88267abf66bd0e037c95f..1f384b149e706a04621e68280120a7fa68c625dc 100755 (executable)
@@ -56,7 +56,7 @@ enum HTTP_RULE_OPT { HTTP_BUFFER_CLIENT_BODY = 2, HTTP_BUFFER_COOKIE, HTTP_BUFFE
     HTTP_BUFFER_RAW_TRAILER, HTTP_BUFFER_RAW_URI, HTTP_BUFFER_STAT_CODE, HTTP_BUFFER_STAT_MSG,
     HTTP_BUFFER_TRAILER, HTTP_BUFFER_TRUE_IP, HTTP_BUFFER_URI, HTTP_BUFFER_VERSION,
     BUFFER_JS_DATA, BUFFER_VBA_DATA, HTTP__BUFFER_MAX = BUFFER_VBA_DATA,
-    HTTP_BUFFER_METHOD_STR, BUFFER_REQUEST_SIZE, BUFFER_RESPONSE_SIZE, 
+    HTTP_BUFFER_METHOD_STR, HTTP_BUFFER_REQUEST_SIZE, HTTP_BUFFER_RESPONSE_SIZE, 
     HTTP_BUFFER_VERSION_STR, HTTP_BUFFER_USER_AGENT_STR, HTTP_BUFFER_REFERER_STR,
     DETAIL_119_20, DETAIL_119_287,
     HTTP__TMP_BUFFER_MAX = DETAIL_119_287,
index b31571d95c484cb0c357f58dd091ec2a3a72be45..320b933cbccb8974d9b644a5eb72c0c5a36ed768 100644 (file)
@@ -128,7 +128,7 @@ Field* HttpMsgSection::compute_http_method_str(const HttpBufferInfo&)
     return tmp_field(get_classic_buffer(HTTP_BUFFER_METHOD, 0, 0));
 }
 
-Field* HttpMsgSection::compute_request_size(const HttpBufferInfo&)
+Field* HttpMsgSection::compute_http_request_size(const HttpBufferInfo&)
 {
     uint32_t val = 0;
     val += get_section_len(request);
@@ -138,7 +138,7 @@ Field* HttpMsgSection::compute_request_size(const HttpBufferInfo&)
     return tmp_field(val);
 }
 
-Field* HttpMsgSection::compute_response_size(const HttpBufferInfo&)
+Field* HttpMsgSection::compute_http_response_size(const HttpBufferInfo&)
 {
     uint32_t val = 0;
     val += get_section_len(status);
@@ -212,8 +212,8 @@ const Field& HttpMsgSection::get_tmp_buffer(const HttpBufferInfo& buf)
 
     static const ComputeFunction compute_functions[TMP_BUFFER_CNT] = {
         &HttpMsgSection::compute_http_method_str,       // HTTP_BUFFER_METHOD_STR
-        &HttpMsgSection::compute_request_size,          // BUFFER_REQUEST_SIZE
-        &HttpMsgSection::compute_response_size,         // BUFFER_RESPONSE_SIZE
+        &HttpMsgSection::compute_http_request_size,     // HTTP_BUFFER_REQUEST_SIZE
+        &HttpMsgSection::compute_http_response_size,    // HTTP_BUFFER_RESPONSE_SIZE
         &HttpMsgSection::compute_http_version_str,      // HTTP_BUFFER_VERSION_STR
         &HttpMsgSection::compute_http_user_agent_str,   // HTTP_BUFFER_USER_AGENT_STR
         &HttpMsgSection::compute_http_referer_str,      // HTTP_BUFFER_REFERER_STR
index 442a5543e3eb0c2578776c68e27d37135e470f6e..b5472ec468940c875480ebfef5564e5ba1978f53 100644 (file)
@@ -146,8 +146,8 @@ protected:
 private:
     const Field& get_tmp_buffer(const HttpBufferInfo& buf);
     Field* compute_http_method_str(const HttpBufferInfo& buf);
-    Field* compute_request_size(const HttpBufferInfo& buf);
-    Field* compute_response_size(const HttpBufferInfo& buf);
+    Field* compute_http_request_size(const HttpBufferInfo& buf);
+    Field* compute_http_response_size(const HttpBufferInfo& buf);
     Field* compute_http_version_str(const HttpBufferInfo& buf);
     Field* compute_http_user_agent_str(const HttpBufferInfo& buf);
     Field* compute_http_referer_str(const HttpBufferInfo& buf);
index d3915d952ce5bd1e2cc11a2f8e650e5743811eac..e13f134d447b1be1dbe10334ca39afbd934589a8 100644 (file)
@@ -351,10 +351,10 @@ static void event3_dump(u2record* record)
 
     if (event.http_method[0])
         printf("\tHTTP Method: %s\n", event.http_method);
-    if (event.request_size)
-        printf("\tRequest Size: %u\n", htonl(event.request_size));
-    if (event.response_size)
-        printf("\tResponse Size: %u\n", htonl(event.response_size));
+    if (event.http_request_size)
+        printf("\tHTTP Request Size: %u\n", htonl(event.http_request_size));
+    if (event.http_response_size)
+        printf("\tHTTP Response Size: %u\n", htonl(event.http_response_size));
     if (event.http_version[0])
         printf("\tHTTP Version: %s\n", event.http_version);
     if (event.http_user_agent[0])