author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Fri, 26 Sep 2014 15:51:00 -0700 | |
changeset 10968 | 2d29fee2b7b8 |
parent 10652 | dc18deba4502 |
child 11238 | 96b5da288844 |
permissions | -rw-r--r-- |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
2 |
/* |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
3 |
* Copyright (c) 2006 Georgia Tech Research Corporation |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
4 |
* 2007 INRIA |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
5 |
* |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
8 |
* published by the Free Software Foundation; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
9 |
* |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
13 |
* GNU General Public License for more details. |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
14 |
* |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
18 |
* |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
19 |
* Authors: George F. Riley<riley@ece.gatech.edu> |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
20 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
21 |
*/ |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
22 |
|
1505 | 23 |
#include "ns3/log.h" |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
24 |
#include "ns3/packet.h" |
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
25 |
#include "node.h" |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "socket.h" |
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
27 |
#include "socket-factory.h" |
3365
6409d2460601
bug 245: build failure with gcc 4.3.x
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3276
diff
changeset
|
28 |
#include <limits> |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
29 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
30 |
namespace ns3 { |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10652
diff
changeset
|
32 |
NS_LOG_COMPONENT_DEFINE ("Socket"); |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
34 |
NS_OBJECT_ENSURE_REGISTERED (Socket); |
7870
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
35 |
|
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
36 |
TypeId |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
37 |
Socket::GetTypeId (void) |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
38 |
{ |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
39 |
static TypeId tid = TypeId ("ns3::Socket") |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
40 |
.SetParent<Object> (); |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
41 |
return tid; |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
42 |
} |
059b1b83e29b
Bug 962 - list of paths to reach objects contains bogus entries
Mitch Watrous <watrous@u.washington.edu>
parents:
7758
diff
changeset
|
43 |
|
3107 | 44 |
Socket::Socket (void) |
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
45 |
: m_manualIpTos (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
46 |
m_manualIpTtl (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
47 |
m_ipRecvTos (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
48 |
m_ipRecvTtl (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
49 |
m_manualIpv6Tclass (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
50 |
m_manualIpv6HopLimit (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
51 |
m_ipv6RecvTclass (false), |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
52 |
m_ipv6RecvHopLimit (false) |
3107 | 53 |
{ |
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
54 |
NS_LOG_FUNCTION_NOARGS (); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
55 |
m_boundnetdevice = 0; |
7758
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
56 |
m_recvPktInfo = false; |
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
57 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
58 |
m_ipTos = 0; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
59 |
m_ipTtl = 0; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
60 |
m_ipv6Tclass = 0; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
61 |
m_ipv6HopLimit = 0; |
3107 | 62 |
} |
63 |
||
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
Socket::~Socket () |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
65 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
66 |
NS_LOG_FUNCTION (this); |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
67 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
|
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
69 |
Ptr<Socket> |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
70 |
Socket::CreateSocket (Ptr<Node> node, TypeId tid) |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
71 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
72 |
NS_LOG_FUNCTION (node << tid); |
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
73 |
Ptr<Socket> s; |
5720
92594e167a58
[aodv] Code style fixes proposed by Faker in his review
Pavel Boyko <boyko@iitp.ru>
parents:
5715
diff
changeset
|
74 |
NS_ASSERT (node != 0); |
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
75 |
Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid); |
5720
92594e167a58
[aodv] Code style fixes proposed by Faker in his review
Pavel Boyko <boyko@iitp.ru>
parents:
5715
diff
changeset
|
76 |
NS_ASSERT (socketFactory != 0); |
3116
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
77 |
s = socketFactory->CreateSocket (); |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
78 |
NS_ASSERT (s != 0); |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
79 |
return s; |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
80 |
} |
c33b6d2775b7
Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents:
3107
diff
changeset
|
81 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
82 |
void |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
83 |
Socket::SetConnectCallback ( |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
84 |
Callback<void, Ptr<Socket> > connectionSucceeded, |
3276
8869a79a391f
Changes for bug 205, unlisted FIN bug
Craig Dowell <craigdo@ee.washington.edu>
parents:
3269
diff
changeset
|
85 |
Callback<void, Ptr<Socket> > connectionFailed) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
87 |
NS_LOG_FUNCTION (this << &connectionSucceeded << &connectionFailed); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
88 |
m_connectionSucceeded = connectionSucceeded; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
89 |
m_connectionFailed = connectionFailed; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
90 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
91 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
92 |
void |
5377
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
93 |
Socket::SetCloseCallbacks ( |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
94 |
Callback<void, Ptr<Socket> > normalClose, |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
95 |
Callback<void, Ptr<Socket> > errorClose) |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
96 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
97 |
NS_LOG_FUNCTION (this << &normalClose << &errorClose); |
5377
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
98 |
m_normalClose = normalClose; |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
99 |
m_errorClose = errorClose; |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
100 |
} |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
101 |
|
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
102 |
void |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
103 |
Socket::SetAcceptCallback ( |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
104 |
Callback<bool, Ptr<Socket>, const Address &> connectionRequest, |
3276
8869a79a391f
Changes for bug 205, unlisted FIN bug
Craig Dowell <craigdo@ee.washington.edu>
parents:
3269
diff
changeset
|
105 |
Callback<void, Ptr<Socket>, const Address&> newConnectionCreated) |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
106 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
107 |
NS_LOG_FUNCTION (this << &connectionRequest << &newConnectionCreated); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
108 |
m_connectionRequest = connectionRequest; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
109 |
m_newConnectionCreated = newConnectionCreated; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
110 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
111 |
|
3774
0e11474a0b92
Apply patch to fix bug 363
Craig Dowell <craigdo@ee.washington.edu>
parents:
3772
diff
changeset
|
112 |
void |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
113 |
Socket::SetDataSentCallback (Callback<void, Ptr<Socket>, uint32_t> dataSent) |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
114 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
115 |
NS_LOG_FUNCTION (this << &dataSent); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
116 |
m_dataSent = dataSent; |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
117 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
118 |
|
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
119 |
void |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
120 |
Socket::SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb) |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
121 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
122 |
NS_LOG_FUNCTION (this << &sendCb); |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
123 |
m_sendCb = sendCb; |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
124 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
125 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
126 |
void |
3102 | 127 |
Socket::SetRecvCallback (Callback<void, Ptr<Socket> > receivedData) |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
128 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
129 |
NS_LOG_FUNCTION (this << &receivedData); |
3102 | 130 |
m_receivedData = receivedData; |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
131 |
} |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
132 |
|
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
133 |
int |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
134 |
Socket::Send (Ptr<Packet> p) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
135 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
136 |
NS_LOG_FUNCTION (this << p); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
137 |
return Send (p, 0); |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
138 |
} |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
139 |
|
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
140 |
int |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
141 |
Socket::Send (const uint8_t* buf, uint32_t size, uint32_t flags) |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
142 |
{ |
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9145
diff
changeset
|
143 |
NS_LOG_FUNCTION (this << &buf << size << flags); |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
144 |
Ptr<Packet> p; |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
145 |
if (buf) |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
146 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
147 |
p = Create<Packet> (buf, size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
148 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
149 |
else |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
150 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
151 |
p = Create<Packet> (size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
152 |
} |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
153 |
return Send (p, flags); |
3103
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
154 |
} |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
155 |
|
3142 | 156 |
int |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
157 |
Socket::SendTo (const uint8_t* buf, uint32_t size, uint32_t flags, |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
158 |
const Address &toAddress) |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
159 |
{ |
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9145
diff
changeset
|
160 |
NS_LOG_FUNCTION (this << &buf << size << flags << &toAddress); |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
161 |
Ptr<Packet> p; |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
162 |
if(buf) |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
163 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
164 |
p = Create<Packet> (buf, size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
165 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
166 |
else |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
167 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
168 |
p = Create<Packet> (size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
169 |
} |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
170 |
return SendTo (p, flags, toAddress); |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
171 |
} |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
172 |
|
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
173 |
Ptr<Packet> |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
174 |
Socket::Recv (void) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
175 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
176 |
NS_LOG_FUNCTION (this); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7220
diff
changeset
|
177 |
return Recv (std::numeric_limits<uint32_t>::max (), 0); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
178 |
} |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
179 |
|
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
180 |
int |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
181 |
Socket::Recv (uint8_t* buf, uint32_t size, uint32_t flags) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
182 |
{ |
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9145
diff
changeset
|
183 |
NS_LOG_FUNCTION (this << &buf << size << flags); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
184 |
Ptr<Packet> p = Recv (size, flags); // read up to "size" bytes |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
185 |
if (p == 0) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
186 |
{ |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
187 |
return 0; |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
188 |
} |
4517
3530045a96da
CopyData is more efficient than a PeekData+memcpy pair
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4357
diff
changeset
|
189 |
p->CopyData (buf, p->GetSize ()); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
190 |
return p->GetSize (); |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
191 |
} |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
192 |
|
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
193 |
Ptr<Packet> |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
194 |
Socket::RecvFrom (Address &fromAddress) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
195 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
196 |
NS_LOG_FUNCTION (this << &fromAddress); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7220
diff
changeset
|
197 |
return RecvFrom (std::numeric_limits<uint32_t>::max (), 0, fromAddress); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
198 |
} |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
199 |
|
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
200 |
int |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
201 |
Socket::RecvFrom (uint8_t* buf, uint32_t size, uint32_t flags, |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
202 |
Address &fromAddress) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
203 |
{ |
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9145
diff
changeset
|
204 |
NS_LOG_FUNCTION (this << &buf << size << flags << &fromAddress); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
205 |
Ptr<Packet> p = RecvFrom (size, flags, fromAddress); |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
206 |
if (p == 0) |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
207 |
{ |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
208 |
return 0; |
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
209 |
} |
4517
3530045a96da
CopyData is more efficient than a PeekData+memcpy pair
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4357
diff
changeset
|
210 |
p->CopyData (buf, p->GetSize ()); |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
211 |
return p->GetSize (); |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
212 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
213 |
|
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
214 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
215 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
216 |
Socket::NotifyConnectionSucceeded (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
217 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
218 |
NS_LOG_FUNCTION (this); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
219 |
if (!m_connectionSucceeded.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
220 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
221 |
m_connectionSucceeded (this); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
222 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
223 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
224 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
225 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
226 |
Socket::NotifyConnectionFailed (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
227 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
228 |
NS_LOG_FUNCTION (this); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
229 |
if (!m_connectionFailed.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
230 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
231 |
m_connectionFailed (this); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
232 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
233 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
234 |
|
5377
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
235 |
void |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
236 |
Socket::NotifyNormalClose (void) |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
237 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
238 |
NS_LOG_FUNCTION (this); |
5377
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
239 |
if (!m_normalClose.IsNull ()) |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
240 |
{ |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
241 |
m_normalClose (this); |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
242 |
} |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
243 |
} |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
244 |
|
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
245 |
void |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
246 |
Socket::NotifyErrorClose (void) |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
247 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
248 |
NS_LOG_FUNCTION (this); |
5377
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
249 |
if (!m_errorClose.IsNull ()) |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
250 |
{ |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
251 |
m_errorClose (this); |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
252 |
} |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
253 |
} |
c54b36fb7317
TCP bug fixes 424, 426, 559, 663, 664, 697
Josh Pelkey <jpelkey@gatech.edu>
parents:
4517
diff
changeset
|
254 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
255 |
bool |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
256 |
Socket::NotifyConnectionRequest (const Address &from) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
257 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
258 |
NS_LOG_FUNCTION (this << &from); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
259 |
if (!m_connectionRequest.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
260 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
261 |
return m_connectionRequest (this, from); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
262 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
263 |
else |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
264 |
{ |
2367
904e5739f955
Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2224
diff
changeset
|
265 |
// accept all incoming connections by default. |
904e5739f955
Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2224
diff
changeset
|
266 |
// this way people writing code don't have to do anything |
904e5739f955
Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2224
diff
changeset
|
267 |
// special like register a callback that returns true |
904e5739f955
Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2224
diff
changeset
|
268 |
// just to get incoming connections |
904e5739f955
Undo changes to the packet sink to accept incoming connections; change the default behavior of the socket connection request notifier instead
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
2224
diff
changeset
|
269 |
return true; |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
270 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
271 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
272 |
|
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
273 |
void |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
274 |
Socket::NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
275 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
276 |
NS_LOG_FUNCTION (this << socket << from); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
277 |
if (!m_newConnectionCreated.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
278 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
279 |
m_newConnectionCreated (socket, from); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
280 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
281 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
282 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
283 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
284 |
Socket::NotifyDataSent (uint32_t size) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
285 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
286 |
NS_LOG_FUNCTION (this << size); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
287 |
if (!m_dataSent.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
288 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
289 |
m_dataSent (this, size); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
290 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
291 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
292 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
293 |
void |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
294 |
Socket::NotifySend (uint32_t spaceAvailable) |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
295 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
296 |
NS_LOG_FUNCTION (this << spaceAvailable); |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
297 |
if (!m_sendCb.IsNull ()) |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
298 |
{ |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
299 |
m_sendCb (this, spaceAvailable); |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
300 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
301 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
302 |
|
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
303 |
void |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
304 |
Socket::NotifyDataRecv (void) |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
305 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
306 |
NS_LOG_FUNCTION (this); |
3102 | 307 |
if (!m_receivedData.IsNull ()) |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
308 |
{ |
3102 | 309 |
m_receivedData (this); |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
310 |
} |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
311 |
} |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
312 |
|
4357
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
313 |
void |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
314 |
Socket::DoDispose (void) |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
315 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
316 |
NS_LOG_FUNCTION (this); |
4357
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
317 |
m_connectionSucceeded = MakeNullCallback<void,Ptr<Socket> > (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
318 |
m_connectionFailed = MakeNullCallback<void,Ptr<Socket> > (); |
7747
53a26ce38807
Bug 1377: various memory leaks
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7704
diff
changeset
|
319 |
m_normalClose = MakeNullCallback<void,Ptr<Socket> > (); |
53a26ce38807
Bug 1377: various memory leaks
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
7704
diff
changeset
|
320 |
m_errorClose = MakeNullCallback<void,Ptr<Socket> > (); |
4357
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
321 |
m_connectionRequest = MakeNullCallback<bool,Ptr<Socket>, const Address &> (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
322 |
m_newConnectionCreated = MakeNullCallback<void,Ptr<Socket>, const Address &> (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
323 |
m_dataSent = MakeNullCallback<void,Ptr<Socket>, uint32_t> (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
324 |
m_sendCb = MakeNullCallback<void,Ptr<Socket>, uint32_t> (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
325 |
m_receivedData = MakeNullCallback<void,Ptr<Socket> > (); |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
326 |
} |
9c638ff9f732
actually reset callbacks in the socket's DoDispose method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3820
diff
changeset
|
327 |
|
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
328 |
void |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
329 |
Socket::BindToNetDevice (Ptr<NetDevice> netdevice) |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
330 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
331 |
NS_LOG_FUNCTION (this << netdevice); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
332 |
if (netdevice != 0) |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
333 |
{ |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
334 |
bool found = false; |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7220
diff
changeset
|
335 |
for (uint32_t i = 0; i < GetNode ()->GetNDevices (); i++) |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
336 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7220
diff
changeset
|
337 |
if (GetNode ()->GetDevice (i) == netdevice) |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
338 |
{ |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
339 |
found = true; |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
340 |
break; |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
341 |
} |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
342 |
} |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
343 |
NS_ASSERT_MSG (found, "Socket cannot be bound to a NetDevice not existing on the Node"); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
344 |
} |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
345 |
m_boundnetdevice = netdevice; |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
346 |
return; |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
347 |
} |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
348 |
|
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
349 |
Ptr<NetDevice> |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
350 |
Socket::GetBoundNetDevice () |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
351 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
352 |
NS_LOG_FUNCTION (this); |
5856
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
353 |
return m_boundnetdevice; |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
354 |
} |
7fd20c798a7d
bug 742: Implementation of SO_BINDTODEVICE
Antti Mäkelä <zarhan@cc.hut.fi>
parents:
5720
diff
changeset
|
355 |
|
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6393
diff
changeset
|
356 |
void |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6393
diff
changeset
|
357 |
Socket::SetRecvPktInfo (bool flag) |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6393
diff
changeset
|
358 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
359 |
NS_LOG_FUNCTION (this << flag); |
7758
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
360 |
m_recvPktInfo = flag; |
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
361 |
} |
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
362 |
|
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
363 |
bool Socket::IsRecvPktInfo () const |
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
364 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
365 |
NS_LOG_FUNCTION (this); |
7758
c678188af993
Replace references to m_recvpktinfo with method call IsRecvPktInfo()
frederic.urbani@inria.fr
parents:
7747
diff
changeset
|
366 |
return m_recvPktInfo; |
6442
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6393
diff
changeset
|
367 |
} |
f380cf1aa4d8
Bug 671 add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents:
6393
diff
changeset
|
368 |
|
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
369 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
370 |
Socket::IsManualIpTos (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
371 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
372 |
return m_manualIpTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
373 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
374 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
375 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
376 |
Socket::IsManualIpv6Tclass (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
377 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
378 |
return m_manualIpv6Tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
379 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
380 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
381 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
382 |
Socket::IsManualIpTtl (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
383 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
384 |
return m_manualIpTtl; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
385 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
386 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
387 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
388 |
Socket::IsManualIpv6HopLimit (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
389 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
390 |
return m_manualIpv6HopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
391 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
392 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
393 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
394 |
Socket::SetIpTos (uint8_t tos) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
395 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
396 |
Address address; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
397 |
GetSockName (address); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
398 |
m_manualIpTos = true; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
399 |
m_ipTos = tos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
400 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
401 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
402 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
403 |
Socket::GetIpTos (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
404 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
405 |
return m_ipTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
406 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
407 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
408 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
409 |
Socket::SetIpRecvTos (bool ipv4RecvTos) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
410 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
411 |
m_ipRecvTos = ipv4RecvTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
412 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
413 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
414 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
415 |
Socket::IsIpRecvTos (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
416 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
417 |
return m_ipRecvTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
418 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
419 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
420 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
421 |
Socket::SetIpv6Tclass (int tclass) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
422 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
423 |
Address address; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
424 |
GetSockName (address); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
425 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
426 |
//If -1 or invalid values, use default |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
427 |
if (tclass == -1 || tclass < -1 || tclass > 0xff) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
428 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
429 |
//Print a warning |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
430 |
if (tclass < -1 || tclass > 0xff) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
431 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
432 |
NS_LOG_WARN ("Invalid IPV6_TCLASS value. Using default."); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
433 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
434 |
m_manualIpv6Tclass = false; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
435 |
m_ipv6Tclass = 0; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
436 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
437 |
else |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
438 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
439 |
m_manualIpv6Tclass = true; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
440 |
m_ipv6Tclass = tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
441 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
442 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
443 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
444 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
445 |
Socket::GetIpv6Tclass (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
446 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
447 |
return m_ipv6Tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
448 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
449 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
450 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
451 |
Socket::SetIpv6RecvTclass (bool ipv6RecvTclass) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
452 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
453 |
m_ipv6RecvTclass = ipv6RecvTclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
454 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
455 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
456 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
457 |
Socket::IsIpv6RecvTclass (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
458 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
459 |
return m_ipv6RecvTclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
460 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
461 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
462 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
463 |
Socket::SetIpTtl (uint8_t ttl) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
464 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
465 |
m_manualIpTtl = true; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
466 |
m_ipTtl = ttl; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
467 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
468 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
469 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
470 |
Socket::GetIpTtl (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
471 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
472 |
return m_ipTtl; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
473 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
474 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
475 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
476 |
Socket::SetIpRecvTtl (bool ipv4RecvTtl) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
477 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
478 |
m_ipRecvTtl = ipv4RecvTtl; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
479 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
480 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
481 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
482 |
Socket::IsIpRecvTtl (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
483 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
484 |
return m_ipRecvTtl; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
485 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
486 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
487 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
488 |
Socket::SetIpv6HopLimit (uint8_t ipHopLimit) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
489 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
490 |
m_manualIpv6HopLimit = true; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
491 |
m_ipv6HopLimit = ipHopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
492 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
493 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
494 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
495 |
Socket::GetIpv6HopLimit (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
496 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
497 |
return m_ipv6HopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
498 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
499 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
500 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
501 |
Socket::SetIpv6RecvHopLimit (bool ipv6RecvHopLimit) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
502 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
503 |
m_ipv6RecvHopLimit = ipv6RecvHopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
504 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
505 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
506 |
bool |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
507 |
Socket::IsIpv6RecvHopLimit (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
508 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
509 |
return m_ipv6RecvHopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
510 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
511 |
|
3138 | 512 |
/*************************************************************** |
513 |
* Socket Tags |
|
514 |
***************************************************************/ |
|
515 |
||
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
516 |
SocketAddressTag::SocketAddressTag () |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
517 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
518 |
NS_LOG_FUNCTION (this); |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
519 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
520 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
521 |
void |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
522 |
SocketAddressTag::SetAddress (Address addr) |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
523 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
524 |
NS_LOG_FUNCTION (this << addr); |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
525 |
m_address = addr; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
526 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
527 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
528 |
Address |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
529 |
SocketAddressTag::GetAddress (void) const |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
530 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
531 |
NS_LOG_FUNCTION (this); |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
532 |
return m_address; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
533 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
534 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
535 |
NS_OBJECT_ENSURE_REGISTERED (SocketAddressTag); |
3138 | 536 |
|
537 |
TypeId |
|
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
538 |
SocketAddressTag::GetTypeId (void) |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
539 |
{ |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
540 |
static TypeId tid = TypeId ("ns3::SocketAddressTag") |
3138 | 541 |
.SetParent<Tag> () |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
542 |
.AddConstructor<SocketAddressTag> () |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
543 |
; |
3138 | 544 |
return tid; |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
545 |
} |
3138 | 546 |
TypeId |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
547 |
SocketAddressTag::GetInstanceTypeId (void) const |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
548 |
{ |
3138 | 549 |
return GetTypeId (); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
550 |
} |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
551 |
uint32_t |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
552 |
SocketAddressTag::GetSerializedSize (void) const |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
553 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
554 |
NS_LOG_FUNCTION (this); |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
555 |
return m_address.GetSerializedSize (); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
556 |
} |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
557 |
void |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
558 |
SocketAddressTag::Serialize (TagBuffer i) const |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
559 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
560 |
NS_LOG_FUNCTION (this << &i); |
3167
644a220ad981
Fix off-by-2 errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3142
diff
changeset
|
561 |
m_address.Serialize (i); |
3138 | 562 |
} |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
563 |
void |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
564 |
SocketAddressTag::Deserialize (TagBuffer i) |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
565 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
566 |
NS_LOG_FUNCTION (this << &i); |
3167
644a220ad981
Fix off-by-2 errors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3142
diff
changeset
|
567 |
m_address.Deserialize (i); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
568 |
} |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
569 |
void |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
570 |
SocketAddressTag::Print (std::ostream &os) const |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
571 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
572 |
NS_LOG_FUNCTION (this << &os); |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
573 |
os << "address=" << m_address; |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
574 |
} |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
575 |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
576 |
SocketIpTtlTag::SocketIpTtlTag () |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
577 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
578 |
NS_LOG_FUNCTION (this); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
579 |
} |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
580 |
|
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
581 |
void |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
582 |
SocketIpTtlTag::SetTtl (uint8_t ttl) |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
583 |
{ |
9157
2d4305dd159a
Fix printing of uint8_t data in NS_LOG_FUNCTION introduced by 9144:6a15c50388bc Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
9145
diff
changeset
|
584 |
NS_LOG_FUNCTION (this << static_cast<uint32_t> (ttl)); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
585 |
m_ttl = ttl; |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
586 |
} |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
587 |
|
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
588 |
uint8_t |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
589 |
SocketIpTtlTag::GetTtl (void) const |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
590 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
591 |
NS_LOG_FUNCTION (this); |
3124
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
592 |
return m_ttl; |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
593 |
} |
473e59b5e141
Implement IPTTL socket option for UDP
Tom Henderson <tomh@tomh.org>
parents:
3123
diff
changeset
|
594 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
595 |
NS_OBJECT_ENSURE_REGISTERED (SocketIpTtlTag); |
3138 | 596 |
|
597 |
TypeId |
|
598 |
SocketIpTtlTag::GetTypeId (void) |
|
599 |
{ |
|
600 |
static TypeId tid = TypeId ("ns3::SocketIpTtlTag") |
|
601 |
.SetParent<Tag> () |
|
602 |
.AddConstructor<SocketIpTtlTag> () |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
603 |
; |
3138 | 604 |
return tid; |
605 |
} |
|
606 |
TypeId |
|
607 |
SocketIpTtlTag::GetInstanceTypeId (void) const |
|
608 |
{ |
|
609 |
return GetTypeId (); |
|
610 |
} |
|
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
611 |
|
3138 | 612 |
uint32_t |
613 |
SocketIpTtlTag::GetSerializedSize (void) const |
|
614 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
615 |
NS_LOG_FUNCTION (this); |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
616 |
return 1; |
3138 | 617 |
} |
618 |
void |
|
619 |
SocketIpTtlTag::Serialize (TagBuffer i) const |
|
620 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
621 |
NS_LOG_FUNCTION (this << &i); |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
622 |
i.WriteU8 (m_ttl); |
3138 | 623 |
} |
624 |
void |
|
625 |
SocketIpTtlTag::Deserialize (TagBuffer i) |
|
626 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
627 |
NS_LOG_FUNCTION (this << &i); |
3139
37deb9deaf0e
Add tag serialize methods; add serialize routines to Address
Tom Henderson <tomh@tomh.org>
parents:
3138
diff
changeset
|
628 |
m_ttl = i.ReadU8 (); |
3138 | 629 |
} |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
630 |
void |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
631 |
SocketIpTtlTag::Print (std::ostream &os) const |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
632 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
633 |
NS_LOG_FUNCTION (this << &os); |
3208
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
634 |
os << "Ttl=" << (uint32_t) m_ttl; |
1a754d09c4ba
bug 200: Packet::PrintTags is not implemented.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3167
diff
changeset
|
635 |
} |
3138 | 636 |
|
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
637 |
SocketIpv6HopLimitTag::SocketIpv6HopLimitTag () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
638 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
639 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
640 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
641 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
642 |
SocketIpv6HopLimitTag::SetHopLimit (uint8_t hopLimit) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
643 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
644 |
m_hopLimit = hopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
645 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
646 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
647 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
648 |
SocketIpv6HopLimitTag::GetHopLimit (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
649 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
650 |
return m_hopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
651 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
652 |
|
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
653 |
NS_OBJECT_ENSURE_REGISTERED (SocketIpv6HopLimitTag); |
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
654 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
655 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
656 |
SocketIpv6HopLimitTag::GetTypeId (void) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
657 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
658 |
static TypeId tid = TypeId ("ns3::SocketIpv6HopLimitTag") |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
659 |
.SetParent<Tag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
660 |
.AddConstructor<SocketIpv6HopLimitTag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
661 |
; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
662 |
return tid; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
663 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
664 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
665 |
SocketIpv6HopLimitTag::GetInstanceTypeId (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
666 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
667 |
return GetTypeId (); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
668 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
669 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
670 |
uint32_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
671 |
SocketIpv6HopLimitTag::GetSerializedSize (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
672 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
673 |
return 1; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
674 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
675 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
676 |
SocketIpv6HopLimitTag::Serialize (TagBuffer i) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
677 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
678 |
i.WriteU8 (m_hopLimit); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
679 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
680 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
681 |
SocketIpv6HopLimitTag::Deserialize (TagBuffer i) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
682 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
683 |
m_hopLimit = i.ReadU8 (); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
684 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
685 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
686 |
SocketIpv6HopLimitTag::Print (std::ostream &os) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
687 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
688 |
os << "HopLimit=" << (uint32_t) m_hopLimit; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
689 |
} |
3269
448134601b03
RecvFrom() expansion, add flags parameter to some Send calls
Tom Henderson <tomh@tomh.org>
parents:
3248
diff
changeset
|
690 |
|
3820 | 691 |
SocketSetDontFragmentTag::SocketSetDontFragmentTag () |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
692 |
{ |
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
693 |
NS_LOG_FUNCTION (this); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
694 |
} |
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
695 |
void |
3820 | 696 |
SocketSetDontFragmentTag::Enable (void) |
697 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
698 |
NS_LOG_FUNCTION (this); |
3820 | 699 |
m_dontFragment = true; |
700 |
} |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
701 |
void |
3820 | 702 |
SocketSetDontFragmentTag::Disable (void) |
703 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
704 |
NS_LOG_FUNCTION (this); |
3820 | 705 |
m_dontFragment = false; |
706 |
} |
|
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
707 |
bool |
3820 | 708 |
SocketSetDontFragmentTag::IsEnabled (void) const |
709 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
710 |
NS_LOG_FUNCTION (this); |
3820 | 711 |
return m_dontFragment; |
712 |
} |
|
713 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
714 |
NS_OBJECT_ENSURE_REGISTERED (SocketSetDontFragmentTag); |
6393
f7e1f9dfa08d
ensure objects are regsitered
Josh Pelkey <jpelkey@gatech.edu>
parents:
5856
diff
changeset
|
715 |
|
3820 | 716 |
TypeId |
717 |
SocketSetDontFragmentTag::GetTypeId (void) |
|
718 |
{ |
|
719 |
static TypeId tid = TypeId ("ns3::SocketSetDontFragmentTag") |
|
720 |
.SetParent<Tag> () |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
721 |
.AddConstructor<SocketSetDontFragmentTag> (); |
3820 | 722 |
return tid; |
723 |
} |
|
724 |
TypeId |
|
725 |
SocketSetDontFragmentTag::GetInstanceTypeId (void) const |
|
726 |
{ |
|
727 |
return GetTypeId (); |
|
728 |
} |
|
729 |
uint32_t |
|
730 |
SocketSetDontFragmentTag::GetSerializedSize (void) const |
|
731 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
732 |
NS_LOG_FUNCTION (this); |
3820 | 733 |
return 1; |
734 |
} |
|
735 |
void |
|
736 |
SocketSetDontFragmentTag::Serialize (TagBuffer i) const |
|
737 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
738 |
NS_LOG_FUNCTION (this << &i); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
739 |
i.WriteU8 (m_dontFragment ? 1 : 0); |
3820 | 740 |
} |
741 |
void |
|
742 |
SocketSetDontFragmentTag::Deserialize (TagBuffer i) |
|
743 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
744 |
NS_LOG_FUNCTION (this << &i); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
745 |
m_dontFragment = (i.ReadU8 () == 1) ? true : false; |
3820 | 746 |
} |
747 |
void |
|
748 |
SocketSetDontFragmentTag::Print (std::ostream &os) const |
|
749 |
{ |
|
9144
6a15c50388bc
Clean up function logging of network module.
Maja Grubišić <maja.grubisic@live.com>
parents:
7870
diff
changeset
|
750 |
NS_LOG_FUNCTION (this << &os); |
7182
5ecfee5d17de
network coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6823
diff
changeset
|
751 |
os << (m_dontFragment ? "true" : "false"); |
3820 | 752 |
} |
753 |
||
9145
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
754 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
755 |
SocketIpTosTag::SocketIpTosTag () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
756 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
757 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
758 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
759 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
760 |
SocketIpTosTag::SetTos (uint8_t ipTos) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
761 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
762 |
m_ipTos = ipTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
763 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
764 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
765 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
766 |
SocketIpTosTag::GetTos (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
767 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
768 |
return m_ipTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
769 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
770 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
771 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
772 |
SocketIpTosTag::GetTypeId (void) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
773 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
774 |
static TypeId tid = TypeId ("ns3::SocketIpTosTag") |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
775 |
.SetParent<Tag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
776 |
.AddConstructor<SocketIpTosTag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
777 |
; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
778 |
return tid; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
779 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
780 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
781 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
782 |
SocketIpTosTag::GetInstanceTypeId (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
783 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
784 |
return GetTypeId (); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
785 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
786 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
787 |
uint32_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
788 |
SocketIpTosTag::GetSerializedSize (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
789 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
790 |
return sizeof (uint8_t); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
791 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
792 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
793 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
794 |
SocketIpTosTag::Serialize (TagBuffer i) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
795 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
796 |
i.WriteU8 (m_ipTos); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
797 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
798 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
799 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
800 |
SocketIpTosTag::Deserialize (TagBuffer i) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
801 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
802 |
m_ipTos = i.ReadU8(); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
803 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
804 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
805 |
SocketIpTosTag::Print (std::ostream &os) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
806 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
807 |
os << "IP_TOS = " << m_ipTos; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
808 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
809 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
810 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
811 |
SocketIpv6TclassTag::SocketIpv6TclassTag () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
812 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
813 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
814 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
815 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
816 |
SocketIpv6TclassTag::SetTclass (uint8_t tclass) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
817 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
818 |
m_ipv6Tclass = tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
819 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
820 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
821 |
uint8_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
822 |
SocketIpv6TclassTag::GetTclass (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
823 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
824 |
return m_ipv6Tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
825 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
826 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
827 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
828 |
SocketIpv6TclassTag::GetTypeId (void) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
829 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
830 |
static TypeId tid = TypeId ("ns3::SocketIpv6TclassTag") |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
831 |
.SetParent<Tag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
832 |
.AddConstructor<SocketIpv6TclassTag> () |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
833 |
; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
834 |
return tid; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
835 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
836 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
837 |
TypeId |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
838 |
SocketIpv6TclassTag::GetInstanceTypeId (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
839 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
840 |
return GetTypeId (); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
841 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
842 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
843 |
uint32_t |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
844 |
SocketIpv6TclassTag::GetSerializedSize (void) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
845 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
846 |
return sizeof (uint8_t); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
847 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
848 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
849 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
850 |
SocketIpv6TclassTag::Serialize (TagBuffer i) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
851 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
852 |
i.WriteU8 (m_ipv6Tclass); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
853 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
854 |
|
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
855 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
856 |
SocketIpv6TclassTag::Deserialize (TagBuffer i) |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
857 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
858 |
m_ipv6Tclass = i.ReadU8(); |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
859 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
860 |
void |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
861 |
SocketIpv6TclassTag::Print (std::ostream &os) const |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
862 |
{ |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
863 |
os << "IPV6_TCLASS = " << m_ipv6Tclass; |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
864 |
} |
5752b425cdf5
Bug 1361 - Set TOS from Application level (sockets)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
9144
diff
changeset
|
865 |
|
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7256
diff
changeset
|
866 |
} // namespace ns3 |