Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

SOFIAPUBFUN int su_msg_create ( su_msg_r  rmsg,
su_task_r const   to,
su_task_r const   from,
su_msg_f  wakeup,
isize_t  size 

Allocates a message of given size.

The function su_msg_create() allocates a message with given data size. If successful, it moves the new message handle to the rmsg.

rmsg handle to the new message (may be uninitialized prior calling)
to the recipient task
from the sender task
wakeup function that is called when message is delivered
size size of the message data
Return values:
0 if successful,
-1 if message allocation fails.

Definition at line 893 of file su_root.c.

References su_msg_create(), su_zalloc(), su_msg_s::sum_from, su_msg_s::sum_func, su_msg_s::sum_size, and su_msg_s::sum_to.

Referenced by su_msg_create(), and su_msg_reply().

  su_msg_t *msg;

  msg = su_zalloc(NULL, sizeof(*msg) + size);

  if (msg) {
    msg->sum_size = sizeof(*msg) + size;
    SU_TASK_COPY(msg->sum_to, to, su_msg_create);
    SU_TASK_COPY(msg->sum_from, from, su_msg_create);
    msg->sum_func = wakeup;
    *rmsg = msg;
    return 0;

  *rmsg = NULL;
  return -1;

Generated by  Doxygen 1.6.0   Back to index