3 /* messaging - high level communication (send/receive messages) */
5 /* module's private interface masked even to other parts of GRAS. */
7 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
9 /* This program is free software; you can redistribute it and/or modify it
10 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #ifndef GRAS_MESSAGE_PRIVATE_H
13 #define GRAS_MESSAGE_PRIVATE_H
15 #include "gras_config.h"
17 #include "xbt/sysdep.h"
19 #include "xbt/dynar.h"
21 #include "gras/transport.h"
22 #include "gras/datadesc.h"
23 #include "gras/virtu.h"
25 #include "gras/messages.h"
26 #include "gras/timer.h"
27 #include "gras_modinter.h"
29 #include "gras/Msg/msg_interface.h"
31 extern char _GRAS_header[6];
33 extern int gras_msg_libdata_id; /* The identifier of our libdata */
35 extern const char *e_gras_msg_kind_names[e_gras_msg_kind_count];
37 /* declare either regular messages or RPC or whatever */
39 gras_msgtype_declare_ext(const char *name,
41 e_gras_msg_kind_t kind,
42 gras_datadesc_type_t payload_request,
43 gras_datadesc_type_t payload_answer);
48 * Message type descriptor. There one of these for each registered version.
50 typedef struct s_gras_msgtype {
51 /* headers for the data set */
54 unsigned int name_len;
58 e_gras_msg_kind_t kind;
59 gras_datadesc_type_t ctn_type;
60 gras_datadesc_type_t answer_type; /* only used for RPC */
63 extern xbt_set_t _gras_msgtype_set; /* of gras_msgtype_t */
64 void gras_msgtype_free(void *msgtype);
67 /* functions to extract msg from socket or put it on wire (depend RL vs SG) */
68 void gras_msg_recv(gras_socket_t sock,
69 gras_msg_t msg/*OUT*/);
70 void gras_msg_send_ext(gras_socket_t sock,
71 e_gras_msg_kind_t kind,
73 gras_msgtype_t msgtype,
79 * association between msg ID and cb list for a given process
81 struct s_gras_cblist {
83 xbt_dynar_t cbs; /* of gras_msg_cb_t */
86 typedef struct s_gras_cblist gras_cblist_t;
87 void gras_cbl_free(void *); /* used to free the memory at the end */
88 void gras_cblist_free(void *cbl);
93 * Context associated to a given callback (to either regular message or RPC)
95 struct s_gras_msg_cb_ctx {
96 gras_socket_t expeditor;
97 gras_msgtype_t msgtype;
101 typedef struct s_gras_msg_cb_ctx s_gras_msg_cb_ctx_t;
109 void_f_void_t action;
111 } s_gras_timer_t, *gras_timer_t;
113 /* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
114 double gras_msg_timer_handle(void);
118 #endif /* GRAS_MESSAGE_PRIVATE_H */