libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Typedefs | Functions
SyncML Support
Low Level API Internals

Support functions used by libsyncml. More...

Collaboration diagram for SyncML Support:

## Data Structures

struct | SmlThreadFunctionContext

## Typedefs

typedef struct SmlThreadFunctionContext | SmlThreadFunctionContext

## Functions

char * | smlRandStr (int maxlength, SmlBool exact)
| Creates a random string.
void * | smlTryMalloc0 (long n_bytes, SmlError **error)
| Safely mallocs.
const char * | smlGetVersion (void)
| Gets the version of libsyncml as string.
SmlThread * | smlThreadNew (GMainContext *context, SmlError **error)
void | smlThreadFree (SmlThread *thread)
void | smlThreadStart (SmlThread *thread)
void | smlThreadStop (SmlThread *thread)
gboolean | smlThreadCallFunctionCallback (gpointer data)
SmlBool | smlThreadCallFunction (SmlThread *thread, SmlThreadCallFunctionType func, gpointer data, SmlError **error)
void | smlSafeFree (gpointer *address)
void | smlSafeCFree (char **address)
const char * | smlGetLibraryVersion ()
const char * | smlGetLibrarySoName ()

## Detailed Description

Support functions used by libsyncml.

## Typedef Documentation

typedef struct SmlThreadFunctionContext SmlThreadFunctionContext

This context is used to cache the environment for direct function calls within a special thread. Please see smlThreadCallFunction for more details.

## Function Documentation

char* smlRandStr | ( | int | maxlength,
|  | SmlBool | exact
| ) |  |

Creates a random string.

Creates a random string of given length or less

Parameters:

  maxlength | The maximum length of the string

Returns:
  The random string

Definition at line 302 of file sml_support.c.

void* smlTryMalloc0 | ( | long | n_bytes,
|  | SmlError ** | error
| ) |  |

Safely mallocs.

Mallocs or returns an error if OOM

Parameters:

  n_bytes | The size in bytes to malloc
  error | Pointer to a error struct

Returns:
  The newly allocated memory or NULL in case of error

Definition at line 335 of file sml_support.c.

Referenced by smlAssemblerNew(), smlManagerObjectRegister(), smlParserNew(), smlQueueNew(), smlSessionEnd(), smlSessionEndCommand(), smlSessionFlush(), smlSessionNew(), smlSessionSendReply(), smlSessionStartCommand(), smlThreadCallFunction(), smlTransportNew(), and smlXmlAssemblerNew().

Here is the call graph for this function:

const char* smlGetVersion | ( | void |  | ) |

Gets the version of libsyncml as string.

Returns:
  The version as const string

Version:
  $Id$

Definition at line 364 of file sml_support.c.

gboolean smlThreadCallFunctionCallback | ( | gpointer | data | ) |

This callback is used to call a function within a special thread. Please see smlThreadCallFunction for more details.

Definition at line 534 of file sml_support.c.

Referenced by smlThreadCallFunction().

Here is the call graph for this function:

SmlBool smlThreadCallFunction | ( | SmlThread * | thread,
|  | SmlThreadCallFunctionType | func,
|  | gpointer | data,
|  | SmlError ** | error
| ) |  |

This function can be used to execute a function in a special thread. Some libraries are designed for single-threaded applications. They require that a set of commands is only executed in one thread. These applications use g_main_loop too. So the functions must be executed in this loop. This will be done synchronously by this function.

Please note: This function is blocking. Please note: The glib source priority is IDLE.

Definition at line 561 of file sml_support.c.

Referenced by smlTransportFinalize().

Here is the call graph for this function: