Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add functions for ns3
[simgrid.git] / src / surf / ns3 / ns3_interface.cc
1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "ns3_interface.h"
8 #include "ns3/core-module.h"
9 #include "ns3/simulator-module.h"
10 #include "ns3/node-module.h"
11 #include "ns3/helper-module.h"
12 #include "ns3/global-route-manager.h"
13
14 using namespace ns3;
15
16 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(interface_ns3, surf,
17                                 "Logging specific to the SURF network NS3 module");
18
19 NodeContainer nodes;
20 int number_of_nodes = 0;
21
22 void * ns3_add_host(char * id)
23 {
24         ns3_nodes_t host  = xbt_new0(s_ns3_nodes_t,1);
25         XBT_INFO("Interface ns3 add host '%s'",id);
26         Ptr<Node> node =  CreateObject<Node> (0);
27         nodes.Add(node);
28         host->node_num = number_of_nodes;
29         host->type = NS3_NETWORK_ELEMENT_HOST;
30         host->data = node;
31         number_of_nodes++;
32         return host;
33 }
34
35 void * ns3_add_router(char * id)
36 {
37         ns3_nodes_t router  = xbt_new0(s_ns3_nodes_t,1);
38         XBT_INFO("Interface ns3 add router '%s'",id);
39         Ptr<Node> node =  CreateObject<Node> (0);
40         nodes.Add(node);
41         router->node_num = number_of_nodes;
42         router->type = NS3_NETWORK_ELEMENT_ROUTER;
43         router->data = node;
44         number_of_nodes++;
45         return router;
46 }
47
48 void * ns3_add_AS(char * id)
49 {
50         XBT_INFO("Interface ns3 add AS '%s'",id);
51         return NULL;
52 }