reply
[message]

Collaboration diagram for reply:

Detailed Description

Module for manage EasyDbus Reply_msg objects

TO COMPLETE

See also:
skeleton module for functions to use for insert args on methods. In particular must be used EASYDBUS_ET_REPLY as event type value.

Reply_msg Meta Information

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


Data Structures

struct  EasyDbus_reply
 EasyDbus_reply object. More...

Functions

EasyDbus_replyeasydbus_reply_create_skeleton (void)
 Create EasyDbus_reply object.
void easydbus_reply_free_skeleton (EasyDbus_reply *reply)
 Free a EasyDbus_reply object.
int easydbus_reply_get_args (const EasyDbus_reply *reply)
 Return number of args on EasyDbus_reply object.
const EasyDbus_elemeasydbus_reply_get_element (const EasyDbus_reply *reply, unsigned int n)
 Get N-element of EasyDbus_reply object.
const char * easydbus_reply_get_interface (EasyDbus_reply *reply)
 Recover interface of EasyDbus_reply object.
const char * easydbus_reply_get_sender (EasyDbus_reply *reply)
 Get sender of reply.
const char * easydbus_reply_get_src_path (EasyDbus_reply *reply)
 Recover source path of EasyDbus_reply object.
enum event_type easydbus_reply_get_type (EasyDbus_reply *reply)
 Recover type of EasyDbus_reply object.
int easydbus_reply_set_interface (EasyDbus_reply *reply, const char *interface)
 Set interface of reply.
int easydbus_reply_set_path (EasyDbus_reply *reply, const char *path)
 Set path of reply.
int easydbus_reply_set_sender (EasyDbus_reply *reply, const char *sender)
 Set sender of reply.
int easydbus_reply_set_type (EasyDbus_reply *reply, enum event_type type)
 Set reply type.


Function Documentation

EasyDbus_reply* easydbus_reply_create_skeleton ( void   ) 

Create EasyDbus_reply object.

Returns:
NULL on error

pointer to a new EasyDbus_reply object

Definition at line 256 of file reply.c.

References EASYDBUS_ET_INVALID, EasyDbus_reply::first, EasyDbus_reply::interface, EasyDbus_reply::sender, EasyDbus_reply::src_path, and EasyDbus_reply::type.

Referenced by easydbus_error_handler(), easydbus_introspect_filter_func(), easydbus_pending_msg_handler(), easydbus_reply_build_error(), easydbus_reply_build_struct(), and easydbus_reply_handler().

00257 {
00258    struct EasyDbus_reply *reply_skeleton = NULL;
00259 
00260    reply_skeleton = (struct EasyDbus_reply *) malloc
00261       (sizeof (struct EasyDbus_reply));
00262 
00263    if (reply_skeleton == NULL)
00264       return NULL;
00265 
00266    memset (reply_skeleton, 0, sizeof (struct EasyDbus_reply));
00267 
00268    reply_skeleton->src_path = reply_skeleton->interface = NULL;
00269    reply_skeleton->first = NULL;
00270    reply_skeleton->sender = NULL;
00271    reply_skeleton->type = EASYDBUS_ET_INVALID;
00272 
00273    return reply_skeleton;
00274 }

void easydbus_reply_free_skeleton ( EasyDbus_reply reply  )  [inline]

Free a EasyDbus_reply object.

Precondition:
reply!= NULL
Parameters:
reply EasyDbus_reply object pointer.

Definition at line 223 of file reply.c.

References EasyDbus_reply::args, easydbus_elem_free(), EasyDbus_reply::first, EasyDbus_reply::interface, EasyDbus_elem::next, EasyDbus_reply::sender, and EasyDbus_reply::src_path.

Referenced by easydbus_error_handler(), easydbus_introspect_filter_func(), easydbus_method_free_skeleton(), easydbus_obj_path_msg_function(), easydbus_pending_msg_handler(), easydbus_reply_build_error(), easydbus_reply_build_struct(), and easydbus_reply_handler().

00224 {
00225    struct EasyDbus_elem *el = NULL;
00226 
00227    if (reply) {
00228       if (reply->src_path)
00229          free (reply->src_path);
00230       if (reply->interface)
00231          free (reply->interface);
00232       if (reply->sender)
00233          free (reply->sender);
00234       reply->src_path = reply->interface =
00235                         reply->sender = NULL;
00236 
00237       while (reply->args) {
00238          if (reply->first) {
00239             el = reply->first;
00240             reply->first = reply->first->next;
00241          }
00242          easydbus_elem_free (el);
00243          reply->args--;
00244       }
00245       free (reply);
00246    }
00247 }

Here is the call graph for this function:

int easydbus_reply_get_args ( const EasyDbus_reply reply  )  [inline]

Return number of args on EasyDbus_reply object.

Parameters:
reply EasyDbus_reply object pointer.
Returns:
-1 error

number of args.

Definition at line 135 of file reply.c.

References EasyDbus_reply::args.

00136 {
00137    return (reply ? (int) reply->args : -1);
00138 }

const EasyDbus_elem* easydbus_reply_get_element ( const EasyDbus_reply reply,
unsigned int  n 
) [inline]

Get N-element of EasyDbus_reply object.

Parameters:
reply EasyDbus_reply object pointer.
n element to recover.
Returns:
NULL on error. (or if there is an element at position n).

pointer to n-element.

Definition at line 121 of file reply.c.

References easydbus_elem_get_element(), and EasyDbus_reply::first.

00123 {
00124    return (reply && n <= reply->args ? 
00125            easydbus_elem_get_element (reply->first, n) : NULL);
00126 }

Here is the call graph for this function:

const char* easydbus_reply_get_interface ( EasyDbus_reply reply  ) 

Recover interface of EasyDbus_reply object.

Parameters:
reply EasyDbus_reply object pointer
Returns:
NULL on error

interface of reply

Definition at line 401 of file reply.c.

References EasyDbus_reply::interface.

00402 {
00403    return (reply ? (const char *) reply->interface : NULL);
00404 }

const char* easydbus_reply_get_sender ( EasyDbus_reply reply  ) 

Get sender of reply.

Precondition:
reply != NULL
Parameters:
reply EasyDbus_reply object pointer
Returns:
reply sender string.

NULL on error or no sender set.

Definition at line 415 of file reply.c.

References EasyDbus_reply::sender.

00416 {
00417   return (reply ? (const char *) reply->sender : NULL);
00418 }

const char* easydbus_reply_get_src_path ( EasyDbus_reply reply  ) 

Recover source path of EasyDbus_reply object.

Parameters:
reply EasyDbus_reply object pointer
Returns:
NULL on error

source path of reply

Definition at line 389 of file reply.c.

References EasyDbus_reply::src_path.

00390 {
00391    return (reply ? (const char *) reply->src_path : NULL);
00392 }

enum event_type easydbus_reply_get_type ( EasyDbus_reply reply  ) 

Recover type of EasyDbus_reply object.

Parameters:
reply EasyDbus_reply object pointer
Returns:
EASYDBUS_ET_REPLY for normal reply

EASYDBUS_ET_INVALID for error

EASYDBUS_ET_FAILURE for error reply.

Definition at line 377 of file reply.c.

References EASYDBUS_ET_INVALID, and EasyDbus_reply::type.

00378 {
00379    return (reply ? reply->type : EASYDBUS_ET_INVALID);
00380 }

int easydbus_reply_set_interface ( EasyDbus_reply reply,
const char *  interface 
) [inline]

Set interface of reply.

Precondition:
reply != NULL && interface != NULL
Parameters:
reply EasyDbus_reply object pointer
interface interface to insert on reply object.
Returns:
-1 on error or if there is already an interface.

0 ok

Definition at line 458 of file reply.c.

References EASYDBUS_MEMCOPY, and EasyDbus_reply::interface.

Referenced by easydbus_error_handler(), easydbus_reply_build_struct(), and easydbus_reply_handler().

00460 {
00461    unsigned int string_length = 0;
00462 
00463    if (!interface || !reply || reply->interface) 
00464       return -1;
00465 
00466    string_length = strlen (interface) + 1;
00467    reply->interface = (char *) malloc (string_length);
00468    if (!reply->interface)
00469       return -1;
00470 
00471    EASYDBUS_MEMCOPY (reply->interface, interface,
00472                      string_length);
00473 
00474    return 0;
00475 }

int easydbus_reply_set_path ( EasyDbus_reply reply,
const char *  path 
) [inline]

Set path of reply.

Precondition:
reply != NULL && path != NULL
Parameters:
reply EasyDbus_reply object pointer
path path to insert on reply object.
Returns:
-1 on error or if there is already a path.

0 ok

Definition at line 487 of file reply.c.

References EASYDBUS_MEMCOPY, and EasyDbus_reply::src_path.

Referenced by easydbus_error_handler(), easydbus_reply_build_struct(), and easydbus_reply_handler().

00489 {
00490    unsigned int string_length = 0;
00491 
00492    if (!path || !reply || reply->src_path) 
00493       return -1;
00494 
00495    string_length = strlen (path) + 1;
00496    reply->src_path = (char *) malloc (string_length);
00497    if (!reply->src_path)
00498       return -1;
00499 
00500    EASYDBUS_MEMCOPY (reply->src_path, path,
00501                      string_length);
00502 
00503    return 0;
00504 }

int easydbus_reply_set_sender ( EasyDbus_reply reply,
const char *  sender 
) [inline]

Set sender of reply.

Precondition:
reply != NULL && sender != NULL
Parameters:
reply EasyDbus_reply object pointer
sender sender to insert on reply object.
Returns:
-1 on error

0 ok

Definition at line 430 of file reply.c.

References EASYDBUS_MEMCOPY, and EasyDbus_reply::sender.

Referenced by easydbus_error_handler(), and easydbus_reply_handler().

00432 {
00433    unsigned int string_length = 0;
00434 
00435    if (!sender || !reply || reply->sender) 
00436       return -1;
00437 
00438    string_length = strlen (sender) + 1;
00439    reply->sender = (char *) malloc (string_length);
00440    if (!reply->sender)
00441       return -1;
00442 
00443    EASYDBUS_MEMCOPY (reply->sender, sender, string_length);
00444 
00445    return 0;
00446 }

int easydbus_reply_set_type ( EasyDbus_reply reply,
enum event_type  type 
) [inline]

Set reply type.

Precondition:
reply != NUL
Parameters:
reply EasyDbus_reply object pointer.
type type of reply. type possible value are: EASYDBUS_ET_REPLY, EASYDBUS_ET_FAILURE
Returns:
-1 error

0 ok

Definition at line 101 of file reply.c.

References EASYDBUS_ET_FAILURE, EASYDBUS_ET_REPLY, and EasyDbus_reply::type.

Referenced by easydbus_error_handler(), and easydbus_reply_handler().

00103 {
00104    if (!reply || (type != EASYDBUS_ET_REPLY && 
00105        type != EASYDBUS_ET_FAILURE))
00106       return -1;
00107 
00108    reply->type = type;
00109    return 0;
00110 }


Generated on Thu Apr 10 10:02:46 2008 for EasyDbus-0.2 by  doxygen 1.5.4