Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[route parsing] rename network_element_t into sg_routing_edge_t
[simgrid.git] / include / simgrid / platf.h
1 /* platf.h - Public interface to the SimGrid platforms                      */
2
3 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010, 2011. The SimGrid Team.
4  * All rights reserved.                                                     */
5
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. */
8
9 #ifndef SG_PLATF_H
10 #define SG_PLATF_H
11
12 #include <xbt.h>
13
14 typedef void *sg_routing_link_t; /* The actual type is model-dependent so use void* instead*/
15 typedef struct s_routing_edge *sg_routing_edge_t;
16
17
18
19 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
20 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename);
21 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
22                                                     const char *input,
23                                                     double periodicity);
24
25 /** Defines whether a given resource is working or not */
26 typedef enum {
27   SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
28   SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
29 } e_surf_resource_state_t;
30
31 typedef enum {
32   SURF_LINK_FULLDUPLEX = 2,
33   SURF_LINK_SHARED = 1,
34   SURF_LINK_FATPIPE = 0
35 } e_surf_link_sharing_policy_t;
36
37 /*
38  * Platform creation functions. Instead of passing 123 arguments to the creation functions
39  * (one for each possible XML attribute), we pass structures containing them all. It removes the
40  * chances of switching arguments by error, and reduce the burden when we add a new attribute:
41  * old models can just continue to ignore it without having to update their headers.
42  *
43  * It shouldn't be too costly at runtime, provided that structures living on the stack are
44  * used, instead of malloced structures.
45  */
46
47 typedef struct {
48   const char* id;
49   double power_peak;
50   int core_amount;
51   double power_scale;
52   tmgr_trace_t power_trace;
53   e_surf_resource_state_t initial_state;
54   tmgr_trace_t state_trace;
55   const char* coord;
56   xbt_dict_t properties;
57 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
58
59 typedef struct {
60   const char* id;
61   const char* coord;
62 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
63
64 typedef struct {
65   const char* id;
66   double bandwidth;
67   tmgr_trace_t bandwidth_trace;
68   double latency;
69   tmgr_trace_t latency_trace;
70   e_surf_resource_state_t state;
71   tmgr_trace_t state_trace;
72   e_surf_link_sharing_policy_t policy;
73   xbt_dict_t properties;
74 } s_sg_platf_link_cbarg_t, *sg_platf_link_cbarg_t;
75
76 typedef struct s_sg_platf_peer_cbarg *sg_platf_peer_cbarg_t;
77 typedef struct s_sg_platf_peer_cbarg {
78   const char* id;
79   double power;
80   double bw_in;
81   double bw_out;
82   double lat;
83   const char* coord;
84   tmgr_trace_t availability_trace;
85   tmgr_trace_t state_trace;
86 } s_sg_platf_peer_cbarg_t;
87
88 typedef struct s_sg_platf_linkctn_cbarg *sg_platf_linkctn_cbarg_t;
89 typedef struct s_sg_platf_linkctn_cbarg {
90   const char *id;
91   const char *direction;
92 } s_sg_platf_linkctn_cbarg_t;
93
94 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
95 typedef struct s_sg_platf_cluster_cbarg {
96   const char* id;
97   const char* prefix;
98   const char* suffix;
99   const char* radical;
100   double power;
101   int core_amount;
102   double bw;
103   double lat;
104   double bb_bw;
105   double bb_lat;
106   const char* router_id;
107   e_surf_link_sharing_policy_t sharing_policy;
108   e_surf_link_sharing_policy_t bb_sharing_policy;
109   const char* availability_trace; //don't convert to tmgr_trace_t since there is a trace per host and some rewriting is needed
110   const char* state_trace;
111 } s_sg_platf_cluster_cbarg_t;
112
113 typedef struct {
114   const char* id;
115   const char* type_id;
116 } s_sg_platf_storage_cbarg_t, *sg_platf_storage_cbarg_t;
117
118 typedef struct {
119   const char* id;
120   const char* model;
121   const char* content;
122   xbt_dict_t properties;
123 } s_sg_platf_storage_type_cbarg_t, *sg_platf_storage_type_cbarg_t;
124
125 typedef struct {
126   const char* type_id;
127   const char* name;
128 } s_sg_platf_mstorage_cbarg_t, *sg_platf_mstorage_cbarg_t;
129
130 typedef struct {
131   const char* id;
132   const char* name;
133 } s_sg_platf_mount_cbarg_t, *sg_platf_mount_cbarg_t;
134
135
136 XBT_PUBLIC(void) sg_platf_begin(void);  // Start a new platform
137 XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform
138
139 XBT_PUBLIC(void) sg_platf_new_AS_begin(const char *id, const char *mode); // Begin description of new AS
140 XBT_PUBLIC(void) sg_platf_new_AS_end(void);                            // That AS is fully described
141
142 XBT_PUBLIC(void) sg_platf_new_host   (sg_platf_host_cbarg_t   host);   // Add an host   to the currently described AS
143 XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router  to the currently described AS
144 XBT_PUBLIC(void) sg_platf_new_link   (sg_platf_link_cbarg_t link);     // Add a link    to the currently described AS
145 XBT_PUBLIC(void) sg_platf_new_peer   (sg_platf_peer_cbarg_t peer);     // Add a peer    to the currently described AS
146 XBT_PUBLIC(void) sg_platf_new_cluster(sg_platf_cluster_cbarg_t clust); // Add a cluster to the currently described AS
147 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
148 XBT_PUBLIC(void) sg_platf_new_storage(sg_platf_storage_cbarg_t storage); // Add a storage to the currently described AS
149 XBT_PUBLIC(void) sg_platf_new_mstorage(sg_platf_mstorage_cbarg_t mstorage);
150 XBT_PUBLIC(void) sg_platf_new_storage_type(sg_platf_storage_type_cbarg_t storage_type);
151 XBT_PUBLIC(void) sg_platf_new_mount(sg_platf_mount_cbarg_t mount);
152
153 #endif                          /* SG_PLATF_H */