SimGrid  3.8.1
Scalable Simulation of Distributed Systems - Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Message exchange (advanced interface)

Data Structures

struct  s_gras_msg_t
 Message instance (internal struct) More...

Enumerations

enum  e_gras_msg_kind_t { , e_gras_msg_kind_oneway = 1, e_gras_msg_kind_rpccall = 2, e_gras_msg_kind_rpcanswer = 3, e_gras_msg_kind_rpcerror = 4 }
 Message kind (internal enum) More...

Functions

void gras_msg_wait_ext_ (double timeout, gras_msgtype_t msgt_want, xbt_socket_t expe_want, gras_msg_filter_t filter, void *filter_ctx, gras_msg_t msg_got)
 Waits for a message to come in over a given socket.
void gras_msg_wait_or (double timeout, xbt_dynar_t msgt_want, gras_msg_cb_ctx_t *ctx, int *msgt_got, void *payload)
 Waits for a message to come in over a given socket.

Detailed Description

Enumeration Type Documentation

Message kind (internal enum)

Enumerator:
e_gras_msg_kind_oneway 

good old regular messages

e_gras_msg_kind_rpccall 

RPC request

e_gras_msg_kind_rpcanswer 

RPC successful answer

e_gras_msg_kind_rpcerror 

RPC failure on server (payload=exception); should not leak to user-space

Function Documentation

void gras_msg_wait_ext_ ( double  timeout,
gras_msgtype_t  msgt_want,
xbt_socket_t  expe_want,
gras_msg_filter_t  filter,
void *  filter_ctx,
gras_msg_t  msg_got 
)

Waits for a message to come in over a given socket.

Parameters
timeout,:How long should we wait for this message.
msgt_want,:type of awaited msg (or NULL if I'm enclined to accept any message)
expe_want,:awaited expeditot (match on hostname, not port; NULL if not relevant)
filter,:function returning true or false when passed a payload. Messages for which it returns false are not selected. (NULL if not relevant)
filter_ctx,:context passed as second argument of the filter (a pattern to match?)
[out]msg_got,:where to write the message we got

Every message of another type received before the one waited will be queued and used by subsequent call to this function or gras_msg_handle().

void gras_msg_wait_or ( double  timeout,
xbt_dynar_t  msgt_want,
gras_msg_cb_ctx_t ctx,
int *  msgt_got,
void *  payload 
)

Waits for a message to come in over a given socket.

Parameters
timeout,:How long should we wait for this message.
msgt_want,:a dynar containing all accepted message type
[out]ctx,:the context of received message (in case it's a RPC call we want to answer to)
[out]msgt_got,:indice in the dynar of the type of the received message
[out]payload,:where to write the payload of the incoming message
Returns
the error code (or no_error).

Every message of a type not in the accepted list received before the one waited will be queued and used by subsequent call to this function or gras_msg_handle().

If you are interested in the context, pass the address of a s_gras_msg_cb_ctx_t variable.