author | Tom Henderson <tomh@tomh.org> |
Sat, 10 May 2008 21:27:32 -0700 | |
changeset 3107 | ec3ed34b2470 |
parent 3103 | 91c6fce46125 |
child 3116 | c33b6d2775b7 |
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" |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "socket.h" |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
26 |
|
1505 | 27 |
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
|
28 |
|
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
namespace ns3 { |
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
3107 | 31 |
TypeId |
32 |
SocketOptions::GetTypeId (void) |
|
33 |
{ |
|
34 |
static TypeId tid = TypeId ("ns3::SocketOptions") |
|
35 |
.SetParent<Object> () |
|
36 |
.AddConstructor<SocketOptions> () |
|
37 |
; |
|
38 |
return tid; |
|
39 |
} |
|
40 |
||
41 |
SocketOptions::SocketOptions (void) |
|
42 |
{ |
|
43 |
NS_LOG_FUNCTION_NOARGS (); |
|
44 |
} |
|
45 |
||
46 |
SocketOptions::~SocketOptions (void) |
|
47 |
{ |
|
48 |
NS_LOG_FUNCTION_NOARGS (); |
|
49 |
} |
|
50 |
||
51 |
||
52 |
void |
|
53 |
SocketOptions::SetSndBuf (uint32_t size) |
|
54 |
{ |
|
55 |
} |
|
56 |
||
57 |
uint32_t |
|
58 |
SocketOptions::GetSndBuf (void) const |
|
59 |
{ |
|
60 |
return 0; |
|
61 |
} |
|
62 |
||
63 |
void |
|
64 |
SocketOptions::SetRcvBuf (uint32_t size) |
|
65 |
{ |
|
66 |
} |
|
67 |
||
68 |
uint32_t |
|
69 |
SocketOptions::GetRcvBuf (void) const |
|
70 |
{ |
|
71 |
return 0; |
|
72 |
} |
|
73 |
||
74 |
Socket::Socket (void) |
|
75 |
{ |
|
76 |
NS_LOG_FUNCTION_NOARGS (); |
|
77 |
Ptr<SocketOptions> s = CreateObject<SocketOptions> (); |
|
78 |
AggregateObject (s); |
|
79 |
} |
|
80 |
||
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
Socket::~Socket () |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
82 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
83 |
NS_LOG_FUNCTION_NOARGS (); |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
84 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
86 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
87 |
Socket::SetCloseCallback (Callback<void,Ptr<Socket> > closeCompleted) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
88 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
89 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
90 |
m_closeCompleted = closeCompleted; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
91 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
92 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
93 |
void |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
94 |
Socket::SetConnectCallback ( |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
95 |
Callback<void, Ptr<Socket> > connectionSucceeded, |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
96 |
Callback<void, Ptr<Socket> > connectionFailed, |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
97 |
Callback<void, Ptr<Socket> > halfClose) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
99 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
100 |
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
|
101 |
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
|
102 |
m_halfClose = halfClose; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
103 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
104 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
105 |
void |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
106 |
Socket::SetAcceptCallback ( |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
107 |
Callback<bool, Ptr<Socket>, const Address &> connectionRequest, |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
108 |
Callback<void, Ptr<Socket>, const Address&> newConnectionCreated, |
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
109 |
Callback<void, Ptr<Socket> > closeRequested) |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
110 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
111 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
112 |
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
|
113 |
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
|
114 |
m_closeRequested = closeRequested; |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
115 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
116 |
|
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
117 |
bool |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
118 |
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
|
119 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
120 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
121 |
m_dataSent = dataSent; |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
122 |
return true; |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
123 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
124 |
|
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
125 |
void |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
126 |
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
|
127 |
{ |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
128 |
NS_LOG_FUNCTION_NOARGS (); |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
129 |
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
|
130 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
131 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
132 |
void |
3102 | 133 |
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
|
134 |
{ |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
135 |
NS_LOG_FUNCTION_NOARGS (); |
3102 | 136 |
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
|
137 |
} |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
138 |
|
3000
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
139 |
int Socket::Listen (uint32_t queueLimit) |
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
140 |
{ |
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
141 |
return 0; //XXX the base class version does nothing |
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
142 |
} |
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
143 |
|
bd2d3e32ef7b
A few minor cleanups to socket.h/cc
Tom Henderson <tomh@tomh.org>
parents:
2999
diff
changeset
|
144 |
|
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
145 |
int Socket::Send (const uint8_t* buf, uint32_t size) |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
146 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
147 |
NS_LOG_FUNCTION_NOARGS (); |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
148 |
Ptr<Packet> p; |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
149 |
if (buf) |
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> (buf, size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
152 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
153 |
else |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
154 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
155 |
p = Create<Packet> (size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
156 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
157 |
return Send (p); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
158 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
159 |
|
3103
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
160 |
Ptr<Packet> |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
161 |
Socket::Recv (void) |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
162 |
{ |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
163 |
return Recv (std::numeric_limits<uint32_t>::max(), 0); |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
164 |
} |
91c6fce46125
overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents:
3102
diff
changeset
|
165 |
|
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
166 |
int Socket::SendTo (const Address &address, const uint8_t* buf, uint32_t size) |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
167 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
168 |
NS_LOG_FUNCTION_NOARGS (); |
2186
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
169 |
Ptr<Packet> p; |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
170 |
if(buf) |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
171 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
172 |
p = Create<Packet> (buf, size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
173 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
174 |
else |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
175 |
{ |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
176 |
p = Create<Packet> (size); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
177 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
178 |
return SendTo (address,p); |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
179 |
} |
69ad6ed6ccf4
Add uint8_t* based API for sockets
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1866
diff
changeset
|
180 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
181 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
182 |
Socket::NotifyCloseCompleted (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
183 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
184 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
185 |
if (!m_closeCompleted.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
186 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
187 |
m_closeCompleted (this); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
188 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
189 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
190 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
191 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
192 |
Socket::NotifyConnectionSucceeded (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
193 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
194 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
195 |
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
|
196 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
197 |
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
|
198 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
199 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
200 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
201 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
202 |
Socket::NotifyConnectionFailed (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
203 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
204 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
205 |
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
|
206 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
207 |
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
|
208 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
209 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
210 |
|
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
void |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
212 |
Socket::NotifyHalfClose (void) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
213 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
214 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
215 |
if (!m_halfClose.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
216 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
217 |
m_halfClose (this); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
218 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
219 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
220 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
221 |
bool |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
222 |
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
|
223 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
224 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
225 |
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
|
226 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
227 |
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
|
228 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
229 |
else |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
230 |
{ |
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
|
231 |
// 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
|
232 |
// 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
|
233 |
// 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
|
234 |
// 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
|
235 |
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
|
236 |
} |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
237 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
238 |
|
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
239 |
void |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
240 |
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
|
241 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
242 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
243 |
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
|
244 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
245 |
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
|
246 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
247 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
248 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
249 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
250 |
Socket::NotifyCloseRequested (void) |
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
251 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
252 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
253 |
if (!m_closeRequested.IsNull ()) |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
254 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
255 |
m_closeRequested (this); |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
256 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
257 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
258 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
259 |
void |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
260 |
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
|
261 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2367
diff
changeset
|
262 |
NS_LOG_FUNCTION_NOARGS (); |
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
263 |
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
|
264 |
{ |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
265 |
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
|
266 |
} |
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
267 |
} |
1499
93d51d757afa
working one way echo app
Craig Dowell <craigdo@ee.washington.edu>
parents:
1265
diff
changeset
|
268 |
|
1264
577875bb5a65
split callback registration from socket operations in socket.h API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
269 |
void |
2999
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
270 |
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
|
271 |
{ |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
272 |
NS_LOG_FUNCTION_NOARGS (); |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
273 |
if (!m_sendCb.IsNull ()) |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
274 |
{ |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
275 |
m_sendCb (this, spaceAvailable); |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
276 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
277 |
} |
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
278 |
|
0b10920623bf
bug 131 partial fix: split out Send and DataSent callbacks
Tom Henderson <tomh@tomh.org>
parents:
2983
diff
changeset
|
279 |
void |
3097
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
280 |
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
|
281 |
{ |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
282 |
NS_LOG_FUNCTION_NOARGS (); |
3102 | 283 |
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
|
284 |
{ |
3102 | 285 |
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
|
286 |
} |
1b1661bbfa33
Plumb in socket receive pull model, in parallel to existing Receive framework
Tom Henderson <tomh@tomh.org>
parents:
3000
diff
changeset
|
287 |
} |
3098
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
288 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
289 |
SocketRxAddressTag::SocketRxAddressTag () |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
290 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
291 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
292 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
293 |
uint32_t |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
294 |
SocketRxAddressTag::GetUid (void) |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
295 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
296 |
static uint32_t uid = ns3::Tag::AllocateUid<SocketRxAddressTag> ("SocketRxAddressTag.ns3"); |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
297 |
return uid; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
298 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
299 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
300 |
void |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
301 |
SocketRxAddressTag::Print (std::ostream &os) const |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
302 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
303 |
os << "address="<< m_address; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
304 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
305 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
306 |
uint32_t |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
307 |
SocketRxAddressTag::GetSerializedSize (void) const |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
308 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
309 |
return 0; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
310 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
311 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
312 |
void |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
313 |
SocketRxAddressTag::Serialize (Buffer::Iterator i) const |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
314 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
315 |
// for local use in stack only |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
316 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
317 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
318 |
uint32_t |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
319 |
SocketRxAddressTag::Deserialize (Buffer::Iterator i) |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
320 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
321 |
// for local use in stack only |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
322 |
return 0; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
323 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
324 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
325 |
void |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
326 |
SocketRxAddressTag::SetAddress (Address addr) |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
327 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
328 |
m_address = addr; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
329 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
330 |
|
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
331 |
Address |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
332 |
SocketRxAddressTag::GetAddress (void) const |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
333 |
{ |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
334 |
return m_address; |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
335 |
} |
d384d52f8f6e
Cut over UDP applications to use the new receive API
Tom Henderson <tomh@tomh.org>
parents:
3097
diff
changeset
|
336 |
|
453
ddbb935800d8
remove DatagramSocket, use Socket base class for UdpSocket subclass.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
337 |
}//namespace ns3 |