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 * Copyright (c) 2011 Yufei Cheng | 3 * Copyright (c) 2011 Yufei Cheng |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include <vector> | 36 #include <vector> |
37 #include <string> | 37 #include <string> |
38 | 38 |
39 #include "ns3/application-container.h" | 39 #include "ns3/application-container.h" |
40 #include "ns3/object-factory.h" | 40 #include "ns3/object-factory.h" |
41 #include "ns3/ipv4-address.h" | 41 #include "ns3/ipv4-address.h" |
42 #include "ns3/attribute.h" | 42 #include "ns3/attribute.h" |
43 #include "ns3/object-factory.h" | 43 #include "ns3/object-factory.h" |
44 #include "ns3/node-container.h" | 44 #include "ns3/node-container.h" |
45 #include "ns3/trace-helper.h" | 45 #include "ns3/trace-helper.h" |
| 46 #include "ns3/http-client.h" |
| 47 #include "ns3/http-server.h" |
| 48 #include "ns3/http-controller.h" |
46 | 49 |
47 #include "ns3/http-runtime-variable.h" | |
48 #include "ns3/http-server.h" | |
49 #include "ns3/http-client.h" | |
50 | 50 |
51 namespace ns3 { | 51 namespace ns3 { |
52 | 52 |
53 class RuntimeVariable; | 53 /** |
| 54 * \brief Create a server application which waits for input http packets |
| 55 * and uses the information carried into their payload to compute |
| 56 * delay and to determine if some packets are lost. |
| 57 */ |
| 58 class HttpHelper |
| 59 { |
| 60 public: |
| 61 /** |
| 62 * Create HttpServerHelper which will make life easier for people trying |
| 63 * to set up simulations with udp-client-server application. |
| 64 * |
| 65 */ |
| 66 HttpHelper (); |
| 67 /** |
| 68 * Record an attribute to be set in each Application after it is is created. |
| 69 * |
| 70 * \param name the name of the attribute to set |
| 71 * \param value the value of the attribute to set |
| 72 */ |
| 73 void SetAttribute (std::string name, const AttributeValue &value); |
| 74 Ptr<http::HttpController> GetController (void); |
| 75 private: |
| 76 ObjectFactory m_factory; |
| 77 Ptr<http::HttpController> m_controller; |
| 78 }; |
| 79 |
54 /** | 80 /** |
55 * \brief Create a server application which waits for input http packets | 81 * \brief Create a server application which waits for input http packets |
56 * and uses the information carried into their payload to compute | 82 * and uses the information carried into their payload to compute |
57 * delay and to determine if some packets are lost. | 83 * delay and to determine if some packets are lost. |
58 */ | 84 */ |
59 class HttpServerHelper | 85 class HttpServerHelper |
60 { | 86 { |
61 public: | 87 public: |
62 /** | 88 /** |
63 * Create HttpServerHelper which will make life easier for people trying | 89 * Create HttpServerHelper which will make life easier for people trying |
(...skipping 22 matching lines...) Expand all Loading... |
86 * NodeContainer. | 112 * NodeContainer. |
87 * | 113 * |
88 * \param c The nodes on which to create the Applications. The nodes | 114 * \param c The nodes on which to create the Applications. The nodes |
89 * are specified by a NodeContainer. | 115 * are specified by a NodeContainer. |
90 * \returns The applications created, one Application per Node in the | 116 * \returns The applications created, one Application per Node in the |
91 * NodeContainer. | 117 * NodeContainer. |
92 */ | 118 */ |
93 ApplicationContainer Install (NodeContainer c); | 119 ApplicationContainer Install (NodeContainer c); |
94 private: | 120 private: |
95 ObjectFactory m_factory; | 121 ObjectFactory m_factory; |
| 122 HttpHelper httpHelper; |
96 }; | 123 }; |
97 | 124 |
98 /** | 125 /** |
99 * \brief Create a client application which sends udp packets carrying | 126 * \brief Create a client application which sends udp packets carrying |
100 * a 32bit sequence number and a 64 bit time stamp. | 127 * a 32bit sequence number and a 64 bit time stamp. |
101 * | 128 * |
102 */ | 129 */ |
103 class HttpClientHelper | 130 class HttpClientHelper |
104 { | 131 { |
105 | 132 |
(...skipping 26 matching lines...) Expand all Loading... |
132 * Create one udp client application on each of the input nodes | 159 * Create one udp client application on each of the input nodes |
133 * | 160 * |
134 * \returns the applications created, one application per input node. | 161 * \returns the applications created, one application per input node. |
135 */ | 162 */ |
136 ApplicationContainer Install (NodeContainer c); | 163 ApplicationContainer Install (NodeContainer c); |
137 Ptr<http::HttpClient> GetClient (void); | 164 Ptr<http::HttpClient> GetClient (void); |
138 | 165 |
139 private: | 166 private: |
140 ObjectFactory m_factory; | 167 ObjectFactory m_factory; |
141 Ptr<http::HttpClient> m_client; | 168 Ptr<http::HttpClient> m_client; |
| 169 HttpHelper httpHelper; |
142 }; | 170 }; |
143 | 171 |
144 } // namespace ns3 | 172 } // namespace ns3 |
145 | 173 |
146 #endif /* HTTP_HELPER_H */ | 174 #endif /* HTTP_HELPER_H */ |
LEFT | RIGHT |