element_internal
[data_internal]

Collaboration diagram for element_internal:

Detailed Description

Module for manage EasyDbus element Internals.

Functions for manage easydbus elements

Element Meta Information

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


Functions

int add_elems_to_msg (DBusMessage *msg, struct EasyDbus_elem *first)
 Add elements to DBusMessage.
void easydbus_elem_add_to_skeleton (enum event_type type, void *event, EasyDbus_elem *el)
 Add element on message object (skeleton).
void easydbus_elem_free (EasyDbus_elem *el)
 Free struct EasyDbus_elem memory area.


Function Documentation

int add_elems_to_msg ( DBusMessage *  msg,
struct EasyDbus_elem first 
)

Add elements to DBusMessage.

For internal use only.

Parameters:
msg DBusMessage pointer where insert element.
first pointer to first element object to add on message. Until next element object is != NULL that element is inserted on message.
Returns:
-1 error

0 ok

dict entry must be insert only inside to an array

Definition at line 434 of file elem.c.

References add_array_to_msg(), add_variant_to_msg(), EasyDbus_elem::boolean, EasyDbus_elem::byte, EasyDbus_elem::Double, easydbus_add_struct_to_msg(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_BOOLEAN, EASYDBUS_ELTYPE_BYTE, EASYDBUS_ELTYPE_DICT_ENTRY, EASYDBUS_ELTYPE_DOUBLE, EASYDBUS_ELTYPE_INT16, EASYDBUS_ELTYPE_INT32, EASYDBUS_ELTYPE_INT64, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_OBJECT_PATH, EASYDBUS_ELTYPE_SIGNATURE, EASYDBUS_ELTYPE_STRING, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_ELTYPE_UINT16, EASYDBUS_ELTYPE_UINT32, EASYDBUS_ELTYPE_UINT64, EASYDBUS_ELTYPE_VARIANT, EasyDbus_elem::i16, EasyDbus_elem::i32, EasyDbus_elem::i64, EasyDbus_elem::next, EasyDbus_elem::payload, EasyDbus_elem::string, EasyDbus_elem::type, EasyDbus_elem::ui16, EasyDbus_elem::ui32, and EasyDbus_elem::ui64.

Referenced by create_method_msg(), create_signal_msg(), and easydbus_reply_create_msg().

00435 {
00436    struct EasyDbus_elem *el = NULL;
00437 
00438    /* see if use directly first on insert steps */
00439    el = first;
00440    int ret_val = 1;
00441 
00442    if (msg == NULL || first == NULL)
00443       return -1;
00444 
00445    while (el != NULL) {
00446       switch (el->type) {
00447          case EASYDBUS_ELTYPE_STRING:
00448             if (!dbus_message_append_args (msg, DBUS_TYPE_STRING,
00449                                            &el->payload.string,
00450                                            DBUS_TYPE_INVALID))
00451                ret_val = 0;
00452             break;
00453          case EASYDBUS_ELTYPE_BYTE:
00454             if (!dbus_message_append_args (msg, DBUS_TYPE_BYTE,
00455                                            &el->payload.byte,
00456                                            DBUS_TYPE_INVALID))
00457                ret_val = 0;
00458             break;
00459          case EASYDBUS_ELTYPE_BOOLEAN:
00460             if (!dbus_message_append_args (msg, DBUS_TYPE_BOOLEAN,
00461                                            &el->payload.boolean,
00462                                            DBUS_TYPE_INVALID))
00463                ret_val = 0;
00464             break;
00465          case EASYDBUS_ELTYPE_DOUBLE:
00466             if (!dbus_message_append_args (msg, DBUS_TYPE_DOUBLE,
00467                                            &el->payload.Double,
00468                                            DBUS_TYPE_INVALID))
00469                ret_val = 0;
00470             break;
00471          case EASYDBUS_ELTYPE_INT16:
00472             if (!dbus_message_append_args (msg, DBUS_TYPE_INT16,
00473                                            &el->payload.i16,
00474                                            DBUS_TYPE_INVALID))
00475                ret_val = 0;
00476             break;
00477          case EASYDBUS_ELTYPE_UINT16:
00478             if (!dbus_message_append_args (msg, DBUS_TYPE_UINT16,
00479                                            &el->payload.ui16,
00480                                            DBUS_TYPE_INVALID))
00481                ret_val = 0;
00482             break;
00483          case EASYDBUS_ELTYPE_INT32:
00484             if (!dbus_message_append_args (msg, DBUS_TYPE_INT32,
00485                                            &el->payload.i32,
00486                                            DBUS_TYPE_INVALID))
00487                ret_val = 0;
00488             break;
00489          case EASYDBUS_ELTYPE_UINT32:
00490             if (!dbus_message_append_args (msg, DBUS_TYPE_UINT32,
00491                                            &el->payload.ui32,
00492                                            DBUS_TYPE_INVALID))
00493                ret_val = 0;
00494             break;
00495          case EASYDBUS_ELTYPE_INT64:
00496             if (!dbus_message_append_args (msg, DBUS_TYPE_INT64,
00497                                            &el->payload.i64,
00498                                            DBUS_TYPE_INVALID))
00499                ret_val = 0;
00500             break;
00501          case EASYDBUS_ELTYPE_UINT64:
00502             if (!dbus_message_append_args (msg, DBUS_TYPE_UINT64,
00503                                            &el->payload.ui64,
00504                                            DBUS_TYPE_INVALID))
00505                ret_val = 0;
00506             break;
00507          case EASYDBUS_ELTYPE_OBJECT_PATH:
00508             if (!dbus_message_append_args (msg, DBUS_TYPE_OBJECT_PATH,
00509                                            &el->payload.string,
00510                                            DBUS_TYPE_INVALID))
00511                ret_val = 0;
00512             break;
00513          case EASYDBUS_ELTYPE_SIGNATURE:
00514             if (!dbus_message_append_args (msg, DBUS_TYPE_SIGNATURE,
00515                                            &el->payload.string,
00516                                            DBUS_TYPE_INVALID))
00517                ret_val = 0;
00518             break;
00519          case EASYDBUS_ELTYPE_ARRAY:
00520             /* todo */
00521             if (!add_array_to_msg (msg, el))
00522                ret_val = 0;
00523             break;
00524          case EASYDBUS_ELTYPE_VARIANT:
00525             if (!add_variant_to_msg (msg, el))
00526                ret_val = 0;
00527             break;
00528          case EASYDBUS_ELTYPE_STRUCT:
00529             if (!easydbus_add_struct_to_msg (msg, el))
00530                ret_val = 0;
00531             break;
00534          case EASYDBUS_ELTYPE_DICT_ENTRY:
00535          case EASYDBUS_ELTYPE_INVALID:
00536             return -1;
00537             break;
00538       }
00539       el = el->next;
00540    }
00541    return ret_val;
00542 }

Here is the call graph for this function:

void easydbus_elem_add_to_skeleton ( enum event_type  type,
void *  event,
EasyDbus_elem el 
)

Add element on message object (skeleton).

For internal use only.

Parameters:
type type of message object
event message object pointer (can be a pointer to EasyDbus_method, or to a EasyDbus_signal or to a EasyDbus_reply).
el pointer to element object.

Definition at line 490 of file skeleton.c.

References EasyDbus_reply::args, EasyDbus_signal::args, EasyDbus_method::args, EASYDBUS_ET_FAILURE, EASYDBUS_ET_METHOD, EASYDBUS_ET_REPLY, EASYDBUS_ET_SIGNAL, EasyDbus_reply::first, EasyDbus_signal::first, EasyDbus_method::first, and EasyDbus_elem::next.

Referenced by easydbus_add_array_param_to_skeleton(), easydbus_add_boolean_param_to_skeleton(), easydbus_add_byte_param_to_skeleton(), easydbus_add_double_param_to_skeleton(), easydbus_add_i16_param_to_skeleton(), easydbus_add_i32_param_to_skeleton(), easydbus_add_i64_param_to_skeleton(), easydbus_add_obj_path_param_to_skeleton(), easydbus_add_signature_param_to_skeleton(), easydbus_add_string_param_to_skeleton(), easydbus_add_struct_param_to_skeleton(), easydbus_add_ui16_param_to_skeleton(), easydbus_add_ui32_param_to_skeleton(), easydbus_add_ui64_param_to_skeleton(), and easydbus_add_variant_param_to_skeleton().

00492 {
00493    struct EasyDbus_signal *signal;
00494    struct EasyDbus_method *method;
00495    struct EasyDbus_reply *reply;
00496    struct EasyDbus_elem *temp;
00497 
00498    temp = NULL;
00499    reply = NULL;
00500    method = NULL;
00501    signal = NULL;
00502 
00503    switch (type) {
00504       case EASYDBUS_ET_METHOD:
00505          method = (struct EasyDbus_method *) event;
00506          if (!method->first)
00507             method->first = el;
00508          else {
00509             temp = method->first;
00510             while (temp->next)
00511                temp = temp->next;
00512             temp->next = el;
00513          }
00514          method->args++;
00515          break;
00516       case EASYDBUS_ET_SIGNAL:
00517          signal = (struct EasyDbus_signal *) event;
00518          if (!signal->first)
00519             signal->first = el;
00520          else {
00521             temp = signal->first;
00522             while (temp->next)
00523                temp = temp->next;
00524             temp->next = el;
00525          }
00526          signal->args++;
00527          break;
00528       case EASYDBUS_ET_REPLY:
00529       case EASYDBUS_ET_FAILURE:
00530          reply = (struct EasyDbus_reply *) event;
00531          if (!reply->first)
00532             reply->first = el;
00533          else {
00534             temp = reply->first;
00535             while (temp->next)
00536                temp = temp->next;
00537             temp->next = el;
00538          }
00539          reply->args++;
00540          break;
00541       default:
00542          return;
00543          break;
00544    }
00545 }

void easydbus_elem_free ( EasyDbus_elem el  ) 

Free struct EasyDbus_elem memory area.

Normally, this function must be called only internally because EasyDbus_elem(s) used by user are all const pointer and free of elements happen when it is free a message that contains elements.

For internal use only.

Parameters:
el pointer to element object.

Definition at line 345 of file elem.c.

References easydbus_container_free(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_DICT_ENTRY, EASYDBUS_ELTYPE_OBJECT_PATH, EASYDBUS_ELTYPE_SIGNATURE, EASYDBUS_ELTYPE_STRING, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_ELTYPE_VARIANT, EasyDbus_elem::p_container, EasyDbus_elem::payload, EasyDbus_elem::string, and EasyDbus_elem::type.

Referenced by easydbus_add_obj_path_param_to_skeleton(), easydbus_add_signature_param_to_skeleton(), easydbus_add_string_param_to_skeleton(), easydbus_container_free(), easydbus_dict_entry_add_obj_path(), easydbus_dict_entry_add_signature(), easydbus_dict_entry_add_string(), easydbus_method_free_skeleton(), easydbus_reply_free_skeleton(), easydbus_signal_free_skeleton(), easydbus_struct_add_obj_path(), easydbus_struct_add_signature(), and easydbus_struct_add_string().

00346 {
00347    if (el == NULL)
00348       return;
00349    switch (el->type) {
00350       case EASYDBUS_ELTYPE_STRING:
00351       case EASYDBUS_ELTYPE_OBJECT_PATH:
00352       case EASYDBUS_ELTYPE_SIGNATURE:
00353          if (el->payload.string != NULL)
00354             free (el->payload.string);
00355          break;
00356       case EASYDBUS_ELTYPE_STRUCT:
00357       case EASYDBUS_ELTYPE_ARRAY:
00358       case EASYDBUS_ELTYPE_DICT_ENTRY:
00359       case EASYDBUS_ELTYPE_VARIANT:
00360          if (el->payload.p_container != NULL) {
00361             easydbus_container_free (el->payload.p_container);
00362          }
00363          break;
00364       default:
00365          break;
00366    }
00367    free (el);
00368 }

Here is the call graph for this function:


Generated on Thu Apr 10 10:01:27 2008 for EasyDbus-0.2 by  doxygen 1.5.4