*/
/********************************* Host **************************************/
-m_host_t __MSG_host_create(smx_host_t workstation, void *data)
+m_host_t __MSG_host_create(smx_host_t workstation)
{
const char *name;
simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
/* Host structure */
host->name = xbt_strdup(name);
host->simdata = simdata;
- host->data = data;
simdata->smx_host = workstation;
return host;
}
+/** \ingroup msg_host_management
+ * \brief Finds a m_host_t using its name.
+ *
+ * This is a name directory service
+ * \param name the name of an host.
+ * \return the corresponding host
+ */
+m_host_t MSG_get_host_by_name(const char *name)
+{
+ smx_host_t simix_h = NULL;
+ simix_h = simcall_host_get_by_name(name);
+
+ if (simix_h == NULL)
+ return NULL;
+
+ return (m_host_t) simcall_host_get_data(simix_h);
+}
+
+
/** \ingroup m_host_management
*
* \brief Set the user data of a #m_host_t.
*/
MSG_error_t MSG_host_set_data(m_host_t host, void *data)
{
- xbt_assert((host != NULL), "Invalid parameters");
- xbt_assert((host->data == NULL), "Data already set");
-
- /* Assign data */
- host->data = data;
+ SIMIX_host_set_data(host->simdata->smx_host,data);
return MSG_OK;
}
void *MSG_host_get_data(m_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
-
- /* Return data */
- return (host->data);
+ return SIMIX_host_get_data(host->simdata->smx_host);
}
/** \ingroup m_host_management