aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorVitaly Lavrov <vel21ripn@gmail.com>2024-02-05 21:44:45 +0300
committerGitHub <noreply@github.com>2024-02-05 19:44:45 +0100
commit4543385d107fcc5a7e8632e35d9a60bcc40cb4f4 (patch)
tree1832253db2bbfaef1949a879f3fe8a781977166f /src/include
parenta4da4467ace84aa7dba718a94b0714aeb101ed9a (diff)
Normalization of host_server_name (#2299)
* Normalization of host_server_name The ndpi_hostname_sni_set() function replaces all non-printable characters with the "?" character and removing whitespace characters at the end of the line. * Added conditional hostname normalization.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_private.h2
-rw-r--r--src/include/ndpi_typedefs.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/include/ndpi_private.h b/src/include/ndpi_private.h
index ad2b2e944..8e3104306 100644
--- a/src/include/ndpi_private.h
+++ b/src/include/ndpi_private.h
@@ -430,7 +430,7 @@ void change_category(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_protocol_category_t protocol_category);
-char *ndpi_hostname_sni_set(struct ndpi_flow_struct *flow, const u_int8_t *value, size_t value_len);
+char *ndpi_hostname_sni_set(struct ndpi_flow_struct *flow, const u_int8_t *value, size_t value_len, int normalize);
char *ndpi_user_agent_set(struct ndpi_flow_struct *flow, const u_int8_t *value, size_t value_len);
void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struct,
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index ee3128360..a5f9a8f50 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -263,6 +263,11 @@ typedef u_int32_t ndpi_ndpi_mask;
#define NDPI_NUM_FDS_BITS 16
#endif
+#define NDPI_HOSTNAME_NORM_LC 1
+#define NDPI_HOSTNAME_NORM_REPLACE_IC 2
+#define NDPI_HOSTNAME_NORM_STRIP_EOLSP 4
+#define NDPI_HOSTNAME_NORM_ALL (NDPI_HOSTNAME_NORM_LC | NDPI_HOSTNAME_NORM_REPLACE_IC | NDPI_HOSTNAME_NORM_STRIP_EOLSP)
+
typedef struct ndpi_protocol_bitmask_struct {
ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS];
} ndpi_protocol_bitmask_struct_t;