1 /* platf.h - Public interface to the SimGrid platforms */
3 /* Copyright (c) 2004-2012. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
13 typedef void *sg_routing_link_t; /* The actual type is model-dependent so use void* instead*/
14 typedef struct s_routing_edge *sg_routing_edge_t;
16 XBT_PUBLIC(sg_routing_edge_t) sg_routing_edge_by_name_or_null(const char *name);
20 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
22 /** opaque structure defining a event generator for availability based on a probability distribution */
23 typedef struct probabilist_event_generator *probabilist_event_generator_t;
25 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename);
26 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
29 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_generator(const char *id,
30 probabilist_event_generator_t generator1,
31 probabilist_event_generator_t generator2,
34 XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_uniform(const char* id,
37 XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_exponential(const char* id,
39 XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_weibull(const char* id,
43 /** Defines whether a given resource is working or not */
45 SURF_RESOURCE_ON = 1, /**< Up & ready */
46 SURF_RESOURCE_OFF = 0 /**< Down & broken */
47 } e_surf_resource_state_t;
50 SURF_LINK_FULLDUPLEX = 2,
53 } e_surf_link_sharing_policy_t;
56 SURF_LINK_DIRECTION_NONE = 2,
57 SURF_LINK_DIRECTION_UP = 1,
58 SURF_LINK_DIRECTION_DOWN = 0
59 } e_surf_link_ctn_direction_t;
62 SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4,
63 SURF_TRACE_CONNECT_KIND_POWER = 3,
64 SURF_TRACE_CONNECT_KIND_LINK_AVAIL = 2,
65 SURF_TRACE_CONNECT_KIND_BANDWIDTH = 1,
66 SURF_TRACE_CONNECT_KIND_LATENCY = 0
67 } e_surf_trace_connect_kin_t;
69 * Platform creation functions. Instead of passing 123 arguments to the creation functions
70 * (one for each possible XML attribute), we pass structures containing them all. It removes the
71 * chances of switching arguments by error, and reduce the burden when we add a new attribute:
72 * old models can just continue to ignore it without having to update their headers.
74 * It shouldn't be too costly at runtime, provided that structures living on the stack are
75 * used, instead of malloced structures.
83 tmgr_trace_t power_trace;
84 e_surf_resource_state_t initial_state;
85 tmgr_trace_t state_trace;
87 xbt_dict_t properties;
88 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
93 const char* link_down;
94 } s_sg_platf_host_link_cbarg_t, *sg_platf_host_link_cbarg_t;
100 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
105 tmgr_trace_t bandwidth_trace;
107 tmgr_trace_t latency_trace;
108 e_surf_resource_state_t state;
109 tmgr_trace_t state_trace;
110 e_surf_link_sharing_policy_t policy;
111 xbt_dict_t properties;
112 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
114 typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t;
115 typedef struct s_sg_platf_peer_cbarg {
122 tmgr_trace_t availability_trace;
123 tmgr_trace_t state_trace;
124 } s_sg_platf_peer_cbarg_t;
126 typedef struct s_sg_platf_linkctn_cbarg *sg_platf_linkctn_cbarg_t;
127 typedef struct s_sg_platf_linkctn_cbarg {
129 e_surf_link_ctn_direction_t direction;
130 } s_sg_platf_linkctn_cbarg_t;
132 typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t;
133 typedef struct s_sg_platf_route_cbarg {
137 } s_sg_platf_route_cbarg_t;
139 typedef struct s_sg_platf_ASroute_cbarg *sg_platf_ASroute_cbarg_t;
140 typedef struct s_sg_platf_ASroute_cbarg {
146 } s_sg_platf_ASroute_cbarg_t;
148 typedef struct s_sg_platf_bypassRoute_cbarg *sg_platf_bypassRoute_cbarg_t;
149 typedef struct s_sg_platf_bypassRoute_cbarg {
152 } s_sg_platf_bypassRoute_cbarg_t;
154 typedef struct s_sg_platf_bypassASroute_cbarg *sg_platf_bypassASroute_cbarg_t;
155 typedef struct s_sg_platf_bypassASroute_cbarg {
160 } s_sg_platf_bypassASroute_cbarg_t;
162 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
163 typedef struct s_sg_platf_cluster_cbarg {
174 const char* router_id;
175 e_surf_link_sharing_policy_t sharing_policy;
176 e_surf_link_sharing_policy_t bb_sharing_policy;
177 const char* availability_trace; //don't convert to tmgr_trace_t since there is a trace per host and some rewriting is needed
178 const char* state_trace;
179 } s_sg_platf_cluster_cbarg_t;
181 typedef struct s_sg_platf_cabinet_cbarg *sg_platf_cabinet_cbarg_t;
182 typedef struct s_sg_platf_cabinet_cbarg {
190 } s_sg_platf_cabinet_cbarg_t;
196 } s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
202 xbt_dict_t properties;
203 unsigned long size; /* size in Gbytes */
204 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
209 } s_sg_platf_mstorage_cbarg_t, *sg_platf_mstorage_cbarg_t;
214 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
216 typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t;
217 typedef struct s_sg_platf_prop_cbarg {
220 } s_sg_platf_prop_cbarg_t;
222 typedef struct s_sg_platf_trace_cbarg *sg_platf_trace_cbarg_t;
223 typedef struct s_sg_platf_trace_cbarg {
228 } s_sg_platf_trace_cbarg_t;
230 typedef struct s_sg_platf_trace_connect_cbarg *sg_platf_trace_connect_cbarg_t;
231 typedef struct s_sg_platf_trace_connect_cbarg {
232 e_surf_trace_connect_kin_t kind;
235 } s_sg_platf_trace_connect_cbarg_t;
237 XBT_PUBLIC(void) sg_platf_begin(void); // Start a new platform
238 XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform
240 XBT_PUBLIC(void) sg_platf_new_AS_begin(const char *id, int mode); // Begin description of new AS
241 XBT_PUBLIC(void) sg_platf_new_AS_end(void); // That AS is fully described
243 XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS
244 XBT_PUBLIC(void) sg_platf_new_host_link(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
245 XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router to the currently described AS
246 XBT_PUBLIC(void) sg_platf_new_link (sg_platf_link_cbarg_t link); // Add a link to the currently described AS
247 XBT_PUBLIC(void) sg_platf_new_linkctn (sg_platf_linkctn_cbarg_t linkctn); // Add a linkctn
248 XBT_PUBLIC(void) sg_platf_new_peer (sg_platf_peer_cbarg_t peer); // Add a peer to the currently described AS
249 XBT_PUBLIC(void) sg_platf_new_cluster(sg_platf_cluster_cbarg_t clust); // Add a cluster to the currently described AS
250 XBT_PUBLIC(void) sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet); // Add a cabinet to the currently described AS
252 XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route
253 XBT_PUBLIC(void) sg_platf_new_ASroute (sg_platf_ASroute_cbarg_t ASroute); // Add an ASroute
254 XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_bypassRoute_cbarg_t bypassroute); // Add a bypassRoute
255 XBT_PUBLIC(void) sg_platf_new_bypassASroute (sg_platf_bypassASroute_cbarg_t bypassASroute); // Add an bypassASroute
256 XBT_PUBLIC(void) sg_platf_new_prop (sg_platf_prop_cbarg_t prop); // Add a prop
258 XBT_PUBLIC(void) sg_platf_new_trace(sg_platf_trace_cbarg_t trace);
259 XBT_PUBLIC(void) sg_platf_new_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect);
261 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
262 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
263 XBT_PUBLIC(void) sg_platf_new_mstorage(sg_platf_mstorage_cbarg_t mstorage);
264 XBT_PUBLIC(void) sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type);
265 XBT_PUBLIC(void) sg_platf_new_mount(sg_platf_mount_cbarg_t mount);
267 #endif /* SG_PLATF_H */