3 /* messaging - high level communication (send/receive messages) */
4 /* module's public interface exported to end user. */
6 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
8 /* This program is free software; you can redistribute it and/or modify it
9 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #ifndef GRAS_MESSAGES_H
12 #define GRAS_MESSAGES_H
15 #include "gras/transport.h"
16 #include "gras/datadesc.h"
20 /* msgtype declaration and retrival */
21 typedef struct s_gras_msgtype *gras_msgtype_t;
23 void gras_msgtype_declare (const char *name,
24 gras_datadesc_type_t payload);
25 void gras_msgtype_declare_v(const char *name,
27 gras_datadesc_type_t payload);
29 gras_msgtype_t gras_msgtype_by_name (const char *name);
30 gras_msgtype_t gras_msgtype_by_namev(const char *name,
35 * @msg: The message itself
36 * @Returns: true if the message was consumed by the callback.
38 * Type of message callback functions. Once a such a function is registered to
39 * handle messages of a given type with RegisterCallback(), it will be called
40 * each time such a message incomes.
42 * If the callback accepts the message, it should free it after use.
44 typedef int (*gras_cb_t)(gras_socket_t expeditor,
46 void gras_cb_register (gras_msgtype_t msgtype,
48 void gras_cb_unregister(gras_msgtype_t msgtype,
51 xbt_error_t gras_msg_send(gras_socket_t sock,
52 gras_msgtype_t msgtype,
54 xbt_error_t gras_msg_wait(double timeout,
55 gras_msgtype_t msgt_want,
56 gras_socket_t *expeditor,
58 xbt_error_t gras_msg_handle(double timeOut);
63 #endif /* GRAS_MSG_H */