+#include "simgrid/Host.hpp"
+#include "surf/surf.h" // routing_get_network_element_type FIXME:killme
+
+#include "src/simix/smx_private.hpp"
+
+size_t sg_host_count()
+{
+ return xbt_dict_length(host_list);
+}
+
+const char *sg_host_get_name(sg_host_t host)
+{
+ return host->getName().c_str();
+}
+
+void* sg_host_extension_get(sg_host_t host, size_t ext)
+{
+ return host->extension(ext);
+}
+
+size_t sg_host_extension_create(void(*deleter)(void*))
+{
+ return simgrid::Host::extension_create(deleter);
+}
+
+sg_host_t sg_host_by_name(const char *name)
+{
+ return simgrid::Host::by_name_or_null(name);
+}
+
+sg_host_t sg_host_by_name_or_create(const char *name)
+{
+ return simgrid::Host::by_name_or_create(name);
+}
+
+xbt_dynar_t sg_hosts_as_dynar(void)
+{
+ xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),NULL);
+
+ xbt_dict_cursor_t cursor = nullptr;
+ const char* name = nullptr;
+ simgrid::Host* host = nullptr;
+ xbt_dict_foreach(host_list, cursor, name, host)
+ if(routing_get_network_element_type(name) == SURF_NETWORK_ELEMENT_HOST)
+ xbt_dynar_push(res, &host);
+ return res;
+}
+
+// ========= Layering madness ==============
+
+int MSG_HOST_LEVEL;
+int SD_HOST_LEVEL;
+int SIMIX_HOST_LEVEL;
+int ROUTING_HOST_LEVEL;
+int USER_HOST_LEVEL;
+
+#include "src/msg/msg_private.h" // MSG_host_priv_free. FIXME: killme by initializing that level in msg when used
+#include "src/simdag/simdag_private.h" // __SD_workstation_destroy. FIXME: killme by initializing that level in simdag when used
+#include "src/simix/smx_host_private.h" // SIMIX_host_destroy. FIXME: killme by initializing that level in simix when used
+#include "src/surf/cpu_interface.hpp"
+#include "src/surf/surf_routing.hpp"