1 /* Copyright (c) 2004-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "msg_private.h"
8 #include "xbt/sysdep.h"
17 /********************************* MSG **************************************/
19 /** \ingroup msg_simulation
20 * \brief A platform constructor.
22 * Creates a new platform, including hosts, links and the routing_table.
23 * \param file a filename of a xml description of a platform. This file follows this DTD :
25 * \include simgrid.dtd
27 * Here is a small example of such a platform
29 * \include small_platform.xml
31 * Have a look in the directory examples/msg/ to have a big example.
33 void MSG_create_environment(const char *file)
35 SIMIX_create_environment(file);
38 void MSG_post_create_environment(void) {
39 xbt_lib_cursor_t cursor;
43 /* Initialize MSG storages */
44 xbt_lib_foreach(storage_lib, cursor, name, data) {
45 if(data[SIMIX_STORAGE_LEVEL])
46 __MSG_storage_create(xbt_dict_cursor_get_elm(cursor));
50 msg_as_t MSG_environment_get_routing_root() {
51 return surf_AS_get_routing_root();
54 const char *MSG_environment_as_get_name(msg_as_t as) {
55 return surf_AS_get_name(as);
58 msg_as_t MSG_environment_as_get_by_name(const char * name) {
59 return surf_AS_get_by_name(name);
62 xbt_dict_t MSG_environment_as_get_routing_sons(msg_as_t as) {
63 xbt_dict_t res = surf_AS_get_children(as);
67 const char *MSG_environment_as_get_property_value(msg_as_t as, const char *name)
69 xbt_dict_t dict = (xbt_dict_t) xbt_lib_get_or_null(as_router_lib, MSG_environment_as_get_name(as), ROUTING_PROP_ASR_LEVEL);
72 return (char*) xbt_dict_get_or_null(dict, name);
75 xbt_dynar_t MSG_environment_as_get_hosts(msg_as_t as) {
76 return surf_AS_get_hosts(as);