Strophe 0.12
XMPP client library
Functions
All deprecated functions

These functions will be removed in the next release. More...

Functions

void * xmpp_alloc (const xmpp_ctx_t *ctx, size_t size)
 Allocate memory in a Strophe context. More...
 
void * xmpp_realloc (const xmpp_ctx_t *ctx, void *p, size_t size)
 Reallocate memory in a Strophe context. More...
 
char * xmpp_strdup (const xmpp_ctx_t *ctx, const char *s)
 implement our own strdup that uses the ctx allocator More...
 
char * xmpp_strndup (const xmpp_ctx_t *ctx, const char *s, size_t len)
 Duplicate a string with a maximum length. More...
 
void xmpp_error (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the ERROR level. More...
 
void xmpp_warn (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the WARN level. More...
 
void xmpp_info (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the INFO level. More...
 
void xmpp_debug (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the DEBUG level. More...
 
void xmpp_debug_verbose (int level, const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
 Write to the log at the DEBUG level if verbosity is enabled. More...
 
char * xmpp_strtok_r (char *s, const char *delim, char **saveptr)
 strtok_r(3) implementation. More...
 
void xmpp_conn_set_keepalive (xmpp_conn_t *conn, int timeout, int interval)
 Set TCP keepalive parameters Turn on TCP keepalive and set timeout and interval. More...
 

Detailed Description

These functions will be removed in the next release.

Function Documentation

◆ xmpp_alloc()

void * xmpp_alloc ( const xmpp_ctx_t *  ctx,
size_t  size 
)

Allocate memory in a Strophe context.

All Strophe functions will use this to allocate memory.

Parameters
ctxa Strophe context object
sizethe number of bytes to allocate
Returns
a pointer to the allocated memory or NULL on an error

◆ xmpp_realloc()

void * xmpp_realloc ( const xmpp_ctx_t *  ctx,
void *  p,
size_t  size 
)

Reallocate memory in a Strophe context.

All Strophe functions will use this to reallocate memory.

Parameters
ctxa Strophe context object
pa pointer to previously allocated memory
sizethe new size in bytes to allocate
Returns
a pointer to the reallocated memory or NULL on an error

◆ xmpp_strdup()

char * xmpp_strdup ( const xmpp_ctx_t *  ctx,
const char *  s 
)

implement our own strdup that uses the ctx allocator

Duplicate a string. This function replaces the standard strdup library call with a version that uses the Strophe context object's allocator.

Parameters
ctxa Strophe context object
sa string
Returns
a newly allocated string with the same data as s or NULL on error

◆ xmpp_strndup()

char * xmpp_strndup ( const xmpp_ctx_t *  ctx,
const char *  s,
size_t  len 
)

Duplicate a string with a maximum length.

This function replaces the standard strndup library call with a version that uses the Strophe context object's allocator.

Parameters
ctxa Strophe context object
sa string
lenthe maximum length of the string to copy
Returns
a newly allocated string that contains at most len symbols of the original string or NULL on error

◆ xmpp_error()

void xmpp_error ( const xmpp_ctx_t *  ctx,
const char *  area,
const char *  fmt,
  ... 
)

Write to the log at the ERROR level.

This is a convenience function for writing to the log at the ERROR level. It takes a printf-style format string followed by a variable list of arguments for formatting.

Parameters
ctxa Strophe context object
areathe area to log for
fmta printf-style format string followed by a variable list of arguments to format

◆ xmpp_warn()

void xmpp_warn ( const xmpp_ctx_t *  ctx,
const char *  area,
const char *  fmt,
  ... 
)

Write to the log at the WARN level.

This is a convenience function for writing to the log at the WARN level. It takes a printf-style format string followed by a variable list of arguments for formatting.

Parameters
ctxa Strophe context object
areathe area to log for
fmta printf-style format string followed by a variable list of arguments to format

◆ xmpp_info()

void xmpp_info ( const xmpp_ctx_t *  ctx,
const char *  area,
const char *  fmt,
  ... 
)

Write to the log at the INFO level.

This is a convenience function for writing to the log at the INFO level. It takes a printf-style format string followed by a variable list of arguments for formatting.

Parameters
ctxa Strophe context object
areathe area to log for
fmta printf-style format string followed by a variable list of arguments to format

◆ xmpp_debug()

void xmpp_debug ( const xmpp_ctx_t *  ctx,
const char *  area,
const char *  fmt,
  ... 
)

Write to the log at the DEBUG level.

This is a convenience function for writing to the log at the DEBUG level. It takes a printf-style format string followed by a variable list of arguments for formatting.

Parameters
ctxa Strophe context object
areathe area to log for
fmta printf-style format string followed by a variable list of arguments to format

◆ xmpp_debug_verbose()

void xmpp_debug_verbose ( int  level,
const xmpp_ctx_t *  ctx,
const char *  area,
const char *  fmt,
  ... 
)

Write to the log at the DEBUG level if verbosity is enabled.

This is a convenience function for writing to the log at the DEBUG level. It takes a printf-style format string followed by a variable list of arguments for formatting.

Parameters
levelthe verbosity level
ctxa Strophe context object
areathe area to log for
fmta printf-style format string followed by a variable list of arguments to format

◆ xmpp_strtok_r()

char * xmpp_strtok_r ( char *  s,
const char *  delim,
char **  saveptr 
)

strtok_r(3) implementation.

This function has appeared in POSIX.1-2001, but not in C standard. For example, visual studio older than 2005 doesn't provide strtok_r() nor strtok_s().

◆ xmpp_conn_set_keepalive()

void xmpp_conn_set_keepalive ( xmpp_conn_t *  conn,
int  timeout,
int  interval 
)

Set TCP keepalive parameters Turn on TCP keepalive and set timeout and interval.

Zero timeout disables TCP keepalives. The parameters are applied immediately for a non disconnected object. Also, they are applied when the connection object connects successfully.

Parameters
conna Strophe connection object
timeoutTCP keepalive timeout in seconds
intervalTCP keepalive interval in seconds
Note
this function is deprecated
See also
xmpp_conn_set_sockopt_callback()