Strophe 0.11
XMPP client library
Functions
Pseudo-random number generator

Functions

xmpp_rand_t * xmpp_rand_new (xmpp_ctx_t *ctx)
 Create new xmpp_rand_t object. More...
 
void xmpp_rand_free (xmpp_ctx_t *ctx, xmpp_rand_t *rand)
 Destroy an xmpp_rand_t object. More...
 
int xmpp_rand (xmpp_rand_t *rand)
 Generate random integer. More...
 
void xmpp_rand_bytes (xmpp_rand_t *rand, unsigned char *output, size_t len)
 Generate random bytes. More...
 
void xmpp_rand_nonce (xmpp_rand_t *rand, char *output, size_t len)
 Generate a nonce that is printable randomized string. More...
 

Detailed Description

Function Documentation

◆ xmpp_rand_new()

xmpp_rand_t * xmpp_rand_new ( xmpp_ctx_t *  ctx)

Create new xmpp_rand_t object.

Parameters
ctxA Strophe context object

◆ xmpp_rand_free()

void xmpp_rand_free ( xmpp_ctx_t *  ctx,
xmpp_rand_t *  rand 
)

Destroy an xmpp_rand_t object.

Parameters
ctxA Strophe context object

◆ xmpp_rand()

int xmpp_rand ( xmpp_rand_t *  rand)

Generate random integer.

Analogue of rand(3).

◆ xmpp_rand_bytes()

void xmpp_rand_bytes ( xmpp_rand_t *  rand,
unsigned char *  output,
size_t  len 
)

Generate random bytes.

Generates len bytes and stores them to the output buffer.

◆ xmpp_rand_nonce()

void xmpp_rand_nonce ( xmpp_rand_t *  rand,
char *  output,
size_t  len 
)

Generate a nonce that is printable randomized string.

This function doesn't allocate memory and doesn't fail.

Parameters
outputA buffer where a NULL-terminated string will be placed. The string will contain len-1 printable symbols.
lenNumber of bytes reserved for the output string, including end of line '\0'.