1 /* Copyright (c) 2007-2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef _NS3_INTERFACE_H
8 #define _NS3_INTERFACE_H
11 #include "xbt/dynar.h"
13 #include "xbt/sysdep.h"
14 #include <xbt/Extendable.hpp>
16 #include <simgrid/s4u/host.hpp>
17 #include <surf/surf_routing.h>
20 NS3_NETWORK_ELEMENT_NULL = 0, /* NULL */
21 NS3_NETWORK_ELEMENT_HOST, /* host type */
22 NS3_NETWORK_ELEMENT_ROUTER, /* router type */
23 NS3_NETWORK_ELEMENT_AS, /* AS type */
24 } e_ns3_network_element_type_t;
27 typedef struct ns3_nodes{
29 e_ns3_network_element_type_t type;
31 }s_ns3_nodes_t, *ns3_nodes_t;
33 XBT_PUBLIC_DATA(int) NS3_EXTENSION_ID;
37 XBT_PUBLIC(int) ns3_finalize(void);
38 XBT_PUBLIC(int) ns3_initialize(const char* TcpProtocol);
39 XBT_PUBLIC(int) ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,void * action);
40 XBT_PUBLIC(void) ns3_simulator(double min);
41 XBT_PUBLIC(double) ns3_time(void);
42 XBT_PUBLIC(void*) ns3_get_socket_action(void *socket);
43 XBT_PUBLIC(double) ns3_get_socket_remains(void *socket);
44 XBT_PUBLIC(double) ns3_get_socket_sent(void *socket);
45 XBT_PUBLIC(char) ns3_get_socket_is_finished(void *socket);
46 XBT_PUBLIC(void *) ns3_add_host(const char * id);
47 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
48 XBT_PUBLIC(void *) ns3_add_router(const char * id);
49 XBT_PUBLIC(void *) ns3_add_AS(const char * id);
50 XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
51 int dst, e_ns3_network_element_type_t type_dst,
52 char * bw,char * lat);
53 XBT_PUBLIC(void) ns3_end_platform(void);
54 XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
57 ns3_nodes_t ns3_find_host(const char* id)
59 sg_host_t host = sg_host_by_name(id);
63 return (ns3_nodes_t) host->extension(NS3_EXTENSION_ID);