Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New function to have a finer control on what kind of message you're disposed to wait
[simgrid.git] / src / gras / Msg / msg_private.h
1 /* $Id$ */
2
3 /* messaging - high level communication (send/receive messages)             */
4
5 /* module's private interface masked even to other parts of GRAS.           */
6
7 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
8
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. */
11
12 #ifndef GRAS_MESSAGE_PRIVATE_H
13 #define GRAS_MESSAGE_PRIVATE_H
14
15 #include "gras_config.h"
16
17 #include "xbt/sysdep.h"
18 #include "xbt/log.h"
19 #include "xbt/dynar.h"
20 #include "xbt/set.h"
21 #include "gras/transport.h"
22 #include "gras/datadesc.h"
23 #include "gras/virtu.h"
24
25 #include "gras/messages.h"
26 #include "gras/timer.h"
27 #include "gras_modinter.h"
28
29 #include "gras/Msg/msg_interface.h"
30
31 extern char _GRAS_header[6];
32
33 extern int gras_msg_libdata_id; /* The identifier of our libdata */
34  
35 /** @brief Message instance */
36 typedef struct {
37   gras_socket_t   expeditor;
38   gras_msgtype_t  type;
39   void           *payload;
40   int             payload_size;
41 } s_gras_msg_t, *gras_msg_t;
42
43 /**
44  * gras_msgtype_t:
45  *
46  * Message type descriptor. There one of these for each registered version.
47  */
48 typedef struct s_gras_msgtype {
49   /* headers for the data set */
50   unsigned int   code;
51   char          *name;
52   unsigned int   name_len;
53         
54   /* payload */
55   short int version;
56   gras_datadesc_type_t ctn_type;
57 } s_gras_msgtype_t;
58
59 extern xbt_set_t _gras_msgtype_set; /* of gras_msgtype_t */
60 void gras_msgtype_free(void *msgtype);
61
62
63 void gras_msg_recv(gras_socket_t    sock,
64                    gras_msgtype_t  *msgtype,
65                    void           **payload,
66                    int             *payload_size);
67
68 /**
69  * gras_cblist_t:
70  *
71  * association between msg ID and cb list for a given process
72  */
73 struct s_gras_cblist {
74   long int id;
75   xbt_dynar_t cbs; /* of gras_msg_cb_t */
76 };
77
78 typedef struct s_gras_cblist gras_cblist_t;
79 void gras_cbl_free(void *); /* used to free the memory at the end */
80 void gras_cblist_free(void *cbl);
81
82
83 /* ********* *
84  * * TIMER * *
85  * ********* */
86 typedef struct {
87   double expiry;
88   double period;
89   void_f_void_t action;
90   int repeat;
91 } s_gras_timer_t, *gras_timer_t;
92
93 /* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
94 double gras_msg_timer_handle(void);
95
96
97 #endif  /* GRAS_MESSAGE_PRIVATE_H */