author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 05 Nov 2007 17:41:58 +0100 | |
changeset 2069 | 0de0c81a049f |
parent 1500 | 895ed42278d3 |
child 1866 | e7dbcc4df546 |
permissions | -rw-r--r-- |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
2 |
/* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
3 |
* Copyright 2007 University of Washington |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
4 |
* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
8 |
* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
13 |
* |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
17 |
*/ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
18 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
19 |
#ifndef __UDP_ECHO_CLIENT_H__ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
20 |
#define __UDP_ECHO_CLIENT_H__ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
21 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
22 |
#include "ns3/application.h" |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
23 |
#include "ns3/event-id.h" |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
24 |
#include "ns3/ptr.h" |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
25 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
26 |
namespace ns3 { |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
27 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
28 |
class Address; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
29 |
class Socket; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
30 |
class Packet; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
31 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
32 |
class UdpEchoClient : public Application |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
33 |
{ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
34 |
public: |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
35 |
UdpEchoClient (Ptr<Node> n, Ipv4Address serverAddr, uint16_t serverPort, |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
36 |
uint32_t count, Time interval, uint32_t size); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
37 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
38 |
virtual ~UdpEchoClient (); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
39 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
40 |
protected: |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
41 |
virtual void DoDispose (void); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
42 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
43 |
private: |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
44 |
void Construct (Ptr<Node> n, Ipv4Address serverAddr, uint16_t serverPort, |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
45 |
uint32_t count, Time interval, uint32_t size); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
46 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
47 |
virtual void StartApplication (void); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
48 |
virtual void StopApplication (void); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
49 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
50 |
void ScheduleTransmit (Time dt); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
51 |
void Send (void); |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
52 |
|
1500
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1496
diff
changeset
|
53 |
void Receive(Ptr<Socket> socket, const Packet &packet, const Address &from); |
895ed42278d3
finish up basic echo apps
Craig Dowell <craigdo@ee.washington.edu>
parents:
1496
diff
changeset
|
54 |
|
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
55 |
Ptr<Node> m_node; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
56 |
Ipv4Address m_serverAddress; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
57 |
uint16_t m_serverPort; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
58 |
uint32_t m_count; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
59 |
Time m_interval; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
60 |
uint32_t m_size; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
61 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
62 |
uint32_t m_sent; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
63 |
Ptr<Socket> m_socket; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
64 |
Address m_peer; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
65 |
EventId m_sendEvent; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
66 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
67 |
}; |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
68 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
69 |
} // namespace ns3 |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
70 |
|
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
71 |
#endif // __UDP_ECHO_CLIENT_H__ |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff
changeset
|
72 |