diff options
author | Stefan Fritsch <sf@apache.org> | 2011-09-15 21:53:59 +0200 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2011-09-15 21:53:59 +0200 |
commit | 2d4e23d88b52302bada92e581bd48e9f993e2df6 (patch) | |
tree | d3d5ef0d76c876f3ebc69dae5a27500693395394 /include/httpd.h | |
parent | - start definitive list of modules not to be included in 2.4 (diff) | |
download | apache2-2d4e23d88b52302bada92e581bd48e9f993e2df6.tar.xz apache2-2d4e23d88b52302bada92e581bd48e9f993e2df6.zip |
Create wrapper API for apr_random;
use in mod_lbmethod_heartbeat and mod_serf to
- replace some needles use of apr_generate_random_bytes
- remove code duplication
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1171247 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/httpd.h')
-rw-r--r-- | include/httpd.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/httpd.h b/include/httpd.h index a9b82a2f6c..d009e68d31 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -2067,6 +2067,26 @@ AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c); #endif +/** + * Generate pseudo random bytes. + * This is a convenience interface to apr_random. It is cheaper but less + * secure than apr_generate_random_bytes(). + * @param buf where to store the bytes + * @param size number of bytes to generate + * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on + * threaded MPMs. + */ +APR_DECLARE(void) ap_random_insecure_bytes(void *buf, apr_size_t size); + +/** + * Get a pseudo random number in a range. + * @param min low end of range + * @param max high end of range + * @return a number in the range + */ +APR_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max); + + #define AP_NORESTART APR_OS_START_USEERR + 1 #ifdef __cplusplus |