obj_interface
[object]

Collaboration diagram for obj_interface:

Detailed Description

Module for manage Object interfaces

TO COMPLETE

Obj_Interface Meta Information

Contact:
Daniele Rondina aka Ge@@ru <geaaru@gmail.com>
Status:
EasyDbus Core Library
License:
GPL
Contributor(s):


Functions

int easydbus_obj_interface_add_method (EasyDbus_obj_interface *interface, EasyDbus_obj_method *method)
 Add method to interface.
int easydbus_obj_interface_add_signal (EasyDbus_obj_interface *interface, EasyDbus_obj_signal *signal)
 Add signal to interface.
EasyDbus_obj_interfaceeasydbus_obj_interface_create_skeleton (char *name)
 Create EasyDbus_obj_interface object for define an interface of an object.
void easydbus_obj_interface_free_skeleton (EasyDbus_obj_interface *interface)
 Free EasyDbus_obj_interface object.
EasyDbus_obj_methodeasydbus_obj_interface_get_method (const char *member_name, const char *interface_string, const EasyDbus_obj_interface *interface)
 Found method object from EasyDbus_obj_interface object.


Function Documentation

int easydbus_obj_interface_add_method ( EasyDbus_obj_interface interface,
EasyDbus_obj_method method 
)

Add method to interface.

Parameters:
interface EasyDbus_obj_interface object pointer where it is inserted method.
method EasyDbus_obj_method object to insert on interface
Returns:
-1 error

0 ok

Definition at line 108 of file register_interface.c.

References EasyDbusDebug, EasyDbus_obj_interface::handled_methods, EasyDbus_obj_interface::n_methods, and EasyDbus_obj_method::next.

00110 {
00111    struct EasyDbus_obj_method *temp;
00112 
00113    if (!interface || !method)
00114       return -1;
00115 
00116    if (interface->n_methods) {
00117       temp = interface->handled_methods;
00118       while (temp->next)
00119          temp = temp->next;
00120       temp->next = method;
00121    }
00122    else
00123       interface->handled_methods = method;
00124    interface->n_methods++;
00125 
00126    EasyDbusDebug ("Added method to interface skeleton");
00127 
00128    return 0;
00129 }

int easydbus_obj_interface_add_signal ( EasyDbus_obj_interface interface,
EasyDbus_obj_signal signal 
)

Add signal to interface.

Parameters:
interface EasyDbus_obj_interface object pointer where it is inserted signal.
signal EasyDbus_obj_signal object to insert on interface
Returns:
-1 error

0 ok

Definition at line 142 of file register_interface.c.

References EasyDbusDebug, EasyDbus_obj_interface::handled_signals, EasyDbus_obj_interface::n_signals, and EasyDbus_obj_signal::next.

00144 {
00145    struct EasyDbus_obj_signal *temp = NULL;
00146 
00147    if (!interface || !signal)
00148       return -1;
00149 
00150    if (interface->n_signals) {
00151       temp = interface->handled_signals;
00152       while (temp->next)
00153          temp = temp->next;
00154       temp->next = signal;
00155    }
00156    else
00157       interface->handled_signals = signal;
00158    interface->n_signals++;
00159 
00160    EasyDbusDebug ("Added signal to skeleton interface");
00161 
00162    return 0;
00163 }

EasyDbus_obj_interface* easydbus_obj_interface_create_skeleton ( char *  name  ) 

Create EasyDbus_obj_interface object for define an interface of an object.

Parameters:
name name of interface
Returns:
EasyDbus_obj_interface object pointer.

NULL on error

Definition at line 59 of file register_interface.c.

References EASYDBUS_MEMCOPY, EasyDbusDebug, EasyDbus_obj_interface::handled_methods, EasyDbus_obj_interface::handled_signals, and EasyDbus_obj_interface::name.

00060 {
00061    struct EasyDbus_obj_interface *interface = NULL;
00062    unsigned int name_length = 0;
00063 
00064    if (!name)
00065       return NULL;
00066 
00067    interface = (struct EasyDbus_obj_interface *)
00068       malloc (sizeof (struct EasyDbus_obj_interface));
00069    if (!interface)
00070       return NULL;
00071 
00072    memset (interface, 0, sizeof (struct EasyDbus_obj_interface));
00073 
00074    interface->name = NULL;
00075    interface->handled_signals = NULL;
00076    interface->handled_methods = NULL;
00077 
00078    if (name) {
00079       name_length = strlen (name) + 1;
00080       interface->name = (char *) malloc (name_length);
00081       if (!interface->name)
00082          goto out_of_memory;
00083 
00084       EASYDBUS_MEMCOPY (interface->name, name, name_length);
00085    }
00086 
00087    EasyDbusDebug ("Create Interface Skeleton struct with name %s",
00088                   name);
00089 
00090    return interface;
00091  out_of_memory:
00092    if (interface)
00093       free (interface);
00094    return NULL;
00095 }

void easydbus_obj_interface_free_skeleton ( EasyDbus_obj_interface interface  ) 

Free EasyDbus_obj_interface object.

Parameters:
interface EasyDbus_obj_interface object

Definition at line 171 of file register_interface.c.

References easydbus_obj_method_free(), easydbus_obj_signal_free(), EasyDbusDebug, EasyDbus_obj_interface::handled_methods, EasyDbus_obj_interface::handled_signals, EasyDbus_obj_interface::n_methods, EasyDbus_obj_interface::n_signals, EasyDbus_obj_interface::name, EasyDbus_obj_signal::next, and EasyDbus_obj_method::next.

Referenced by easydbus_object_free_skeleton().

00172 {
00173    struct EasyDbus_obj_signal *signal;
00174    struct EasyDbus_obj_method *method;
00175    int i;
00176 
00177    if (!interface)
00178       return;
00179 
00180    if (interface->name)
00181       free (interface->name);
00182 
00183    if (interface->n_methods) {
00184       for (i = 0; i < interface->n_methods; i++) {
00185          method = interface->handled_methods;
00186          if (method)
00187             interface->handled_methods = method->next;
00188          easydbus_obj_method_free (method);
00189       }
00190    }
00191 
00192    if (interface->n_signals) {
00193       for (i = 0; i < interface->n_methods; i++) {
00194          signal = interface->handled_signals;
00195          if (signal)
00196             interface->handled_signals = signal->next;
00197          easydbus_obj_signal_free (signal);
00198       }
00199    }
00200    free (interface);
00201    EasyDbusDebug ("Free Interface skeleton");
00202 }

Here is the call graph for this function:

EasyDbus_obj_method* easydbus_obj_interface_get_method ( const char *  member_name,
const char *  interface_string,
const EasyDbus_obj_interface interface 
)

Found method object from EasyDbus_obj_interface object.

Parameters:
member_name method name
interface_string interface string
interface EasyDbus_obj_interface object pointer
Returns:
NULL error or method not found.

pointer to method founded.

Definition at line 213 of file register_interface.c.

References EasyDbus_obj_interface::handled_methods, EasyDbus_obj_interface::name, EasyDbus_obj_method::name, and EasyDbus_obj_method::next.

Referenced by easydbus_verify_match_and_prepare_reply().

00216 {
00217    EasyDbus_obj_method *method = NULL;
00218 
00219    if (!member_name || !interface)
00220       return NULL;
00221 
00222    for (method = interface->handled_methods; method;
00223         method = method->next) {
00224       // check member
00225       if (!strcmp (member_name, method->name)) {
00226          if (interface_string) {
00227             if (!strcmp (interface_string, interface->name))
00228                break;
00229          } else
00230             // if interface isn't set and method matching,
00231             // then first method matching it is used.
00232             break;
00233       }
00234    }
00235 
00236    return method;
00237 }


Generated on Thu Apr 10 10:03:22 2008 for EasyDbus-0.2 by  doxygen 1.5.4