3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. 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. */
10 #include "xbt/error.h"
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(environment, msg,
12 "Logging specific to MSG (environment)");
14 /********************************* MSG **************************************/
16 /** \ingroup msg_easier_life
17 * \brief A name directory service...
19 * Finds a m_host_t using its name.
20 * \param name the name of an host.
21 * \return the corresponding host
23 m_host_t MSG_get_host_by_name(const char *name)
25 xbt_fifo_item_t i = NULL;
28 xbt_assert0(((msg_global != NULL)
29 && (msg_global->host != NULL)), "Environment not set yet");
31 xbt_fifo_foreach(msg_global->host,i,host,m_host_t) {
32 if(strcmp(host->name, name) == 0) return host;
37 /** \ingroup msg_easier_life
38 * \brief A platform constructor.
40 * Creates a new platform, including hosts, links and the
42 * \param file a filename of a xml description of a platform. This file
45 * \include surfxml.dtd
47 * Here is a small example of such a platform
49 * \include small_platform.xml
51 * Have a look in the directory examples/msg/ to have a big example.
53 void MSG_create_environment(const char *file) {
54 xbt_dict_cursor_t cursor = NULL;
56 void *workstation = NULL;
58 surf_workstation_resource_init_CLM03(file);
59 /* surf_workstation_resource_init_KCCFLN05(file); */
61 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
62 __MSG_host_create(name, workstation, NULL);