Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns3: rename a type for consistency
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 23:00:59 +0000 (00:00 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 23:00:59 +0000 (00:00 +0100)
src/surf/network_ns3.cpp
src/surf/ns3/ns3_interface.cc
src/surf/ns3/ns3_interface.h

index 2624c3e..fece65a 100644 (file)
@@ -124,8 +124,8 @@ static void parse_ns3_add_cluster(sg_platf_cluster_cbarg_t cluster)
     router_id = bprintf("ns3_%s%d%s", cluster->prefix, elmts, cluster->suffix);
     XBT_DEBUG("Create link from '%s' to '%s'",host_id,router_id);
 
-    ns3_nodes_t host_src = ns3_find_host(host_id);
-    ns3_nodes_t host_dst = ns3_find_host(router_id);
+    ns3_node_t host_src = ns3_find_host(host_id);
+    ns3_node_t host_dst = ns3_find_host(router_id);
 
     if(host_src && host_dst){}
     else xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);
@@ -181,12 +181,12 @@ static void create_ns3_topology(void)
       XBT_DEBUG("\tLink (%s) bdw:%s lat:%s", link->getName(), link_bdw, link_lat);
 
       //create link ns3
-      ns3_nodes_t host_src = ns3_find_host(src);
+      ns3_node_t host_src = ns3_find_host(src);
       if (!host_src)
-        host_src = static_cast<ns3_nodes_t>(xbt_lib_get_or_null(as_router_lib,src,NS3_ASR_LEVEL));
-      ns3_nodes_t host_dst = ns3_find_host(dst);
+        host_src = static_cast<ns3_node_t>(xbt_lib_get_or_null(as_router_lib,src,NS3_ASR_LEVEL));
+      ns3_node_t host_dst = ns3_find_host(dst);
       if(!host_dst)
-        host_dst = static_cast<ns3_nodes_t>(xbt_lib_get_or_null(as_router_lib,dst,NS3_ASR_LEVEL));
+        host_dst = static_cast<ns3_node_t>(xbt_lib_get_or_null(as_router_lib,dst,NS3_ASR_LEVEL));
 
       if (!host_src || !host_dst)
           xbt_die("\tns3_add_link from %d to %d",host_src->node_num,host_dst->node_num);
@@ -225,7 +225,7 @@ static void free_ns3_link(void * elmts)
 
 static void free_ns3_host(void * elmts)
 {
-  ns3_nodes_t host = static_cast<ns3_nodes_t>(elmts);
+  ns3_node_t host = static_cast<ns3_node_t>(elmts);
   free(host);
 }
 
index 95ca5f8..8a0055a 100644 (file)
@@ -54,8 +54,8 @@ char ns3_get_socket_is_finished(void *socket){
 
 int ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,void * action)
 {
-       ns3_nodes_t node1 = ns3_find_host(a);
-       ns3_nodes_t node2 = ns3_find_host(b);
+       ns3_node_t node1 = ns3_find_host(a);
+       ns3_node_t node2 = ns3_find_host(b);
 
        Ptr<Node> src_node = nodes.Get(node1->node_num);
        Ptr<Node> dst_node = nodes.Get(node2->node_num);
@@ -122,7 +122,7 @@ int ns3_initialize(const char* TcpProtocol){
 
 void * ns3_add_host(const char * id)
 {
-       ns3_nodes_t host  = xbt_new0(s_ns3_nodes_t,1);
+       ns3_node_t host  = xbt_new0(s_ns3_node_t,1);
        XBT_DEBUG("Interface ns3 add host[%d] '%s'",number_of_nodes,id);
        Ptr<Node> node =  CreateObject<Node> (0);
        stack.Install(node);
@@ -136,7 +136,7 @@ void * ns3_add_host(const char * id)
 
 void * ns3_add_host_cluster(const char * id)
 {
-       ns3_nodes_t host  = xbt_new0(s_ns3_nodes_t,1);
+       ns3_node_t host  = xbt_new0(s_ns3_node_t,1);
        XBT_DEBUG("Interface ns3 add host[%d] '%s'",number_of_nodes,id);
        Ptr<Node> node =  CreateObject<Node> (0);
        stack.Install(node);
@@ -151,7 +151,7 @@ void * ns3_add_host_cluster(const char * id)
 
 void * ns3_add_router(const char * id)
 {
-       ns3_nodes_t router  = xbt_new0(s_ns3_nodes_t,1);
+       ns3_node_t router  = xbt_new0(s_ns3_node_t,1);
        XBT_DEBUG("Interface ns3 add router[%d] '%s'",number_of_nodes,id);
        Ptr<Node> node =  CreateObject<Node> (0);
        stack.Install(node);
index 1fc6d22..6f94334 100644 (file)
@@ -24,11 +24,11 @@ typedef enum {
 } e_ns3_network_element_type_t;
 
 
-typedef struct ns3_nodes{
+typedef struct ns3_node {
   int node_num;
   e_ns3_network_element_type_t type;
   void * data;
-}s_ns3_nodes_t, *ns3_nodes_t;
+} s_ns3_node_t, *ns3_node_t;
 
 XBT_PUBLIC_DATA(int) NS3_EXTENSION_ID;
 
@@ -53,13 +53,13 @@ XBT_PUBLIC(void) ns3_end_platform(void);
 XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
 
 inline
-ns3_nodes_t ns3_find_host(const char* id)
+ns3_node_t ns3_find_host(const char* id)
 {
   sg_host_t host = sg_host_by_name(id);
   if (host == nullptr)
     return nullptr;
   else
-    return (ns3_nodes_t) host->extension(NS3_EXTENSION_ID);
+    return (ns3_node_t) host->extension(NS3_EXTENSION_ID);
 }
 
 SG_END_DECL()