X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d88979392aa995371340597cbfc45f1cd33fe643..3a57f91ccf2d927dd2070e1062a1ea4393e46905:/include/gras/messages.h diff --git a/include/gras/messages.h b/include/gras/messages.h index f5be19d861..3ed2f177de 100644 --- a/include/gras/messages.h +++ b/include/gras/messages.h @@ -15,11 +15,16 @@ #include "gras/transport.h" #include "gras/datadesc.h" -BEGIN_DECL() +SG_BEGIN_DECL() /** @addtogroup GRAS_msg * @brief Defining messages and callbacks, and exchanging messages (Communication facility) * + *
Top [\ref index]::[\ref GRAS_API] + *
Prev [\ref GRAS_sock] + *
Next [\ref GRAS_timer] + *
Down [\ref GRAS_msg_decl]
+ * * There is two way to receive messages in GRAS. The first one is to * register a given function as callback to a given type of messages (see * \ref gras_cb_register and associated section). But you can also @@ -33,12 +38,15 @@ BEGIN_DECL() * passed to the callback. * * For an example of use, please refer to \ref GRAS_ex_ping. - * - * @{ */ -/** @name 1. Message declaration and retrival +/** @defgroup GRAS_msg_decl Message declaration and retrival + * @ingroup GRAS_msg * + *
Top [\ref index]::[\ref GRAS_API]::[\ref GRAS_msg] + *
Prev + *
Next [\ref GRAS_msg_cb]
+ * * GRAS messages can only accept one type of payload. If you absolutely want to declare a message * able to convey several datatypes, you can always say that it conveys a generic reference (see * \ref gras_datadesc_ref_generic). @@ -47,7 +55,7 @@ BEGIN_DECL() * to add a version number to the message (by default, the version is set to 0). Any messages of the * wrong version will be ignored by the applications not providing any specific callback for them. * - * This mecanism (stolen from the dynamic loader one) should ensure you to change the semantic of a given + * This mechanism (stolen from the dynamic loader one) should ensure you to change the semantic of a given * message while still understanding the old one. */ /** @{ */ @@ -62,10 +70,16 @@ typedef struct s_gras_msgtype *gras_msgtype_t; gras_msgtype_t gras_msgtype_by_name (const char *name); gras_msgtype_t gras_msgtype_by_namev(const char *name, short int version); + gras_msgtype_t gras_msgtype_by_id(int id); /** @} */ -/** @name 2. Callback declaration and use +/** @defgroup GRAS_msg_cb Callback declaration and use + * @ingroup GRAS_msg * + *
Top [\ref index]::[\ref GRAS_API]::[\ref GRAS_msg] + *
Prev [\ref GRAS_msg_decl] + *
Next [\ref GRAS_msg_exchange]
+ * * This is how to register a given function so that it gets called when a * given type of message arrives. * @@ -100,21 +114,27 @@ typedef struct s_gras_msgtype *gras_msgtype_t; void gras_cb_unregister(gras_msgtype_t msgtype, gras_msg_cb_t cb); /** @} */ -/** @name 3. Message exchange */ +/** @defgroup GRAS_msg_exchange Message exchange + * @ingroup GRAS_msg + * + *
Top [\ref index]::[\ref GRAS_API]::[\ref GRAS_msg] + *
Prev [\ref GRAS_msg_cb] + *
Next
+ */ /** @{ */ - xbt_error_t gras_msg_send(gras_socket_t sock, - gras_msgtype_t msgtype, - void *payload); - xbt_error_t gras_msg_wait(double timeout, - gras_msgtype_t msgt_want, - gras_socket_t *expeditor, - void *payload); - xbt_error_t gras_msg_handle(double timeOut); + void gras_msg_send(gras_socket_t sock, + gras_msgtype_t msgtype, + void *payload); + void gras_msg_wait(double timeout, + gras_msgtype_t msgt_want, + gras_socket_t *expeditor, + void *payload); + void gras_msg_handle(double timeOut); -/*@}*/ +/* @} */ -END_DECL() +SG_END_DECL() #endif /* GRAS_MSG_H */