Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2905b0cfda06e337934f4c835b2007ec19f4f30a
[simgrid.git] / src / gras / Msg / msg_interface.h
1 /* messaging - high level communication (send/receive messages)             */
2
3 /* module's public interface exported within GRAS, but not to end user.     */
4
5 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
6  * All rights reserved.                                                     */
7
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. */
10
11 #ifndef GRAS_MSG_INTERFACE_H
12 #define GRAS_MSG_INTERFACE_H
13
14 #include "gras/transport.h"
15 #include "xbt/fifo.h"
16
17 /*
18  * Data of this module specific to each process
19  * (used by sg_process.c to check some usual errors at the end of the simulation)
20  * FIXME: it could be cleaned up ?
21  */
22 typedef struct {
23   /* set headers */
24   unsigned int ID;
25   char *name;
26   unsigned int name_len;
27
28   /* queue storing the msgs got while msg_wait'ing for something else. Reuse them ASAP. */
29   xbt_dynar_t msg_queue;        /* elm type: s_gras_msg_t */
30
31   /* queue storing the msgs without callback got when handling. Feed them to wait() */
32   xbt_dynar_t msg_waitqueue;    /* elm type: s_gras_msg_t */
33
34   /* registered callbacks for each message */
35   xbt_dynar_t cbl_list;         /* elm type: gras_cblist_t */
36
37   /* registered timers */
38   xbt_dynar_t timers;           /* elm type: s_gras_timer_t */
39
40   /* queue storing the msgs that have to received and the process synchronization made (wait the surf action done) */
41   xbt_fifo_t msg_to_receive_queue;      /* elm type: s_gras_msg_t */
42   xbt_fifo_t msg_to_receive_queue_meas; /* elm type: s_gras_msg_t */
43   xbt_queue_t msg_received;
44
45 } s_gras_msg_procdata_t, *gras_msg_procdata_t;
46
47
48 void gras_msg_send_namev(gras_socket_t sock,
49                          const char *namev, void *payload);
50 void gras_msg_listener_awake(void);
51 void gras_msg_listener_close_socket(int sd);
52
53 #define GRAS_PROTOCOL_VERSION '\1';
54
55
56 #endif                          /* GRAS_MSG_INTERFACE_H */