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);
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);
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);
}
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);
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);
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);
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);
} 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;
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()