+xbt_dynar_t sg_hosts_as_dynar()
+{
+ xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),nullptr);
+
+ xbt_dict_cursor_t cursor = nullptr;
+ const char* name = nullptr;
+ simgrid::s4u::Host* host = nullptr;
+ xbt_dict_foreach(host_list, cursor, name, host)
+ if (host && host->pimpl_netcard && host->pimpl_netcard->isHost())
+ xbt_dynar_push(res, &host);
+ return res;
+}
+
+// ========= Layering madness ==============*
+
+#include "src/surf/cpu_interface.hpp"
+#include "src/surf/surf_routing.hpp"
+
+// ========== User data Layer ==========
+void *sg_host_user(sg_host_t host) {
+ return host->extension(USER_HOST_LEVEL);
+}
+void sg_host_user_set(sg_host_t host, void* userdata) {
+ host->extension_set(USER_HOST_LEVEL,userdata);
+}
+void sg_host_user_destroy(sg_host_t host) {
+ host->extension_set(USER_HOST_LEVEL, nullptr);
+}