Logo AND Algorithmique Numérique Distribuée

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