aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_main.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/ndpi_main.h b/src/include/ndpi_main.h
index a70f35c8d..7284f169e 100644
--- a/src/include/ndpi_main.h
+++ b/src/include/ndpi_main.h
@@ -32,6 +32,9 @@
#include "ndpi_protocols.h"
#include "ndpi_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
void *ndpi_tdelete(const void * __restrict, void ** __restrict,
int (*)(const void *, const void *));
@@ -107,4 +110,19 @@ void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *
const char **file, const char **func, u_int32_t * line);
#endif
+/** Checks when the @p payload starts with the string literal @p str.
+* When the string is larger than the payload, check fails.
+* @return non-zero if check succeeded
+*/
+int ndpi_match_prefix(const u_int8_t *payload, size_t payload_len,
+ const char *str, size_t str_len);
+
+/* version of ndpi_match_prefix with string literal */
+#define ndpi_match_strprefix(payload, payload_len, str) \
+ ndpi_match_prefix((payload), (payload_len), (str), (sizeof(str)-1))
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __NDPI_MAIN_H__ */