Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Link for m_file_t works on doxygen now
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004, 2005, 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef MSG_DATATYPE_H
8 #define MSG_DATATYPE_H
9 #include "xbt/misc.h"
10 #include "simgrid_config.h"     // for HAVE_TRACING
11
12 SG_BEGIN_DECL()
13
14 /* ******************************** Host ************************************ */
15
16 /** @defgroup m_datatypes_management_details Details on MSG datatypes
17     @ingroup  m_datatypes_management*/
18 typedef struct simdata_host *simdata_host_t;
19
20 /** @brief Host datatype 
21     @ingroup m_datatypes_management_details */
22 typedef struct m_host {
23   char *name;                   /**< @brief host name if any */
24   simdata_host_t simdata;       /**< @brief simulator data */
25   void *data;                   /**< @brief user data */
26 } s_m_host_t;
27
28 /** @brief Host datatype  
29     @ingroup m_datatypes_management
30
31     A <em>location</em> (or <em>host</em>) is any possible place where
32     a process may run. Thus it is represented as a <em>physical
33     resource with computing capabilities</em>, some <em>mailboxes</em>
34     to enable running process to communicate with remote ones, and
35     some <em>private data</em> that can be only accessed by local
36     process.
37
38     \see m_host_management
39   @{ */
40 typedef struct m_host *m_host_t;
41 /** @} */
42
43
44 /* ******************************** File ************************************ */
45 /** @brief File datatype
46     @ingroup m_datatypes_management_details */
47 typedef struct m_file {
48   char *name;                   /**< @brief file name */
49   void *data;                   /**< @brief user data */
50 } s_m_file_t;
51 /** @brief File datatype
52     @ingroup m_datatypes_management_details */
53 typedef struct m_file *m_file_t;
54
55
56
57 /* ******************************** Task ************************************ */
58
59 typedef struct simdata_task *simdata_task_t;
60
61 /** @brief Task datatype 
62     @ingroup m_datatypes_management_details */
63 typedef struct m_task {
64   char *name;                   /**< @brief task name if any */
65   simdata_task_t simdata;       /**< @brief simulator data */
66   void *data;                   /**< @brief user data */
67 #ifdef HAVE_TRACING
68   long long int counter;        /* task unique identifier for instrumentation */
69   char *category;               /* task category for instrumentation */
70 #endif
71 } s_m_task_t;
72
73 /** @brief Task datatype  
74     @ingroup m_datatypes_management 
75
76     A <em>task</em> may then be defined by a <em>computing
77     amount</em>, a <em>message size</em> and some <em>private
78     data</em>.
79     \see m_task_management
80   @{ */
81 typedef struct m_task *m_task_t;
82
83
84 /*************** Begin GPU ***************/
85 typedef struct simdata_gpu_task *simdata_gpu_task_t;
86
87 /** @brief GPU task datatype
88     @ingroup m_datatypes_management_details */
89 typedef struct m_gpu_task {
90   char *name;                   /**< @brief task name if any */
91   simdata_gpu_task_t simdata;       /**< @brief simulator data */
92 #ifdef HAVE_TRACING
93   long long int counter;        /* task unique identifier for instrumentation */
94   char *category;               /* task category for instrumentation */
95 #endif
96 } s_m_gpu_task_t;
97
98 /** @brief GPU task datatype
99     @ingroup m_datatypes_management
100
101     A <em>task</em> may then be defined by a <em>computing
102     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
103     \see m_task_management
104   @{ */
105 typedef struct m_gpu_task *m_gpu_task_t;
106 /*************** End GPU ***************/
107
108 /**
109  * \brief @brief Communication action
110  * \ingroup m_datatypes_management
111  *
112  * Communication actions transfer tasks between processes.
113  * For a given task, the sender and the receiver have distinct objects.
114  */
115 typedef struct msg_comm *msg_comm_t;
116
117 /** \brief Default value for an uninitialized #m_task_t.
118     \ingroup m_datatypes_management 
119 */
120 #define MSG_TASK_UNINITIALIZED NULL
121
122 /** @} */
123
124 /* ****************************** Process *********************************** */
125
126 /** @brief Process datatype
127     @ingroup m_datatypes_management 
128
129     A process may be defined as a <em>code</em>, with some <em>private
130     data</em>, executing in a <em>location</em>.
131     \see m_process_management
132   @{ */
133 typedef struct s_smx_process *m_process_t;
134 /** @} */
135
136 #ifdef MSG_USE_DEPRECATED
137 /* ********************************* Channel ******************************** */
138 /** @brief Channel datatype  
139     @ingroup m_datatypes_management 
140
141     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
142     port number does).
143     \see m_channel_management
144    @{ */
145 typedef int m_channel_t;
146 /** @} */
147 #endif
148
149 /* ******************************** Mailbox ************************************ */
150
151 typedef struct s_smx_rvpoint *msg_mailbox_t;
152 /** @brief Mailbox datatype
153     @ingroup m_datatypes_management_details @{ */
154
155 void MSG_mailbox_free(void *mailbox);
156
157
158 /** @} */
159
160
161 /* ***************************** Error handling ***************************** */
162 /** @brief Error handling 
163     @ingroup m_datatypes_management 
164          @{
165 *//* Keep these code as binary values: java bindings manipulate | of these values */
166 typedef enum {
167   MSG_OK = 0,                 /**< @brief Everything is right. Keep on going this way ! */
168   MSG_TIMEOUT = 1,            /**< @brief nothing good happened before the timer you provided elapsed */
169   MSG_TRANSFER_FAILURE = 2,   /**< @brief There has been a problem during you task
170       transfer. Either the network is down or the remote host has been
171       shutdown. */
172   MSG_HOST_FAILURE = 4,       /**< @brief System shutdown. The host on which you are
173       running has just been rebooted. Free your datastructures and
174       return now !*/
175   MSG_TASK_CANCELED = 8      /**< @brief Canceled task. This task has been canceled by somebody!*/
176 } MSG_error_t;
177 /** @} */
178
179
180 SG_END_DECL()
181 #endif