Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Try to fix header dependency hell
[simgrid.git] / include / simgrid / forward.h
1 /* Copyright (c) 2004-2015. 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 SG_PLATF_TYPES_H
8 #define SG_PLATF_TYPES_H
9
10 #include <xbt.h>
11 #include <simgrid/host.h>
12
13 #ifdef __cplusplus
14
15 class Cpu;
16 class RoutingEdge;
17
18 #else
19
20 typedef struct Cpu Cpu;
21 typedef struct RoutingEdge RoutingEdge;
22
23 #endif
24
25 typedef Cpu *surf_cpu_t;
26 typedef RoutingEdge *routing_edge_t;
27 typedef RoutingEdge *sg_routing_edge_t;
28
29
30
31 // Types which are in fact dictelmt:
32
33 typedef xbt_dictelm_t sg_host_t;
34 typedef xbt_dictelm_t sg_storage_t;
35
36
37 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
38
39 typedef void *sg_routing_link_t; /* FIXME:The actual type is model-dependent so use void* instead*/
40
41 /** @ingroup SURF_interface
42 * @brief Defines whether a given resource is working or not */
43 typedef enum {
44   SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
45   SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
46 } e_surf_resource_state_t;
47
48 typedef enum {
49   SURF_LINK_FULLDUPLEX = 2,
50   SURF_LINK_SHARED = 1,
51   SURF_LINK_FATPIPE = 0
52 } e_surf_link_sharing_policy_t;
53
54 typedef enum {
55   SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4,
56   SURF_TRACE_CONNECT_KIND_POWER = 3,
57   SURF_TRACE_CONNECT_KIND_LINK_AVAIL = 2,
58   SURF_TRACE_CONNECT_KIND_BANDWIDTH = 1,
59   SURF_TRACE_CONNECT_KIND_LATENCY = 0
60 } e_surf_trace_connect_kind_t;
61
62 typedef enum {
63   SURF_PROCESS_ON_FAILURE_DIE = 1,
64   SURF_PROCESS_ON_FAILURE_RESTART = 0
65 } e_surf_process_on_failure_t;
66
67 typedef enum {
68   SURF_CLUSTER_FAT_TREE=2,
69   SURF_CLUSTER_FLAT = 1,
70   SURF_CLUSTER_TORUS = 0
71 } e_surf_cluster_topology_t;
72
73
74 /** @ingroup m_datatypes_management_details
75  * @brief Type for any simgrid size
76  */
77 typedef unsigned long long sg_size_t;
78
79 /** @ingroup m_datatypes_management_details
80  * @brief Type for any simgrid offset
81  */
82 typedef long long sg_offset_t;
83
84 /*
85  * Platform creation functions. Instead of passing 123 arguments to the creation functions
86  * (one for each possible XML attribute), we pass structures containing them all. It removes the
87  * chances of switching arguments by error, and reduce the burden when we add a new attribute:
88  * old models can just continue to ignore it without having to update their headers.
89  *
90  * It shouldn't be too costly at runtime, provided that structures living on the stack are
91  * used, instead of malloced structures.
92  */
93
94 typedef struct {
95   const char* id;
96   xbt_dynar_t speed_peak;
97   int pstate;
98   int core_amount;
99   double speed_scale;
100   tmgr_trace_t speed_trace;
101   e_surf_resource_state_t initial_state;
102   tmgr_trace_t state_trace;
103   const char* coord;
104   xbt_dict_t properties;
105 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
106
107 #define SG_PLATF_HOST_INITIALIZER { \
108     NULL, 0, 1, 1, 1., NULL, SURF_RESOURCE_ON, NULL, \
109     NULL, NULL \
110 }
111
112 typedef struct {
113   const char* id;
114   const char* link_up;
115   const char* link_down;
116 } s_sg_platf_host_link_cbarg_t, *sg_platf_host_link_cbarg_t;
117
118 #define SG_PLATF_HOST_LINK_INITIALIZER {NULL,NULL,NULL}
119
120 typedef struct {
121   const char* id;
122   const char* coord;
123 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
124
125 #define SG_PLATF_ROUTER_INITIALIZER {NULL,NULL}
126
127 typedef struct {
128   const char* id;
129   double bandwidth;
130   tmgr_trace_t bandwidth_trace;
131   double latency;
132   tmgr_trace_t latency_trace;
133   e_surf_resource_state_t state;
134   tmgr_trace_t state_trace;
135   e_surf_link_sharing_policy_t policy;
136   xbt_dict_t properties;
137 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
138
139 #define SG_PLATF_LINK_INITIALIZER {\
140   NULL, 0., NULL, 0., NULL, SURF_RESOURCE_ON, \
141   NULL, SURF_LINK_SHARED, NULL \
142 }
143
144 typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t;
145 typedef struct s_sg_platf_peer_cbarg {
146   const char* id;
147   double speed;
148   double bw_in;
149   double bw_out;
150   double lat;
151   const char* coord;
152   tmgr_trace_t availability_trace;
153   tmgr_trace_t state_trace;
154 } s_sg_platf_peer_cbarg_t;
155
156 #define SG_PLATF_PEER_INITIALIZER {NULL,0.0,0.0,0.0,0.0,NULL,NULL,NULL}
157
158 typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t;
159 typedef struct s_sg_platf_route_cbarg {
160   int symmetrical;
161   const char *src;
162   const char *dst;
163   sg_routing_edge_t gw_src;
164   sg_routing_edge_t gw_dst;
165   xbt_dynar_t link_list;
166 } s_sg_platf_route_cbarg_t;
167
168 #define SG_PLATF_ROUTE_INITIALIZER {1,NULL,NULL,NULL,NULL,NULL}
169
170 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
171 typedef struct s_sg_platf_cluster_cbarg {
172   const char* id;
173   const char* prefix;
174   const char* suffix;
175   const char* radical;
176   double speed;
177   int core_amount;
178   double bw;
179   double lat;
180   double bb_bw;
181   double bb_lat;
182   double loopback_bw;
183   double loopback_lat;
184   double limiter_link;
185   e_surf_cluster_topology_t topology;
186   const char* topo_parameters;
187   xbt_dict_t properties;
188   const char* router_id;
189   e_surf_link_sharing_policy_t sharing_policy;
190   e_surf_link_sharing_policy_t bb_sharing_policy;
191   const char* availability_trace; //don't convert to tmgr_trace_t since there is a trace per host and some rewriting is needed
192   const char* state_trace;
193 } s_sg_platf_cluster_cbarg_t;
194
195 #define SG_PLATF_CLUSTER_INITIALIZER {NULL,NULL,NULL,NULL,0.0,1 \
196   ,1.,1.,0.,0.,0.,0.,0. \
197   ,SURF_CLUSTER_FLAT,NULL,NULL,NULL, \
198   SURF_LINK_SHARED,SURF_LINK_SHARED,NULL \
199   ,NULL}
200
201 typedef struct s_sg_platf_cabinet_cbarg *sg_platf_cabinet_cbarg_t;
202 typedef struct s_sg_platf_cabinet_cbarg {
203   const char* id;
204   const char* prefix;
205   const char* suffix;
206   const char* radical;
207   double speed;
208   double bw;
209   double lat;
210 } s_sg_platf_cabinet_cbarg_t;
211
212 #define SG_PLATF_CABINET_INITIALIZER {NULL,NULL,NULL,NULL,0.0,0.0,0.0}
213
214 typedef struct {
215   const char* id;
216   const char* type_id;
217   const char* content;
218   const char* content_type;
219   xbt_dict_t properties;
220   const char* attach;
221 } s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
222
223 #define SG_PLATF_STORAGE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL}
224
225 typedef struct {
226   const char* id;
227   const char* model;
228   const char* content;
229   const char* content_type;
230   xbt_dict_t properties;
231   xbt_dict_t model_properties;
232   sg_size_t size;
233 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
234
235 #define SG_PLATF_STORAGE_TYPE_INITIALIZER {NULL,NULL,NULL,NULL,NULL,NULL}
236
237 typedef struct {
238   const char* type_id;
239   const char* name;
240 } s_sg_platf_mstorage_cbarg_t, *sg_platf_mstorage_cbarg_t;
241
242 #define SG_PLATF_MSTORAGE_INITIALIZER {NULL,NULL}
243
244 typedef struct {
245   const char* storageId;
246   const char* name;
247 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
248
249 #define SG_PLATF_MOUNT_INITIALIZER {NULL,NULL}
250
251 typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
252 typedef struct s_sg_platf_prop_cbarg {
253   const char *id;
254   const char *value;
255 } s_sg_platf_prop_cbarg_t;
256
257 #define SG_PLATF_PROP_INITIALIZER {NULL,NULL}
258
259 typedef struct s_sg_platf_trace_cbarg *sg_platf_trace_cbarg_t;
260 typedef struct s_sg_platf_trace_cbarg {
261   const char *id;
262   const char *file;
263   double periodicity;
264   const char *pc_data;
265 } s_sg_platf_trace_cbarg_t;
266
267 #define SG_PLATF_TRACE_INITIALIZER {NULL,NULL,0.0,NULL}
268
269 typedef struct s_sg_platf_trace_connect_cbarg *sg_platf_trace_connect_cbarg_t;
270 typedef struct s_sg_platf_trace_connect_cbarg {
271   e_surf_trace_connect_kind_t kind;
272   const char *trace;
273   const char *element;
274 } s_sg_platf_trace_connect_cbarg_t;
275
276 #define SG_PLATF_TRACE_CONNECT_INITIALIZER {SURF_TRACE_CONNECT_KIND_LATENCY,NULL,NULL}
277
278 typedef struct s_sg_platf_process_cbarg *sg_platf_process_cbarg_t;
279 typedef struct s_sg_platf_process_cbarg {
280   const char **argv;
281   int argc;
282   xbt_dict_t properties;
283   const char *host;
284   const char *function;
285   double start_time;
286   double kill_time;
287   e_surf_process_on_failure_t on_failure;
288 } s_sg_platf_process_cbarg_t;
289
290 #define SG_PLATF_PROCESS_INITIALIZER {NULL,0,NULL,NULL,NULL,-1.0,-1.0,SURF_PROCESS_ON_FAILURE_DIE}
291
292 typedef struct s_sg_platf_AS_cbarg *sg_platf_AS_cbarg_t;
293 typedef struct s_sg_platf_AS_cbarg {
294   const char *id;
295   int routing;
296 } s_sg_platf_AS_cbarg_t;
297
298 #define SG_PLATF_AS_INITIALIZER {NULL,0}
299
300 /** opaque structure defining a event generator for availability based on a probability distribution */
301 typedef struct probabilist_event_generator *probabilist_event_generator_t;
302
303 #endif