|
libwebsockets
Lightweight C library for HTML5 websockets
|
#include <lws-fault-injection.h>
Go to the source code of this file.
Data Structures | |
| struct | lws_xos |
Macros | |
| #define | lws_fi(_fi_name, _fic) |
| #define | lws_fi_destroy(_x) |
| #define | lws_fi_inherit_copy(_a, _b, _c, _d) |
| #define | lws_fi_deserialize(_x, _y) |
| #define | lws_fi_user_wsi_fi(_wsi, _name) |
| #define | lws_fi_user_context_fi(_wsi, _name) |
| #define | lws_fi_user_ss_fi(_h, _name) |
| #define | lws_fi_user_sspc_fi(_h, _name) |
Typedefs | |
| typedef struct lws_xos | lws_xos_t |
Functions | |
| LWS_VISIBLE LWS_EXTERN void | lws_xos_init (struct lws_xos *xos, uint64_t seed) |
| LWS_VISIBLE LWS_EXTERN uint64_t LWS_WARN_UNUSED_RESULT | lws_xos (struct lws_xos *xos) |
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT | lws_xos_percent (struct lws_xos *xos, int percent) |
| struct lws_xos |
Definition at line 27 of file lws-fault-injection.h.
| Data Fields | ||
|---|---|---|
| uint64_t | s[4] | |
| #define lws_fi | ( | _fi_name, | |
| _fic ) |
Definition at line 267 of file lws-fault-injection.h.
| #define lws_fi_destroy | ( | _x | ) |
Definition at line 268 of file lws-fault-injection.h.
| #define lws_fi_inherit_copy | ( | _a, | |
| _b, | |||
| _c, | |||
| _d ) |
Definition at line 269 of file lws-fault-injection.h.
| #define lws_fi_deserialize | ( | _x, | |
| _y ) |
Definition at line 270 of file lws-fault-injection.h.
| #define lws_fi_user_wsi_fi | ( | _wsi, | |
| _name ) |
Definition at line 271 of file lws-fault-injection.h.
| #define lws_fi_user_context_fi | ( | _wsi, | |
| _name ) |
Definition at line 272 of file lws-fault-injection.h.
| #define lws_fi_user_ss_fi | ( | _h, | |
| _name ) |
Definition at line 273 of file lws-fault-injection.h.
| #define lws_fi_user_sspc_fi | ( | _h, | |
| _name ) |
Definition at line 274 of file lws-fault-injection.h.
| LWS_VISIBLE LWS_EXTERN void lws_xos_init | ( | struct lws_xos * | xos, |
| uint64_t | seed ) |
lws_xos_init() - seed xoshiro256 PRNG
| xos | the prng state object to initialize |
| seed | the 64-bit seed |
Initialize PRNG \xos with the starting state represented by seed
References LWS_EXTERN, LWS_VISIBLE, and LWS_WARN_UNUSED_RESULT.
| LWS_VISIBLE LWS_EXTERN uint64_t LWS_WARN_UNUSED_RESULT lws_xos | ( | struct lws_xos * | xos | ) |
lws_xos() - get next xoshiro256 PRNG result and update state
| xos | the PRNG state to use |
Returns next 64-bit PRNG result. These are cheap to get, quite a white noise sequence, and completely deterministic according to the seed it was initialized with.
References LWS_EXTERN, LWS_VISIBLE, and LWS_WARN_UNUSED_RESULT.
| LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_xos_percent | ( | struct lws_xos * | xos, |
| int | percent ) |
lws_xos_percent() - return 1 a given percent of the time on average
| xos | the PRNG state to use |
| percent | chance in 100 of returning 1 |
Returns 1 if next random % 100 is < percent, such that 100 always returns 1, 0 never returns 1, and the chance linearly scales inbetween