Index: doc/dbg_interactive.py.sample
===================================================================
--- doc/dbg_interactive.py.sample	(revision 622)
+++ doc/dbg_interactive.py.sample	(revision 623)
@@ -21,15 +21,25 @@
 
 
+# Change the global debug level of the framework (cvar contains all global variables)
+cvar.fd_g_debug_lvl = FULL
+
+
 # Turn on debug for a specific function
 cvar.fd_debug_one_function = "gc_th_fct"
 
 
-# Use freeDiameter's debug facility
+# Print messages to freeDiameter's debug facility
 fd_log_debug("3 + 4 = %d\n", 7)
 # Hum... Currently I get "3 + 4 = 0" output... need some fix...
 
 
-# Change the global debug level of the framework
-cvar.fd_g_debug_lvl = FULL
+# SWIG deals with structures as follow:
+# Take the structure:
+# struct foo { int a; }
+# The following functions are available to python:
+# s = new_foo()	   --> s = calloc(1, sizeof(struct foo))
+# foo_a_set(s, 2)  --> s->a = 2
+# foo_a_get(s)     --> returns s->a value
+# delete_foo(s)    --> free(s)
 
 
@@ -56,18 +66,28 @@
 
 # Lists
-mylist = new_fd_list()
-fd_list_init(mylist, None)
+l1 = new_fd_list()
 l2 = new_fd_list()
-fd_list_init(l2, None)
-fd_list_insert_after(mylist, l2)
-fd_list_unlink(l2)
+fd_list_insert_after(l1, l2)
+fd_list_dump(l1)
+fd_list_dump(l2)
 delete_fd_list(l2)
-delete_fd_list(mylist)
+fd_list_dump(l1)
+delete_fd_list(l1)
+
 
 # Dictionary
 gdict = fd_config_cnf_dict_get(cvar.fd_g_config)
-@@@ fd_dict_search ( gdict, DICT_APPLICATION, APPLICATION_BY_ID, id, res, -1 )
+id = new_int_ptr()
+int_ptr_assign(id, 3)
+res = new_dict_object_ptr()
+err = fd_dict_search ( gdict, DICT_APPLICATION, APPLICATION_BY_ID, id, res, -1 )
+obj = dict_object_ptr_value(res)
+t = new_dict_object_type_ptr()
+err = fd_dict_gettype(obj, t)
+dict_object_type_ptr_dump(t)
+v = new_dict_application_data()
+err = fd_dict_getval(obj, v)
+dict_application_data_application_name_get(v)
 
 
 
-
Index: extensions/dbg_interactive/diwrap.i
===================================================================
--- extensions/dbg_interactive/diwrap.i	(revision 621)
+++ extensions/dbg_interactive/diwrap.i	(revision 623)
@@ -1,2 +1,5 @@
+/* This interface file is processed by SWIG to create a python wrapper interface to freeDiameter framework. */
+%module diwrap
+%begin %{
 /*********************************************************************************************************
 * Software License Agreement (BSD License)                                                               *
@@ -33,10 +36,10 @@
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
 *********************************************************************************************************/
+%}
 
-/* This interface file is processed by SWIG to create a python wrapper interface to freeDiameter framework. */
-%module diwrap
 
-/* Include standard types & functions used in freeDiameter headers */
-%include <stdint.i>
+%init %{
+/* TODO: How to load the proxy classes here? */
+%}
 
 %{
@@ -46,8 +49,13 @@
 %}
 
+
+/* Include standard types & functions used in freeDiameter headers */
+%include <stdint.i>
+%include <cpointer.i>
+%include <typemaps.i>
+
 /* Some functions are not available through the wrapper */
 %ignore fd_lib_init;
 %ignore fd_lib_fini;
-%ignore fd_sess_start;
 
 /* Inline functions seems to give problems to SWIG -- just remove the inline definition */
@@ -55,10 +63,20 @@
 %enddef
 
-/* Make some global-variables read-only */
+/* Make some global-variables read-only (mainly to avoid warnings) */
 %immutable fd_g_config;
 %immutable peer_state_str;
 
-/* Overwrite a few functions prototypes for usability */
+/* Overwrite a few functions prototypes for usability: default parameters values, OUTPUT typemaps, ... */
 extern void fd_list_init ( struct fd_list * list, void * obj = NULL );
+
+
+/*
+extern int fd_dict_new ( struct dictionary * dict, enum dict_object_type type, void * data, struct dict_object * parent, struct dict_object ** OUTPUT );
+extern int fd_dict_search ( struct dictionary * dict, enum dict_object_type type, int criteria, void * what, struct dict_object ** OUTPUT, int retval );
+extern int fd_dict_get_error_cmd(struct dictionary * dict, struct dict_object ** OUTPUT);
+extern int fd_dict_getval ( struct dict_object * object, void * INOUT);
+//extern int fd_dict_gettype ( struct dict_object * object, enum dict_object_type * OUTPUT);
+extern int fd_dict_getdict ( struct dict_object * object, struct dictionary ** OUTPUT);
+*/
 
 
@@ -69,2 +87,64 @@
 
 
+/* Some pointer types that are useful */
+%pointer_class(int, int_ptr);
+%pointer_class(enum dict_object_type, dict_object_type_ptr);
+%pointer_functions(struct dict_object *, dict_object_ptr);
+%pointer_functions(struct session *, session_ptr);
+
+
+
+
+/* Extend some structures for usability/debug in python */
+%extend fd_list {
+	fd_list(void * o = NULL) {
+		struct fd_list * li;
+		li = (struct fd_list *) malloc(sizeof(struct fd_list));
+		if (!li) {
+			fd_log_debug("Out of memory!\n");
+			return NULL;
+		}
+		fd_list_init(li, o);
+		return li;
+	}
+	~fd_list() {
+		fd_list_unlink($self);
+		free($self);
+	}
+	void dump() {
+		fd_log_debug("list: %p\n", $self);
+		fd_log_debug("  - next: %p\n", $self->next);
+		fd_log_debug("  - prev: %p\n", $self->prev);
+		fd_log_debug("  - head: %p\n", $self->head);
+		fd_log_debug("  - o   : %p\n", $self->o);
+	}
+};
+
+%extend dict_object_type_ptr {
+	void dump() {
+		%#define CASE_STR(x)  case x: fd_log_debug(#x "\n"); break;
+		switch (*$self) {
+			CASE_STR(DICT_VENDOR)
+			CASE_STR(DICT_APPLICATION)
+			CASE_STR(DICT_TYPE)
+			CASE_STR(DICT_ENUMVAL)
+			CASE_STR(DICT_AVP)
+			CASE_STR(DICT_COMMAND)
+			CASE_STR(DICT_RULE)
+			default: fd_log_debug("Invalid value (%d)", *$self); break;
+		}
+	}
+}
+
+%inline %{ 
+void session_ptr_showsid(struct session * s) {
+	char * sid;
+	int ret = fd_sess_getsid ( s, &sid );
+	if (ret != 0) {
+		fd_log_debug("Error %d\n", ret);
+		/* throw an exception in SWIG? */
+		return;
+	}
+	fd_log_debug("%s\n", sid);
+}
+%}
