X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c7b463c9c17665403d001fc59cb649551e93d950..2f2ce19fcb66a634c19de8dda2dc4b4896203537:/src/surf/network_ns3.c diff --git a/src/surf/network_ns3.c b/src/surf/network_ns3.c index 9c59b0dece..dc56b4db58 100644 --- a/src/surf/network_ns3.c +++ b/src/surf/network_ns3.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007, 2008, 2009, 2010, 2011. The SimGrid Team. +/* Copyright (c) 2007-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -23,9 +23,9 @@ extern xbt_dict_t dict_socket; static double time_to_next_flow_completion = -1; -static double ns3_share_resources(double min); -static void ns3_update_actions_state(double now, double delta); -static void finalize(void); +static double ns3_share_resources(surf_model_t network_model, double min); +static void ns3_update_actions_state(surf_model_t network_model, double now, double delta); +static void finalize(surf_model_t network_model); static surf_action_t ns3_communicate(sg_routing_edge_t src_elm, sg_routing_edge_t dst_elm, double size, double rate); @@ -109,13 +109,13 @@ static void parse_ns3_add_router(sg_platf_router_cbarg_t router) ); } -static void parse_ns3_add_AS(const char*id, const char*routing) +static void parse_ns3_add_AS(sg_platf_AS_cbarg_t AS) { - XBT_DEBUG("NS3_ADD_AS '%s'",id); + XBT_DEBUG("NS3_ADD_AS '%s'",AS->id); xbt_lib_set(as_router_lib, - id, + AS->id, NS3_ASR_LEVEL, - ns3_add_AS(id) + ns3_add_AS(AS->id) ); } @@ -342,6 +342,7 @@ void surf_network_model_init_NS3() surf_network_model = surf_model_init(); surf_network_model->name = "network NS3"; + surf_network_model->type = SURF_MODEL_TYPE_NETWORK; surf_network_model->extension.network.get_link_latency = ns3_get_link_latency; surf_network_model->extension.network.get_link_bandwidth = ns3_get_link_bandwidth; surf_network_model->extension.network.get_route = ns3_get_route; @@ -362,7 +363,7 @@ void surf_network_model_init_NS3() /* Added the initialization for NS3 interface */ - if (ns3_initialize(xbt_cfg_get_string(_surf_cfg_set,"ns3/TcpModel"))) { + if (ns3_initialize(xbt_cfg_get_string(_sg_cfg_set, "ns3/TcpModel"))) { xbt_die("Impossible to initialize NS3 interface"); } @@ -380,19 +381,19 @@ void surf_network_model_init_NS3() #endif } -static void finalize(void) +static void finalize(surf_model_t network_model) { ns3_finalize(); xbt_dynar_free_container(&IPV4addr); xbt_dict_free(&dict_socket); } -static double ns3_share_resources(double min) +static double ns3_share_resources(surf_model_t network_model, double min) { XBT_DEBUG("ns3_share_resources"); xbt_swag_t running_actions = - surf_network_model->states.running_action_set; + network_model->states.running_action_set; //get the first relevant value from the running_actions list if (!xbt_swag_size(running_actions) || min == 0.0) @@ -411,7 +412,7 @@ static double ns3_share_resources(double min) return time_to_next_flow_completion; } -static void ns3_update_actions_state(double now, double delta) +static void ns3_update_actions_state(surf_model_t network_model, double now, double delta) { xbt_dict_cursor_t cursor = NULL; char *key; @@ -422,7 +423,7 @@ static void ns3_update_actions_state(double now, double delta) surf_action_network_ns3_t action = NULL; xbt_swag_t running_actions = - surf_network_model->states.running_action_set; + network_model->states.running_action_set; /* If there are no running flows, just return */ if (!xbt_swag_size(running_actions)) {