Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add missing test before set properties.
[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 "surf/ns3/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
29         host->node_num = number_of_nodes;
30         host->type = NS3_NETWORK_ELEMENT_HOST;
31         host->data = nodes.Get(number_of_nodes);
32         XBT_INFO("node %p",host->data);
33         number_of_nodes++;
34         return host;
35 }
36
37 void * ns3_add_router(char * id)
38 {
39         ns3_nodes_t router  = xbt_new0(s_ns3_nodes_t,1);
40         XBT_INFO("Interface ns3 add router '%s'",id);
41         Ptr<Node> node =  CreateObject<Node> (0);
42         nodes.Add(node);
43         router->node_num = number_of_nodes;
44         router->type = NS3_NETWORK_ELEMENT_ROUTER;
45         router->data = node;
46         number_of_nodes++;
47         return router;
48 }
49
50 void * ns3_add_link(char * id)
51 {
52         XBT_INFO("Interface ns3 add link '%s'",id);
53         PointToPointHelper pointToPoint_5Mbps;
54         pointToPoint_5Mbps.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
55         pointToPoint_5Mbps.SetChannelAttribute ("Delay", StringValue ("2ms"));
56         return  NULL;//&pointToPoint_5Mbps;
57 }
58
59 void * ns3_add_AS(char * id)
60 {
61         XBT_INFO("Interface ns3 add AS '%s'",id);
62         return NULL;
63 }
64
65 void ns3_add_route(char * src,char * dst)
66 {
67         XBT_INFO("Interface ns3 add route from '%s' to '%s'",src,dst);
68 }
69
70 void ns3_add_ASroute(char * src,char * dst)
71 {
72         XBT_INFO("Interface ns3 add ASroute from '%s' to '%s'",src,dst);
73 }
74
75 void free_ns3_elmts(void * elmts)
76 {
77         XBT_INFO("Free ns3 elmts");
78 }