summaryrefslogtreecommitdiff
path: root/src/sp_utils.h
diff options
context:
space:
mode:
authorxXx-caillou-xXx2018-07-13 10:36:50 +0200
committerjvoisin2018-07-13 08:36:50 +0000
commit7963580d72a358975133f86f01de2d2eab08ba38 (patch)
tree4bec345d70f687a2a6002b36e2f2fc79318959f6 /src/sp_utils.h
parent12b740bc7bb01ffe397cecc5b6fa25b136304911 (diff)
Massively optimize how rules are handled
This commit does a lot of things: - Use hashtables instead of lists to store the rules - Rules that can be applied at launch time won't be tried at runtime - Improve feedback when writing nonsensical rules - Make intensive use of `zend_string` instead of `char*`
Diffstat (limited to '')
-rw-r--r--src/sp_utils.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sp_utils.h b/src/sp_utils.h
index 61a23f9..a21a4b0 100644
--- a/src/sp_utils.h
+++ b/src/sp_utils.h
@@ -44,20 +44,20 @@
44 44
45void sp_log_msg(char const *feature, char const *level, const char *fmt, ...); 45void sp_log_msg(char const *feature, char const *level, const char *fmt, ...);
46int compute_hash(const char *const filename, char *file_hash); 46int compute_hash(const char *const filename, char *file_hash);
47char *sp_convert_to_string(zval *); 47const zend_string* sp_zval_to_zend_string(zval *);
48bool sp_match_value(const char *, const char *, const sp_pcre *); 48bool sp_match_value(const zend_string *, const zend_string *, const sp_pcre *);
49bool sp_match_array_key(const zval *, const char *, const sp_pcre *); 49bool sp_match_array_key(const zval *, const zend_string *, const sp_pcre *);
50bool sp_match_array_value(const zval *, const char *, const sp_pcre *); 50bool sp_match_array_value(const zval *, const zend_string *, const sp_pcre *);
51void sp_log_disable(const char *restrict, const char *restrict, 51void sp_log_disable(const char *restrict, const char *restrict,
52 const char *restrict, const sp_disabled_function *, 52 const zend_string *restrict, const sp_disabled_function *,
53 unsigned int, const char*restrict); 53 unsigned int, const char*restrict);
54void sp_log_disable_ret(const char *restrict, const char *restrict, 54void sp_log_disable_ret(const char *restrict, const zend_string *restrict,
55 const sp_disabled_function *); 55 const sp_disabled_function *);
56int hook_function(const char *, HashTable *, 56int hook_function(const char *, HashTable *,
57 void (*)(INTERNAL_FUNCTION_PARAMETERS)); 57 void (*)(INTERNAL_FUNCTION_PARAMETERS));
58int hook_regexp(const sp_pcre *, HashTable *, 58int hook_regexp(const sp_pcre *, HashTable *,
59 void (*)(INTERNAL_FUNCTION_PARAMETERS)); 59 void (*)(INTERNAL_FUNCTION_PARAMETERS));
60bool check_is_in_eval_whitelist(const char * const function_name); 60bool check_is_in_eval_whitelist(const zend_string * const function_name);
61int sp_log_request(const char* folder, const char* text_repr, char* from); 61int sp_log_request(const zend_string* folder, const zend_string* text_repr, char* from);
62 62
63#endif /* SP_UTILS_H */ 63#endif /* SP_UTILS_H */