Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b8124694a5d49df8589e50b7ad821d4eecb5fb1d
[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/error.h"
20 #include "xbt/dynar.h"
21 #include "xbt/set.h"
22 #include "gras/transport.h"
23 #include "gras/datadesc.h"
24 #include "gras/virtu.h"
25
26 #include "gras/messages.h"
27 #include "gras_modinter.h"
28
29 #include "gras/Msg/msg_interface.h"
30
31
32 /** @brief Message instance */
33 typedef struct {
34   gras_socket_t   expeditor;
35   gras_msgtype_t  type;
36   void           *payload;
37   int             payload_size;
38 } gras_msg_t;
39
40 /**
41  * gras_msgtype_t:
42  *
43  * Message type descriptor. There one of these for each registered version.
44  */
45 typedef struct s_gras_msgtype {
46   /* headers for the data set */
47   unsigned int   code;
48   char          *name;
49   unsigned int   name_len;
50         
51   /* payload */
52   short int version;
53   gras_datadesc_type_t ctn_type;
54 } s_gras_msgtype_t;
55
56 extern xbt_set_t _gras_msgtype_set; /* of gras_msgtype_t */
57 void gras_msgtype_free(void *msgtype);
58
59
60 xbt_error_t gras_msg_recv(gras_socket_t    sock,
61                            gras_msgtype_t  *msgtype,
62                            void           **payload,
63                            int             *payload_size);
64
65 /**
66  * gras_cblist_t:
67  *
68  * association between msg ID and cb list for a given process
69  */
70 struct s_gras_cblist {
71   long int id;
72   xbt_dynar_t cbs; /* of gras_msg_cb_t */
73 };
74
75 typedef struct s_gras_cblist gras_cblist_t;
76 void gras_cbl_free(void *); /* used to free the memory at the end */
77 void gras_cblist_free(void *cbl);
78
79
80 /* ********* *
81  * * TIMER * *
82  * ********* */
83 typedef void (*void_f_void_t)(void);
84   
85 typedef struct {
86   double expiry;
87   double period;
88   void_f_void_t action;
89   int repeat;
90 } *gras_timer_t;
91
92 extern xbt_dynar_t _gras_timers;
93
94
95 #endif  /* GRAS_MESSAGE_PRIVATE_H */