Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Action::links() cannot be used for NS3Actions
[simgrid.git] / src / surf / network_ns3.cpp
index a343a7a..aedde29 100644 (file)
@@ -90,8 +90,6 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin
                              simgrid::kernel::routing::NetPoint* gw_dst,
                              std::vector<simgrid::surf::LinkImpl*>* link_list)
 {
                              simgrid::kernel::routing::NetPoint* gw_dst,
                              std::vector<simgrid::surf::LinkImpl*>* link_list)
 {
-  static bool warned_about_long_routes = false;
-
   if (link_list->size() == 1) {
     simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list->at(0));
 
   if (link_list->size() == 1) {
     simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list->at(0));
 
@@ -117,19 +115,21 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin
     xbt_free(link_bdw);
     xbt_free(link_lat);
   } else {
     xbt_free(link_bdw);
     xbt_free(link_lat);
   } else {
+    static bool warned_about_long_routes = false;
+
     if (not warned_about_long_routes)
     if (not warned_about_long_routes)
-      XBT_INFO(
-          "Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with NS3.\n"
-          "You can ignore this warning if your hosts can still communicate when only considering routes of length 1.\n"
-          "You may also remove these routes to avoid this harmless message. Other long routes will be silently "
-          "ignored.",
-          src->cname(), dst->cname(), link_list->size());
+      XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with NS3.\n"
+               "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
+               "of length 1.\n"
+               "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
+               "ignored.",
+               src->cname(), dst->cname(), link_list->size());
     warned_about_long_routes = true;
   }
 }
 
 /* Create the ns3 topology based on routing strategy */
     warned_about_long_routes = true;
   }
 }
 
 /* Create the ns3 topology based on routing strategy */
-static void postparse_cb(void)
+static void postparse_cb()
 {
   IPV4addr.shrink_to_fit();
 
 {
   IPV4addr.shrink_to_fit();
 
@@ -197,7 +197,7 @@ double NetworkNS3Model::nextOccuringEvent(double now)
   XBT_DEBUG("ns3_next_occuring_event");
 
   //get the first relevant value from the running_actions list
   XBT_DEBUG("ns3_next_occuring_event");
 
   //get the first relevant value from the running_actions list
-  if (!getRunningActionSet()->size() || now == 0.0)
+  if (not getRunningActionSet()->size() || now == 0.0)
     return -1.0;
   else
     do {
     return -1.0;
   else
     do {
@@ -256,7 +256,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     }
   }
 
     }
   }
 
-  while (!xbt_dynar_is_empty(socket_to_destroy)){
+  while (not xbt_dynar_is_empty(socket_to_destroy)) {
     xbt_dynar_pop(socket_to_destroy,&ns3Socket);
 
     if (XBT_LOG_ISENABLED(ns3, xbt_log_priority_debug)) {
     xbt_dynar_pop(socket_to_destroy,&ns3Socket);
 
     if (XBT_LOG_ISENABLED(ns3, xbt_log_priority_debug)) {
@@ -317,7 +317,12 @@ void NetworkNS3Action::resume() {
   THROW_UNIMPLEMENTED;
 }
 
   THROW_UNIMPLEMENTED;
 }
 
-  /* Test whether a flow is suspended */
+std::list<LinkImpl*> NetworkNS3Action::links()
+{
+  THROW_UNIMPLEMENTED;
+}
+
+/* Test whether a flow is suspended */
 bool NetworkNS3Action::isSuspended()
 {
   return false;
 bool NetworkNS3Action::isSuspended()
 {
   return false;
@@ -326,7 +331,7 @@ bool NetworkNS3Action::isSuspended()
 int NetworkNS3Action::unref()
 {
   refcount_--;
 int NetworkNS3Action::unref()
 {
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     XBT_DEBUG ("Removing action %p", this);
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     XBT_DEBUG ("Removing action %p", this);
@@ -391,20 +396,20 @@ void ns3_initialize(const char* TcpProtocol){
   ns3::Config::SetDefault ("ns3::TcpSocket::SegmentSize", ns3::UintegerValue (1024)); // 1024-byte packet for easier reading
   ns3::Config::SetDefault ("ns3::TcpSocket::DelAckCount", ns3::UintegerValue (1));
 
   ns3::Config::SetDefault ("ns3::TcpSocket::SegmentSize", ns3::UintegerValue (1024)); // 1024-byte packet for easier reading
   ns3::Config::SetDefault ("ns3::TcpSocket::DelAckCount", ns3::UintegerValue (1));
 
-  if (!strcmp(TcpProtocol,"default"))
+  if (not strcmp(TcpProtocol, "default"))
     return;
 
     return;
 
-  if (!strcmp(TcpProtocol,"Reno")) {
+  if (not strcmp(TcpProtocol, "Reno")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpReno"));
     return;
   }
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpReno"));
     return;
   }
-  if (!strcmp(TcpProtocol,"NewReno")) {
+  if (not strcmp(TcpProtocol, "NewReno")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpNewReno"));
     return;
   }
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpNewReno"));
     return;
   }
-  if(!strcmp(TcpProtocol,"Tahoe")){
+  if (not strcmp(TcpProtocol, "Tahoe")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpTahoe"));
     return;
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpTahoe"));
     return;