1 /* platf.h - Public interface to the SimGrid platforms */
3 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010, 2011. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include <xbt.h> /* our toolbox */
14 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
16 /** Defines whether a given resource is working or not */
18 SURF_RESOURCE_ON = 1, /**< Up & ready */
19 SURF_RESOURCE_OFF = 0 /**< Down & broken */
20 } e_surf_resource_state_t;
24 * Platform creation functions. Instead of passing 123 arguments to the creation functions
25 * (one for each possible XML attribute), we pass structures containing them all. It removes the
26 * chances of switching arguments by error, and reduce the burden when we add a new attribute:
27 * old models can just continue to ignore it without having to update their headers.
29 * It shouldn't be too costly at runtime, provided that structures living on the stack are
30 * used, instead of malloced structures.
38 tmgr_trace_t power_trace;
39 e_surf_resource_state_t initial_state;
40 tmgr_trace_t state_trace;
42 xbt_dict_t properties;
43 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
46 const char* V_router_id;
47 const char* V_router_coord;
48 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
51 const char* V_link_id;
52 double V_link_bandwidth;
53 tmgr_trace_t V_link_bandwidth_file;
54 double V_link_latency;
55 tmgr_trace_t V_link_latency_file;
56 e_surf_resource_state_t V_link_state;
57 tmgr_trace_t V_link_state_file;
58 int V_link_sharing_policy;
59 int V_policy_initial_link;
60 xbt_dict_t properties;
61 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
64 XBT_PUBLIC(void) sg_platf_open(void); // Start a new platform
65 XBT_PUBLIC(void) sg_platf_close(void); // Finish the creation of the platform
67 XBT_PUBLIC(void) sg_platf_new_AS_open(const char *id, const char *mode); // Begin description of new AS
68 XBT_PUBLIC(void) sg_platf_new_AS_close(void); // That AS is fully described
70 XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS
71 XBT_PUBLIC(void) sg_platf_new_router(sg_platf_router_cbarg_t router); // Add a router to the currently described AS
72 XBT_PUBLIC(void) sg_platf_new_link (sg_platf_link_cbarg_t link); // Add a link to the currently described AS
75 #endif /* SG_PLATF_H */