Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
15faec73b43b7a274fd104b3f4080e7e31292c47
[simgrid.git] / src / surf / gtnets / gtnets_simulator.h
1 /*      $Id$     */
2 /* Copyright (c) 2007 Kayo Fujiwara. 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 _GTNETS_SIM_H
8 #define _GTNETS_SIM_H
9
10 #ifdef __cplusplus
11 #include "gtnets_topology.h"
12
13 #include <iostream>
14 #include <sys/wait.h>
15 #include <map>
16
17 //GTNetS include files
18 #include "simulator.h"          // Definitions for the Simulator Object
19 #include "node.h"               // Definitions for the Node Object
20 #include "linkp2p.h"            // Definitions for point-to-point link objects
21 #include "ratetimeparse.h"      // Definitions for Rate and Time objects
22 #include "application-tcpserver.h"      // Definitions for TCPServer application
23 #include "application-tcpsend.h"        // Definitions for TCP Sending application
24 #include "tcp-tahoe.h"          // Definitions for TCP Tahoe
25 #include "tcp-reno.h"
26 #include "tcp-newreno.h"
27 #include "event.h"
28 #include "routing-manual.h"
29
30 using namespace std;
31
32 //Simulator s;
33 class GTSim {
34
35 public:
36   GTSim();
37   ~GTSim();
38 public:
39   int add_link(int id, double bandwidth, double latency);
40   int add_onehop_route(int src, int dst, int link);
41   int add_route(int src, int dst, int *links, int nlink);
42   int add_router(int id);
43   int create_flow(int src, int dst, long datasize, void *metadata);
44   double get_time_to_next_flow_completion();
45   int run_until_next_flow_completion(void ***metadata, int *number_of_flows);
46   int run(double deltat);
47   // returns the total received by the TCPServer peer of the given action
48   double gtnets_get_flow_rx(void *metadata);
49   void create_gtnets_topology();
50   void print_topology();
51 private:
52   void add_nodes();
53   void node_connect();
54
55   bool node_include(int);
56   bool link_include(int);
57   Simulator *sim_;
58   GTNETS_Topology *topo_;
59   RoutingManual *rm_;
60   int nnode_;
61   int is_topology_;
62   int nflow_;
63
64     map < int, TCPServer * >gtnets_servers_;
65     map < int, TCPSend * >gtnets_clients_;
66     map < int, Linkp2p * >gtnets_links_;
67     map < int, Node * >gtnets_nodes_;
68   //added by pedro in order to get statistics
69     map < void *, int >gtnets_action_to_flow_;
70
71     map < int, void *>gtnets_metadata_;
72 };
73
74 #endif /* __cplusplus */
75
76 #endif