Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make smx_file_t, surf_file_t and msg_file_t
[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 /* ******************************** Task ************************************ */
44
45 typedef struct simdata_task *simdata_task_t;
46
47 /** @brief Task datatype 
48     @ingroup m_datatypes_management_details */
49 typedef struct m_task {
50   char *name;                   /**< @brief task name if any */
51   simdata_task_t simdata;       /**< @brief simulator data */
52   void *data;                   /**< @brief user data */
53 #ifdef HAVE_TRACING
54   long long int counter;        /* task unique identifier for instrumentation */
55   char *category;               /* task category for instrumentation */
56 #endif
57 } s_m_task_t;
58
59 /** @brief Task datatype  
60     @ingroup m_datatypes_management 
61
62     A <em>task</em> may then be defined by a <em>computing
63     amount</em>, a <em>message size</em> and some <em>private
64     data</em>.
65     \see m_task_management
66   @{ */
67 typedef struct m_task *m_task_t;
68
69 /* ******************************** File ************************************ */
70
71 typedef struct simdata_file *simdata_file_t;
72
73 /** @brief File datatype
74     @ingroup m_datatypes_management_details */
75 typedef struct msg_file {
76   char *name;                   /**< @brief file name */
77   simdata_file_t simdata;                /**< @brief simulator data  */
78   void *data;                   /**< @brief user data */
79 } s_msg_file_t;
80 /** @brief File datatype
81     @ingroup m_datatypes_management_details */
82 typedef struct msg_file *msg_file_t;
83
84
85 /*************** Begin GPU ***************/
86 typedef struct simdata_gpu_task *simdata_gpu_task_t;
87
88 /** @brief GPU task datatype
89     @ingroup m_datatypes_management_details */
90 typedef struct m_gpu_task {
91   char *name;                   /**< @brief task name if any */
92   simdata_gpu_task_t simdata;       /**< @brief simulator data */
93 #ifdef HAVE_TRACING
94   long long int counter;        /* task unique identifier for instrumentation */
95   char *category;               /* task category for instrumentation */
96 #endif
97 } s_m_gpu_task_t;
98
99 /** @brief GPU task datatype
100     @ingroup m_datatypes_management
101
102     A <em>task</em> may then be defined by a <em>computing
103     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
104     \see m_task_management
105   @{ */
106 typedef struct m_gpu_task *m_gpu_task_t;
107 /*************** End GPU ***************/
108
109 /**
110  * \brief @brief Communication action
111  * \ingroup m_datatypes_management
112  *
113  * Communication actions transfer tasks between processes.
114  * For a given task, the sender and the receiver have distinct objects.
115  */
116 typedef struct msg_comm *msg_comm_t;
117
118 /** \brief Default value for an uninitialized #m_task_t.
119     \ingroup m_datatypes_management 
120 */
121 #define MSG_TASK_UNINITIALIZED NULL
122
123 /** @} */
124
125 /* ****************************** Process *********************************** */
126
127 /** @brief Process datatype
128     @ingroup m_datatypes_management 
129
130     A process may be defined as a <em>code</em>, with some <em>private
131     data</em>, executing in a <em>location</em>.
132     \see m_process_management
133   @{ */
134 typedef struct s_smx_process *m_process_t;
135 /** @} */
136
137 #ifdef MSG_USE_DEPRECATED
138 /* ********************************* Channel ******************************** */
139 /** @brief Channel datatype  
140     @ingroup msg_deprecated_functions
141
142     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
143     port number does).
144     \see m_channel_management
145    @{ */
146 typedef int m_channel_t;
147 /** @} */
148 #endif
149
150 /* ******************************** Mailbox ************************************ */
151
152 typedef struct s_smx_rvpoint *msg_mailbox_t;
153 /** @brief Mailbox datatype
154     @ingroup m_datatypes_management_details @{ */
155
156 void MSG_mailbox_free(void *mailbox);
157
158
159 /** @} */
160
161
162 /* ***************************** Error handling ***************************** */
163 /** @brief Error handling 
164     @ingroup m_datatypes_management 
165          @{
166 *//* Keep these code as binary values: java bindings manipulate | of these values */
167 typedef enum {
168   MSG_OK = 0,                 /**< @brief Everything is right. Keep on going this way ! */
169   MSG_TIMEOUT = 1,            /**< @brief nothing good happened before the timer you provided elapsed */
170   MSG_TRANSFER_FAILURE = 2,   /**< @brief There has been a problem during you task
171       transfer. Either the network is down or the remote host has been
172       shutdown. */
173   MSG_HOST_FAILURE = 4,       /**< @brief System shutdown. The host on which you are
174       running has just been rebooted. Free your datastructures and
175       return now !*/
176   MSG_TASK_CANCELED = 8      /**< @brief Canceled task. This task has been canceled by somebody!*/
177 } MSG_error_t;
178 /** @} */
179
180
181 SG_END_DECL()
182 #endif