Strophe 0.13 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.
void * | xmpp_realloc (const xmpp_ctx_t *ctx, void *p, size_t size)
| Reallocate memory in a Strophe context.
char * | xmpp_strdup (const xmpp_ctx_t *ctx, const char *s)
| implement our own strdup that uses the ctx allocator
char * | xmpp_strndup (const xmpp_ctx_t *ctx, const char *s, size_t len)
| Duplicate a string with a maximum length.
void | xmpp_error (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
| Write to the log at the ERROR level.
void | xmpp_warn (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
| Write to the log at the WARN level.
void | xmpp_info (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
| Write to the log at the INFO level.
void | xmpp_debug (const xmpp_ctx_t *ctx, const char *area, const char *fmt,...)
| Write to the log at the DEBUG level.
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.
char * | xmpp_strtok_r (char *s, const char *delim, char **saveptr)
| strtok_r(3) implementation.
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.
void | xmpp_conn_disable_tls (xmpp_conn_t *conn)
| Disable TLS for this connection, called by users of the library.

## 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

  ctx | a Strophe context object
  size | the 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

  ctx | a Strophe context object
  p | a pointer to previously allocated memory
  size | the 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

  ctx | a Strophe context object
  s | a 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

  ctx | a Strophe context object
  s | a string
  len | the 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

  ctx | a Strophe context object
  area | the area to log for
  fmt | a 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

  ctx | a Strophe context object
  area | the area to log for
  fmt | a 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

  ctx | a Strophe context object
  area | the area to log for
  fmt | a 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

  ctx | a Strophe context object
  area | the area to log for
  fmt | a 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

  level | the verbosity level
  ctx | a Strophe context object
  area | the area to log for
  fmt | a 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

  conn | a Strophe connection object
  timeout | TCP keepalive timeout in seconds
  interval | TCP keepalive interval in seconds

Note
  this function is deprecated

See also
  xmpp_conn_set_sockopt_callback()

## ◆ xmpp_conn_disable_tls()

void xmpp_conn_disable_tls | ( | xmpp_conn_t * | conn | ) |

Disable TLS for this connection, called by users of the library.

Occasionally a server will be misconfigured to send the starttls feature, but will not support the handshake.

Parameters

  conn | a Strophe connection object

Note
  this function is deprecated

See also
  xmpp_conn_set_flags()