Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns3: gosh this code is ugly
[simgrid.git] / src / surf / ns3 / ns3_interface.h
index 480947e..0537b10 100644 (file)
 #include "xbt/sysdep.h"
 #include <xbt/Extendable.hpp>
 
-#include <simgrid/Host.hpp>
+#include <simgrid/s4u/host.hpp>
 #include <surf/surf_routing.h>
 
+namespace simgrid{
+  namespace surf{
+    class NetworkNS3Action;
+  }
+}
 typedef enum {
   NS3_NETWORK_ELEMENT_NULL = 0,    /* NULL */
   NS3_NETWORK_ELEMENT_HOST,      /* host type */
@@ -24,26 +29,23 @@ typedef enum {
 } 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;
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(int)    ns3_finalize(void);
+XBT_PUBLIC(void)   ns3_finalize();
 XBT_PUBLIC(int)    ns3_initialize(const char* TcpProtocol);
-XBT_PUBLIC(int)    ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,void * action);
+XBT_PUBLIC(int)    ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,simgrid::surf::NetworkNS3Action * action);
 XBT_PUBLIC(void)   ns3_simulator(double min);
-XBT_PUBLIC(double) ns3_time(void);
-XBT_PUBLIC(void*)  ns3_get_socket_action(void *socket);
+XBT_PUBLIC(simgrid::surf::NetworkNS3Action*)  ns3_get_socket_action(void *socket);
 XBT_PUBLIC(double) ns3_get_socket_remains(void *socket);
 XBT_PUBLIC(double) ns3_get_socket_sent(void *socket);
-XBT_PUBLIC(char)   ns3_get_socket_is_finished(void *socket);
-XBT_PUBLIC(void *) ns3_add_host(const char * id);
+XBT_PUBLIC(bool)   ns3_get_socket_is_finished(void *socket);
 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
 XBT_PUBLIC(void *) ns3_add_router(const char * id);
 XBT_PUBLIC(void *) ns3_add_AS(const char * id);
@@ -53,14 +55,14 @@ XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
 XBT_PUBLIC(void) ns3_end_platform(void);
 XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
 
-XBT_INLINE
-ns3_nodes_t ns3_find_host(const char* id)
+inline
+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()