su_glib.docs 1.57 KB
Newer Older
1 2 3 4 5 6
/**

@mainpage Sofia-SIP su-glib Module

@section su_glib_meta Module Meta Information

7 8 9 10
The su-glib module provides an interface to connect Sofia-SIP event loop 
to an existing glib main loop. Without this interface, a glib based
application would have to create a separate thread for running
the Sofia-SIP event loop.
11 12 13 14 15 16 17

@CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>

@STATUS Core library

@LICENSE LGPL

18 19 20 21 22 23
@section su_glib_contents Contents of su-glib Module

The su-glib module contains the public header files as follows:
- <su_glib.h>    the public API of the module
- <su_source.h>  deprecated API (1.12.1 and earlier)

24
@section su_glib_examples Examples of use
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
Below is a simple example of how to use su-glib:
@code
  #include <glib.h>
  #include <sofia-sip/su_glib.h>

  /* ... */
  
  GMainLoop *ptr = g_main_loop_new(NULL, FALSE);
  GSource *gsource;
  su_root_t *sofia_event_loop;
  su_timer_t *timer;

  /* create a sofia event loop using su-glib function su_glib_root_source_create() */
  sofia_event_loop = su_glib_root_create(NULL); 

  /* attach the created GSource to glib event loop */
  gsource = su_glib_root_gsource(sofia_event_loop);
  g_source_attach(gsource, g_main_loop_get_context(ptr));

  /* use the sofia event loop with libsofia-sip-ua modules */
  timer = su_timer_create(su_root_task(sofia_event_loop), 200L);

  /* ... initialize other Sofia-SIP modules/functrions */

  /* run the glib mainloop */
51
  g_main_loop_run(ptr);  
52 53 54 55 56 57
@endcode   

@section su_glib_todo Todo

- see sourceforge.net issue tracker for sofia-sip 
  (-> http://sofia-sip.sourceforge.net/development.html )
58 59

*/