LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
11 * | 11 * |
12 * You should have received a copy of the GNU General Public License | 12 * You should have received a copy of the GNU General Public License |
13 * along with this program; if not, write to the Free Software | 13 * along with this program; if not, write to the Free Software |
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 * | 15 * |
16 * Author: George F. Riley<riley@ece.gatech.edu> | 16 * Author: George F. Riley<riley@ece.gatech.edu> |
17 */ | 17 */ |
18 | 18 |
19 // Interface between ns3 and the network animator | 19 // Interface between ns3 and the network animator |
20 | 20 |
21 #ifndef __ANIMATION_INTERFACE__H__ | 21 #ifndef ANIMATION_INTERFACE__H |
22 #define __ANIMATION_INTERFACE__H__ | 22 #define ANIMATION_INTERFACE__H |
23 | 23 |
24 #include <string> | 24 #include <string> |
25 | 25 |
26 #include "ns3/ptr.h" | 26 #include "ns3/ptr.h" |
27 #include "ns3/net-device.h" | 27 #include "ns3/net-device.h" |
28 #include "ns3/nstime.h" | 28 #include "ns3/nstime.h" |
29 #include "ns3/log.h" | 29 #include "ns3/log.h" |
30 #include "ns3/node-list.h" | 30 #include "ns3/node-list.h" |
31 | 31 |
32 | 32 |
33 namespace ns3 { | 33 namespace ns3 { |
34 class NetModel; | 34 class NetModel; |
35 | 35 |
36 /** | 36 /** |
37 * \brief Interface to network animator | 37 * \brief Interface to network animator |
38 * | 38 * |
39 * Provides functions that facilitate communications with an | 39 * Provides functions that facilitate communications with an |
40 * external or internal network animator. | 40 * external or internal network animator. |
41 */ | 41 */ |
42 class AnimationInterface | 42 class AnimationInterface |
43 { | 43 { |
44 public: | 44 public: |
45 /** | 45 /** |
46 * @brief Construct the animator interface. No arguments needed. | 46 * @brief Construct the animator interface. No arguments needed. |
47 */ | 47 */ |
48 AnimationInterface (); | 48 AnimationInterface (); |
49 /** | 49 /** |
| 50 * @brief Destructor for the animator interface. |
| 51 */ |
| 52 ~AnimationInterface (); |
| 53 /** |
50 * @brief Specify that animation commands are to be written | 54 * @brief Specify that animation commands are to be written |
51 * to the specified output file. | 55 * to the specified output file. |
52 * | 56 * |
53 * This call is used to write the animation information to a text | 57 * This call is used to write the animation information to a text |
54 * file that can later be used as input to the network animator tool. | 58 * file that can later be used as input to the network animator tool. |
55 * | 59 * |
56 * @param fn The name of the output file. | 60 * @param fn The name of the output file. |
57 * @returns true if successful open. | 61 * @returns true if successful open. |
58 */ | 62 */ |
59 bool SetOutputFile (const std::string& fn); | 63 bool SetOutputFile (const std::string& fn); |
60 | 64 |
61 /** | 65 /** |
62 * @brief Specify that animation commands are to be written to | 66 * @brief Specify that animation commands are to be written to |
63 * a socket. | 67 * a socket. |
64 * | 68 * |
65 * This call is used to set the ns3 process in server mode, waiting | 69 * This call is used to set the ns3 process in server mode, waiting |
66 * for a TCP connection from the animator. This call will not | 70 * for a TCP connection from the animator. This call will not |
67 * return until the animator connects in, or if the bind to the | 71 * return until the animator connects in, or if the bind to the |
68 * specified port fails. | 72 * specified port fails. |
69 * | 73 * |
70 * @param port Port number to bind to. | 74 * @param port Port number to bind to. |
71 * @returns true if connection created, false if bind failed. | 75 * @returns true if connection created, false if bind failed. |
72 */ | 76 */ |
73 bool SetServerPort (uint16_t port); | 77 bool SetServerPort (uint16_t port); |
74 | |
75 /** | |
76 * @brief Specify that animation window is to be created as part | |
77 * of the ns3 process. | |
78 * | |
79 * This call is used to set the ns3 animator internal to the | |
80 * current process. This will fail if the ns3 library was built | |
81 * without the QT4 developer packages. | |
82 * | |
83 * @returns true if animation started, false if failed. | |
84 */ | |
85 bool SetInternalAnimation (); | |
86 | 78 |
87 /** | 79 /** |
88 * @brief Writes the topology information and sets up the appropriate | 80 * @brief Writes the topology information and sets up the appropriate |
89 * animation packet tx callback | 81 * animation packet tx callback |
90 * | 82 * |
91 * Writes the topology information to the appropriate output, depending | 83 * Writes the topology information to the appropriate output, depending |
92 * on prior calls to SetOutputFile, SetServerPort, or SetInternalAnimation. | 84 * on prior calls to SetOutputFile, SetServerPort, or SetInternalAnimation. |
93 * Then creates the callbacks needed for the animator to start processing | 85 * Then creates the callbacks needed for the animator to start processing |
94 * packets. | 86 * packets. |
95 * | 87 * |
(...skipping 15 matching lines...) Expand all Loading... |
111 // Write specified amount of data to the specified handle | 103 // Write specified amount of data to the specified handle |
112 int WriteN (int, const char*, uint32_t); | 104 int WriteN (int, const char*, uint32_t); |
113 private: | 105 private: |
114 int m_fHandle; // File handle for output (-1 if none) | 106 int m_fHandle; // File handle for output (-1 if none) |
115 NetModel* m_model; // If non nil, points to the internal network model | 107 NetModel* m_model; // If non nil, points to the internal network model |
116 // for the interlan animator | 108 // for the interlan animator |
117 }; | 109 }; |
118 } | 110 } |
119 #endif | 111 #endif |
120 | 112 |
LEFT | RIGHT |