Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns3: kill useless C -> C++ interface remainings
[simgrid.git] / src / surf / ns3 / ns3_interface.h
1 /* Copyright (c) 2007-2014. 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 #ifndef _NS3_INTERFACE_H
8 #define _NS3_INTERFACE_H
9
10 #include "xbt/log.h"
11 #include "xbt/dynar.h"
12 #include "xbt/misc.h"
13 #include "xbt/sysdep.h"
14 #include <xbt/Extendable.hpp>
15
16 #include <simgrid/s4u/host.hpp>
17 #include <surf/surf_routing.h>
18
19 namespace simgrid{
20   namespace surf{
21     class NetworkNS3Action;
22   }
23 }
24 typedef enum {
25   NS3_NETWORK_ELEMENT_NULL = 0,    /* NULL */
26   NS3_NETWORK_ELEMENT_HOST,      /* host type */
27   NS3_NETWORK_ELEMENT_ROUTER,     /* router type */
28   NS3_NETWORK_ELEMENT_AS,        /* AS type */
29 } e_ns3_network_element_type_t;
30
31
32 typedef struct ns3_node {
33   int node_num;
34   e_ns3_network_element_type_t type;
35 } s_ns3_node_t, *ns3_node_t;
36
37 XBT_PUBLIC_DATA(int) NS3_EXTENSION_ID;
38
39 SG_BEGIN_DECL()
40
41 XBT_PUBLIC(int)    ns3_initialize(const char* TcpProtocol);
42 XBT_PUBLIC(int)    ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,simgrid::surf::NetworkNS3Action * action);
43 XBT_PUBLIC(void)   ns3_simulator(double min);
44 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
45 XBT_PUBLIC(void *) ns3_add_router(const char * id);
46 XBT_PUBLIC(void *) ns3_add_AS(const char * id);
47 XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
48                 int dst, e_ns3_network_element_type_t type_dst,
49                 char * bw,char * lat);
50 XBT_PUBLIC(void) ns3_end_platform(void);
51 XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
52
53 inline
54 ns3_node_t ns3_find_host(const char* id)
55 {
56   sg_host_t host = sg_host_by_name(id);
57   if (host == nullptr)
58     return nullptr;
59   else
60     return (ns3_node_t) host->extension(NS3_EXTENSION_ID);
61 }
62
63 SG_END_DECL()
64
65 #endif