- SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
- SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
- ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
+void sg_host_init()
+{
+ MSG_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
+ __MSG_host_priv_free((msg_host_priv_t) p);
+ });
+
+ ROUTING_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
+ delete static_cast<simgrid::surf::NetCard*>(p);
+ });
+
+ SD_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
+ SIMIX_HOST_LEVEL = simgrid::s4u::Host::extension_create(SIMIX_host_destroy);
+ USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
+}
+
+// ========== 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);