libwebsockets
Lightweight C library for HTML5 websockets
lws-fault-injection.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lws_xos
 

Macros

#define lws_fi(_fi_name, _fic)   (0)
 
#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)   (0)
 
#define lws_fi_user_context_fi(_wsi, _name)   (0)
 
#define lws_fi_user_ss_fi(_h, _name)   (0)
 
#define lws_fi_user_sspc_fi(_h, _name)   (0)
 

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)
 

Data Structure Documentation

◆ lws_xos

struct lws_xos

Definition at line 27 of file lws-fault-injection.h.

+ Collaboration diagram for lws_xos:
Data Fields
uint64_t s[4]

Macro Definition Documentation

◆ lws_fi

#define lws_fi (   _fi_name,
  _fic 
)    (0)

Definition at line 242 of file lws-fault-injection.h.

◆ lws_fi_destroy

#define lws_fi_destroy (   _x)

Definition at line 243 of file lws-fault-injection.h.

◆ lws_fi_inherit_copy

#define lws_fi_inherit_copy (   _a,
  _b,
  _c,
  _d 
)

Definition at line 244 of file lws-fault-injection.h.

◆ lws_fi_deserialize

#define lws_fi_deserialize (   _x,
  _y 
)

Definition at line 245 of file lws-fault-injection.h.

◆ lws_fi_user_wsi_fi

#define lws_fi_user_wsi_fi (   _wsi,
  _name 
)    (0)

Definition at line 246 of file lws-fault-injection.h.

◆ lws_fi_user_context_fi

#define lws_fi_user_context_fi (   _wsi,
  _name 
)    (0)

Definition at line 247 of file lws-fault-injection.h.

◆ lws_fi_user_ss_fi

#define lws_fi_user_ss_fi (   _h,
  _name 
)    (0)

Definition at line 248 of file lws-fault-injection.h.

◆ lws_fi_user_sspc_fi

#define lws_fi_user_sspc_fi (   _h,
  _name 
)    (0)

Definition at line 249 of file lws-fault-injection.h.

Typedef Documentation

◆ lws_xos_t

typedef struct lws_xos lws_xos_t

Function Documentation

◆ lws_xos_init()

LWS_VISIBLE LWS_EXTERN void lws_xos_init ( struct lws_xos xos,
uint64_t  seed 
)

lws_xos_init() - seed xoshiro256 PRNG

Parameters
xosthe prng state object to initialize
seedthe 64-bit seed

Initialize PRNG \xos with the starting state represented by seed

◆ lws_xos()

lws_xos() - get next xoshiro256 PRNG result and update state

Parameters
xosthe 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.

◆ lws_xos_percent()

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

Parameters
xosthe PRNG state to use
percentchance 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