XMMS2
Macros | Functions
xmmsv_c2c.c File Reference
#include <stddef.h>
#include "xmmsc/xmmsv.h"
#include "xmmsc/xmmsc_util.h"
#include "xmmscpriv/xmmsv_c2c.h"

Macros

#define GEN_C2C_FIELD_GET_FUNC(field, getter, ctype, failval)
 

Functions

int xmmsv_c2c_message_get_id (xmmsv_t *msg)
 Extract the id from a c2c message. More...
 
int xmmsv_c2c_message_get_sender (xmmsv_t *msg)
 Extract the sender id from a c2c message. More...
 
int xmmsv_c2c_message_get_destination (xmmsv_t *msg)
 Extract the destination id from a c2c message. More...
 
xmmsv_txmmsv_c2c_message_get_payload (xmmsv_t *msg)
 Extract the payload from a c2c message. More...
 
xmmsv_txmmsv_c2c_message_format (int sender, int dest, int id, xmmsv_t *payload)
 Format a client-to-client message. More...
 

Macro Definition Documentation

#define GEN_C2C_FIELD_GET_FUNC (   field,
  getter,
  ctype,
  failval 
)
Value:
ctype \
xmmsv_c2c_message_get_##field (xmmsv_t *msg) \
{ \
ctype ret; \
if (!getter (msg, #field, &ret)) \
return failval; \
return ret; \
}

Function Documentation

xmmsv_t* xmmsv_c2c_message_format ( int  sender,
int  dest,
int  id,
xmmsv_t payload 
)

Format a client-to-client message.

Messages are dictionaries of the form:
"sender" : id of the sender client
"destination" : id of the destination client
"id" : 0 if the message doesn't expect reply, else a message id
"payload" : the contents of the message

Parameters
senderthe id of the sender client
destthe id of the destination client
idthe id of the message
payloadthe contents of the message
Returns
the formatted message
Note
Increases the refcount of payload.
int xmmsv_c2c_message_get_destination ( xmmsv_t msg)

Extract the destination id from a c2c message.

Parameters
msgThe client-to-client-message.
Returns
The destination id upon success, -1 upon failure.
int xmmsv_c2c_message_get_id ( xmmsv_t msg)

Extract the id from a c2c message.

Parameters
msgThe client-to-client message.
Returns
The id upon success, -1 upon failure.
xmmsv_t* xmmsv_c2c_message_get_payload ( xmmsv_t msg)

Extract the payload from a c2c message.

Parameters
msgThe client-to-client message.
Returns
The payload upon success, NULL upon failure.
int xmmsv_c2c_message_get_sender ( xmmsv_t msg)

Extract the sender id from a c2c message.

Parameters
msgThe client-to-client message.
Returns
The sender id upon success, -1 upon failure.