author | Craig Dowell <craigdo@ee.washington.edu> |
Wed, 17 Feb 2010 21:50:11 -0800 | |
changeset 5994 | ced6c14c957e |
parent 3691 | 372f4475dc47 |
permissions | -rw-r--r-- |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
20 |
#ifndef UDP_SOCKET_FACTORY_IMPL_H |
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
21 |
#define UDP_SOCKET_FACTORY_IMPL_H |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
3125
d2d8a36cfd23
s/ns3::Udp/ns3::UdpSocketFactory
Tom Henderson <tomh@tomh.org>
parents:
2834
diff
changeset
|
23 |
#include "ns3/udp-socket-factory.h" |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
24 |
#include "ns3/ptr.h" |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
namespace ns3 { |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
|
742
b73f8e30c75e
Udp -> UdpL4Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
739
diff
changeset
|
28 |
class UdpL4Protocol; |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
30 |
/** |
3691 | 31 |
* \ingroup internetStack |
32 |
* \defgroup udp Udp |
|
33 |
* |
|
34 |
* This is an implementation of the User Datagram Protocol described in |
|
35 |
* RFC 768. It implements a connectionless, unreliable datagram packet |
|
36 |
* service. Packets may be reordered or duplicated before they arrive. |
|
37 |
* UDP generates and checks checksums to catch transmission errors. |
|
38 |
* |
|
39 |
* The following options are not presently part of this implementation: |
|
40 |
* UDP_CORK, MSG_DONTROUTE, path MTU discovery control (e.g. |
|
41 |
* IP_MTU_DISCOVER). MTU handling is also weak in ns-3 for the moment; |
|
42 |
* it is best to send datagrams that do not exceed 1500 byte MTU (e.g. |
|
43 |
* 1472 byte UDP datagrams) |
|
44 |
*/ |
|
45 |
||
46 |
/** |
|
47 |
* \ingroup udp |
|
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
48 |
* \brief Object to create UDP socket instances |
2190
7f2b719b67fb
add internal keyword to udp-impl documentation
Tom Henderson <tomh@tomh.org>
parents:
2179
diff
changeset
|
49 |
* \internal |
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
50 |
* |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
51 |
* This class implements the API for creating UDP sockets. |
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
52 |
* It is a socket factory (deriving from class SocketFactory). |
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
53 |
*/ |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
54 |
class UdpSocketFactoryImpl : public UdpSocketFactory |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
{ |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
public: |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
57 |
UdpSocketFactoryImpl (); |
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
58 |
virtual ~UdpSocketFactoryImpl (); |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
|
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2190
diff
changeset
|
60 |
void SetUdp (Ptr<UdpL4Protocol> udp); |
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2190
diff
changeset
|
61 |
|
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
62 |
/** |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
63 |
* \brief Implements a method to create a Udp-based socket and return |
2190
7f2b719b67fb
add internal keyword to udp-impl documentation
Tom Henderson <tomh@tomh.org>
parents:
2179
diff
changeset
|
64 |
* a base class smart pointer to the socket. |
7f2b719b67fb
add internal keyword to udp-impl documentation
Tom Henderson <tomh@tomh.org>
parents:
2179
diff
changeset
|
65 |
* \internal |
7f2b719b67fb
add internal keyword to udp-impl documentation
Tom Henderson <tomh@tomh.org>
parents:
2179
diff
changeset
|
66 |
* |
2179
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
67 |
* \return smart pointer to Socket |
9b58bef0a7ff
Doxygen the SocketFactory classes
Tom Henderson <tomh@tomh.org>
parents:
750
diff
changeset
|
68 |
*/ |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
524
diff
changeset
|
69 |
virtual Ptr<Socket> CreateSocket (void); |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
|
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
protected: |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
virtual void DoDispose (void); |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
73 |
private: |
742
b73f8e30c75e
Udp -> UdpL4Protocol
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
739
diff
changeset
|
74 |
Ptr<UdpL4Protocol> m_udp; |
519
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
}; |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
|
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
} // namespace ns3 |
b045a3ab4595
define and implement IUdp
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
|
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3125
diff
changeset
|
79 |
#endif /* UDP_SOCKET_FACTORY_IMPL_H */ |