X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fdbc52907d138de71505e054454de0f33954598f..804a928876d05cb880d699e255789597781a6502:/src/s4u/s4u_Link.cpp diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index bec2b9e757..dd77817a48 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -11,6 +11,7 @@ #include "simgrid/simix.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/network_wifi.hpp" #include "xbt/log.h" namespace simgrid { @@ -75,6 +76,15 @@ Link::SharingPolicy Link::get_sharing_policy() const return this->pimpl_->get_sharing_policy(); } +void Link::set_host_wifi_rate(const s4u::Host* host, int level) const +{ + xbt_assert(pimpl_->get_sharing_policy() == Link::SharingPolicy::WIFI, "Link %s does not seem to be a wifi link.", + get_cname()); + auto* wlink = dynamic_cast(pimpl_); + xbt_assert(wlink != nullptr, "Cannot convert link %s into a wifi link.", get_cname()); + wlink->set_host_rate(host, level); +} + double Link::get_usage() const { return this->pimpl_->get_constraint()->get_usage(); @@ -131,7 +141,7 @@ sg_link_t sg_link_by_name(const char* name) int sg_link_is_shared(const_sg_link_t link) { - return (int)link->get_sharing_policy(); + return link->get_sharing_policy() != simgrid::s4u::Link::SharingPolicy::FATPIPE; } double sg_link_bandwidth(const_sg_link_t link) {