A Discrete-Event Network Simulator
API
socket.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 Georgia Tech Research Corporation
4  * 2007 INRIA
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: George F. Riley<riley@ece.gatech.edu>
20  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21  */
22 
23 #ifndef NS3_SOCKET_H
24 #define NS3_SOCKET_H
25 
26 #include "ns3/callback.h"
27 #include "ns3/ptr.h"
28 #include "ns3/tag.h"
29 #include "ns3/object.h"
30 #include "ns3/net-device.h"
31 #include "address.h"
32 #include <stdint.h>
33 #include "ns3/inet-socket-address.h"
34 #include "ns3/inet6-socket-address.h"
35 
36 namespace ns3 {
37 
38 
39 class Node;
40 class Packet;
41 
66 class Socket : public Object
67 {
68 public:
73  static TypeId GetTypeId (void);
74 
75  Socket (void);
76  virtual ~Socket (void);
77 
82  enum SocketErrno {
98  };
99 
104  enum SocketType {
109  };
110 
125  };
126 
139  {
142  };
143 
153  static Ptr<Socket> CreateSocket (Ptr<Node> node, TypeId tid);
161  virtual enum Socket::SocketErrno GetErrno (void) const = 0;
165  virtual enum Socket::SocketType GetSocketType (void) const = 0;
170  virtual Ptr<Node> GetNode (void) const = 0;
183  void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
184  Callback<void, Ptr<Socket> > connectionFailed);
200  void SetCloseCallbacks (Callback<void, Ptr<Socket> > normalClose,
201  Callback<void, Ptr<Socket> > errorClose);
220  const Address &> connectionRequest,
221  Callback<void, Ptr<Socket>,
222  const Address&> newConnectionCreated);
231  uint32_t> dataSent);
246  void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb);
254  void SetRecvCallback (Callback<void, Ptr<Socket> >);
260  virtual int Bind (const Address &address) = 0;
261 
267  virtual int Bind () = 0;
268 
274  virtual int Bind6 () = 0;
275 
283  virtual int Close (void) = 0;
284 
291  virtual int ShutdownSend (void) = 0;
292 
299  virtual int ShutdownRecv (void) = 0;
300 
306  virtual int Connect (const Address &address) = 0;
307 
312  virtual int Listen (void) = 0;
313 
326  virtual uint32_t GetTxAvailable (void) const = 0;
327 
373  virtual int Send (Ptr<Packet> p, uint32_t flags) = 0;
374 
388  virtual int SendTo (Ptr<Packet> p, uint32_t flags,
389  const Address &toAddress) = 0;
390 
399  virtual uint32_t GetRxAvailable (void) const = 0;
400 
452  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags) = 0;
453 
473  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags,
474  Address &fromAddress) = 0;
475 
477  // The remainder of these public methods are overloaded methods //
478  // or variants of Send() and Recv(), and they are non-virtual //
480 
490  int Send (Ptr<Packet> p);
491 
506  int Send (const uint8_t* buf, uint32_t size, uint32_t flags);
507 
508 
525  int SendTo (const uint8_t* buf, uint32_t size, uint32_t flags,
526  const Address &address);
527 
537  Ptr<Packet> Recv (void);
538 
553  int Recv (uint8_t* buf, uint32_t size, uint32_t flags);
554 
568  Ptr<Packet> RecvFrom (Address &fromAddress);
569 
587  int RecvFrom (uint8_t* buf, uint32_t size, uint32_t flags,
588  Address &fromAddress);
594  virtual int GetSockName (Address &address) const = 0;
595 
601  virtual int GetPeerName (Address &address) const = 0;
602 
622  virtual void BindToNetDevice (Ptr<NetDevice> netdevice);
623 
634 
635 
647  virtual bool SetAllowBroadcast (bool allowBroadcast) = 0;
648 
657  virtual bool GetAllowBroadcast () const = 0;
658 
671  void SetRecvPktInfo (bool flag);
672 
678  bool IsRecvPktInfo () const;
679 
692  void SetPriority (uint8_t priority);
693 
702  uint8_t GetPriority (void) const;
703 
780  static uint8_t IpTos2Priority (uint8_t ipTos);
781 
792  void SetIpTos (uint8_t ipTos);
793 
802  uint8_t GetIpTos (void) const;
803 
815  void SetIpRecvTos (bool ipv4RecvTos);
816 
825  bool IsIpRecvTos (void) const;
826 
837  void SetIpv6Tclass (int ipTclass);
838 
847  uint8_t GetIpv6Tclass (void) const;
848 
860  void SetIpv6RecvTclass (bool ipv6RecvTclass);
861 
870  bool IsIpv6RecvTclass (void) const;
871 
880  virtual void SetIpTtl (uint8_t ipTtl);
881 
890  virtual uint8_t GetIpTtl (void) const;
891 
903  void SetIpRecvTtl (bool ipv4RecvTtl);
904 
913  bool IsIpRecvTtl (void) const;
914 
923  virtual void SetIpv6HopLimit (uint8_t ipHopLimit);
924 
933  virtual uint8_t GetIpv6HopLimit (void) const;
934 
946  void SetIpv6RecvHopLimit (bool ipv6RecvHopLimit);
947 
956  bool IsIpv6RecvHopLimit (void) const;
957 
971  virtual void Ipv6JoinGroup (Ipv6Address address, Ipv6MulticastFilterMode filterMode, std::vector<Ipv6Address> sourceAddresses);
972 
980  virtual void Ipv6JoinGroup (Ipv6Address address);
981 
985  virtual void Ipv6LeaveGroup (void);
986 
987 protected:
992  void NotifyConnectionSucceeded (void);
993 
998  void NotifyConnectionFailed (void);
999 
1004  void NotifyNormalClose (void);
1005 
1010  void NotifyErrorClose (void);
1011 
1023  bool NotifyConnectionRequest (const Address &from);
1024 
1031  void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
1032 
1038  void NotifyDataSent (uint32_t size);
1039 
1045  void NotifySend (uint32_t spaceAvailable);
1046 
1050  void NotifyDataRecv (void);
1051 
1052  // inherited function, no doc necessary
1053  virtual void DoDispose (void);
1054 
1060  bool IsManualIpv6Tclass (void) const;
1061 
1067  bool IsManualIpTtl (void) const;
1068 
1074  bool IsManualIpv6HopLimit (void) const;
1075 
1079 
1080 private:
1090 
1091  uint8_t m_priority;
1092 
1093  //IPv4 options
1097 
1098  uint8_t m_ipTos;
1099  uint8_t m_ipTtl;
1100 
1101  //IPv6 options
1106 
1107  uint8_t m_ipv6Tclass;
1108  uint8_t m_ipv6HopLimit;
1109 };
1110 
1115 class SocketIpTtlTag : public Tag
1116 {
1117 public:
1118  SocketIpTtlTag ();
1119 
1125  void SetTtl (uint8_t ttl);
1126 
1132  uint8_t GetTtl (void) const;
1133 
1138  static TypeId GetTypeId (void);
1139 
1140  // inherited function, no need to doc.
1141  virtual TypeId GetInstanceTypeId (void) const;
1142 
1143  // inherited function, no need to doc.
1144  virtual uint32_t GetSerializedSize (void) const;
1145 
1146  // inherited function, no need to doc.
1147  virtual void Serialize (TagBuffer i) const;
1148 
1149  // inherited function, no need to doc.
1150  virtual void Deserialize (TagBuffer i);
1151 
1152  // inherited function, no need to doc.
1153  virtual void Print (std::ostream &os) const;
1154 
1155 private:
1156  uint8_t m_ttl;
1157 };
1158 
1164 {
1165 public:
1167 
1173  void SetHopLimit (uint8_t hopLimit);
1174 
1180  uint8_t GetHopLimit (void) const;
1181 
1186  static TypeId GetTypeId (void);
1187 
1188  // inherited function, no need to doc.
1189  virtual TypeId GetInstanceTypeId (void) const;
1190 
1191  // inherited function, no need to doc.
1192  virtual uint32_t GetSerializedSize (void) const;
1193 
1194  // inherited function, no need to doc.
1195  virtual void Serialize (TagBuffer i) const;
1196 
1197  // inherited function, no need to doc.
1198  virtual void Deserialize (TagBuffer i);
1199 
1200  // inherited function, no need to doc.
1201  virtual void Print (std::ostream &os) const;
1202 
1203 private:
1204  uint8_t m_hopLimit;
1205 };
1206 
1212 {
1213 public:
1215 
1219  void Enable (void);
1220 
1224  void Disable (void);
1225 
1231  bool IsEnabled (void) const;
1232 
1237  static TypeId GetTypeId (void);
1238 
1239  // inherited function, no need to doc.
1240  virtual TypeId GetInstanceTypeId (void) const;
1241 
1242  // inherited function, no need to doc.
1243  virtual uint32_t GetSerializedSize (void) const;
1244 
1245  // inherited function, no need to doc.
1246  virtual void Serialize (TagBuffer i) const;
1247 
1248  // inherited function, no need to doc.
1249  virtual void Deserialize (TagBuffer i);
1250 
1251  // inherited function, no need to doc.
1252  virtual void Print (std::ostream &os) const;
1253 private:
1255 };
1256 
1261 class SocketIpTosTag : public Tag
1262 {
1263 public:
1264  SocketIpTosTag ();
1265 
1271  void SetTos (uint8_t tos);
1272 
1278  uint8_t GetTos (void) const;
1279 
1284  static TypeId GetTypeId (void);
1285 
1286  // inherited function, no need to doc.
1287  virtual TypeId GetInstanceTypeId (void) const;
1288 
1289  // inherited function, no need to doc.
1290  virtual uint32_t GetSerializedSize (void) const;
1291 
1292  // inherited function, no need to doc.
1293  virtual void Serialize (TagBuffer i) const;
1294 
1295  // inherited function, no need to doc.
1296  virtual void Deserialize (TagBuffer i);
1297 
1298  // inherited function, no need to doc.
1299  virtual void Print (std::ostream &os) const;
1300 private:
1301  uint8_t m_ipTos;
1302 };
1303 
1307 class SocketPriorityTag : public Tag
1308 {
1309 public:
1310  SocketPriorityTag ();
1311 
1317  void SetPriority (uint8_t priority);
1318 
1324  uint8_t GetPriority (void) const;
1325 
1330  static TypeId GetTypeId (void);
1331 
1332  // inherited function, no need to doc.
1333  virtual TypeId GetInstanceTypeId (void) const;
1334 
1335  // inherited function, no need to doc.
1336  virtual uint32_t GetSerializedSize (void) const;
1337 
1338  // inherited function, no need to doc.
1339  virtual void Serialize (TagBuffer i) const;
1340 
1341  // inherited function, no need to doc.
1342  virtual void Deserialize (TagBuffer i);
1343 
1344  // inherited function, no need to doc.
1345  virtual void Print (std::ostream &os) const;
1346 private:
1347  uint8_t m_priority;
1348 };
1349 
1354 class SocketIpv6TclassTag : public Tag
1355 {
1356 public:
1358 
1364  void SetTclass (uint8_t tclass);
1365 
1371  uint8_t GetTclass (void) const;
1372 
1377  static TypeId GetTypeId (void);
1378 
1379  // inherited function, no need to doc.
1380  virtual TypeId GetInstanceTypeId (void) const;
1381 
1382  // inherited function, no need to doc.
1383  virtual uint32_t GetSerializedSize (void) const;
1384 
1385  // inherited function, no need to doc.
1386  virtual void Serialize (TagBuffer i) const;
1387 
1388  // inherited function, no need to doc.
1389  virtual void Deserialize (TagBuffer i);
1390 
1391  // inherited function, no need to doc.
1392  virtual void Print (std::ostream &os) const;
1393 private:
1394  uint8_t m_ipv6Tclass;
1395 };
1396 
1397 } // namespace ns3
1398 
1399 #endif /* NS3_SOCKET_H */
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:636
uint8_t m_ipv6HopLimit
the socket IPv6 Hop Limit
Definition: socket.h:1108
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:620
void SetTclass(uint8_t tclass)
Set the tag&#39;s Tclass.
Definition: socket.cc:900
uint8_t GetTos(void) const
Get the tag&#39;s TOS.
Definition: socket.cc:791
bool m_manualIpv6HopLimit
socket has IPv6 Hop Limit set
Definition: socket.h:1103
Callback template class.
Definition: callback.h:1176
void SetIpv6RecvTclass(bool ipv6RecvTclass)
Tells a socket to pass information about IPv6 Traffic Class up the stack.
Definition: socket.cc:501
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer...
Definition: socket.h:1163
bool IsIpRecvTos(void) const
Ask if the socket is currently passing information about IP Type of Service up the stack...
Definition: socket.cc:465
virtual int Bind6()=0
Allocate a local IPv6 endpoint for this socket.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
uint8_t m_hopLimit
the Hop Limit carried by the tag
Definition: socket.h:1204
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
Definition: socket.cc:305
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:630
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:820
virtual int ShutdownSend(void)=0
Ptr< Packet > Recv(void)
Read a single packet from the socket.
Definition: socket.cc:175
bool m_dontFragment
DF bit value for outgoing packets.
Definition: socket.h:1254
Socket(void)
Definition: socket.cc:45
virtual void Ipv6JoinGroup(Ipv6Address address, Ipv6MulticastFilterMode filterMode, std::vector< Ipv6Address > sourceAddresses)
Joins a IPv6 multicast group.
Definition: socket.cc:563
void NotifyConnectionFailed(void)
Notify through the callback (if set) that the connection has not been established due to an error...
Definition: socket.cc:227
uint8_t GetTclass(void) const
Get the tag&#39;s Tclass.
Definition: socket.cc:906
uint8_t GetPriority(void) const
Get the tag&#39;s priority.
Definition: socket.cc:848
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:741
Callback< bool, Ptr< Socket >, const Address & > m_connectionRequest
connection request callback
Definition: socket.h:1085
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:941
virtual int GetSockName(Address &address) const =0
Get socket address.
virtual int ShutdownRecv(void)=0
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:700
void SetIpRecvTos(bool ipv4RecvTos)
Tells a socket to pass information about IP Type of Service up the stack.
Definition: socket.cc:459
bool IsIpRecvTtl(void) const
Ask if the socket is currently passing information about IP_TTL up the stack.
Definition: socket.cc:532
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:912
void SetCloseCallbacks(Callback< void, Ptr< Socket > > normalClose, Callback< void, Ptr< Socket > > errorClose)
Detect socket recv() events such as graceful shutdown or error.
Definition: socket.cc:94
Callback< void, Ptr< Socket > > m_connectionSucceeded
connection succeeded callback
Definition: socket.h:1081
void SetTos(uint8_t tos)
Set the tag&#39;s TOS.
Definition: socket.cc:785
bool m_recvPktInfo
if the socket should add packet info tags to the packet forwarded to L4.
Definition: socket.h:1077
static uint8_t IpTos2Priority(uint8_t ipTos)
Return the priority corresponding to a given TOS value.
Definition: socket.cc:402
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
Definition: socket.h:1115
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
bool NotifyConnectionRequest(const Address &from)
Notify through the callback (if set) that an incoming connection is being requested by a remote host...
Definition: socket.cc:257
Ipv6Address m_ipv6MulticastGroupAddress
IPv6 multicast group address.
Definition: socket.h:1078
bool m_ipRecvTos
socket forwards IPv4 TOS tag to L4
Definition: socket.h:1095
virtual void Print(std::ostream &os) const
Definition: socket.cc:654
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:750
uint8_t m_ipv6Tclass
the socket IPv6 Tclass
Definition: socket.h:1107
virtual enum Socket::SocketErrno GetErrno(void) const =0
Get last error number.
a polymophic address class
Definition: address.h:90
uint8_t m_priority
the priority carried by the tag
Definition: socket.h:1347
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:520
virtual int Listen(void)=0
Listen for incoming connections.
void SetRecvPktInfo(bool flag)
Enable/Disable receive packet information to socket.
Definition: socket.cc:358
Ptr< NetDevice > GetBoundNetDevice()
Returns socket&#39;s bound NetDevice, if any.
Definition: socket.cc:351
A low-level Socket API based loosely on the BSD Socket API.
Definition: socket.h:66
Ipv6MulticastFilterMode
Enumeration of the possible filter of a socket.
Definition: socket.h:138
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:877
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:883
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:871
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:865
void SetTtl(uint8_t ttl)
Set the tag&#39;s TTL.
Definition: socket.cc:604
uint8_t m_ipTos
the socket IPv4 TOS
Definition: socket.h:1098
virtual int Bind()=0
Allocate a local IPv4 endpoint for this socket.
uint8_t m_priority
the socket priority
Definition: socket.h:1091
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:808
Callback< void, Ptr< Socket > > m_receivedData
data received callback
Definition: socket.h:1089
Callback< void, Ptr< Socket >, const Address & > m_newConnectionCreated
connection created callback
Definition: socket.h:1086
bool IsIpv6RecvTclass(void) const
Ask if the socket is currently passing information about IPv6 Traffic Class up the stack...
Definition: socket.cc:507
indicates whether the socket has a priority set.
Definition: socket.h:1307
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:797
Callback< void, Ptr< Socket > > m_connectionFailed
connection failed callback
Definition: socket.h:1082
virtual bool GetAllowBroadcast() const =0
Query whether broadcast datagram transmissions are allowed.
void NotifyDataSent(uint32_t size)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:285
virtual ~Socket(void)
Definition: socket.cc:65
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Definition: socket.cc:128
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:71
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:761
virtual enum Socket::SocketType GetSocketType(void) const =0
void SetHopLimit(uint8_t hopLimit)
Set the tag&#39;s Hop Limit.
Definition: socket.cc:665
uint8_t m_ipTos
the TOS carried by the tag
Definition: socket.h:1301
void NotifyConnectionSucceeded(void)
Notify through the callback (if set) that the connection has been established.
Definition: socket.cc:217
Callback< void, Ptr< Socket > > m_errorClose
connection closed due to errors callback
Definition: socket.h:1084
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:929
Callback< void, Ptr< Socket >, uint32_t > m_dataSent
data sent callback
Definition: socket.h:1087
void NotifyNormalClose(void)
Notify through the callback (if set) that the connection has been closed.
Definition: socket.cc:237
tag a set of bytes in a packet
Definition: tag.h:36
bool IsEnabled(void) const
Checks if the DF (Don&#39;t Fragment) flag is set.
Definition: socket.cc:732
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:755
uint8_t m_ipTtl
the socket IPv4 TTL
Definition: socket.h:1099
void SetIpv6Tclass(int ipTclass)
Manually set IPv6 Traffic Class field.
Definition: socket.cc:471
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:923
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:37
void NotifyNewConnectionCreated(Ptr< Socket > socket, const Address &from)
Notify through the callback (if set) that a new connection has been created.
Definition: socket.cc:275
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:371
virtual void Print(std::ostream &os) const
Definition: socket.cc:831
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1354
virtual void Ipv6LeaveGroup(void)
Leaves IPv6 multicast group this socket is joined to.
Definition: socket.cc:580
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:854
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:37
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:767
uint8_t m_ttl
the ttl carried by the tag
Definition: socket.h:1156
void SetSendCallback(Callback< void, Ptr< Socket >, uint32_t > sendCb)
Notify application when space in transmit buffer is added.
Definition: socket.cc:121
bool m_ipRecvTtl
socket forwards IPv4 TTL tag to L4
Definition: socket.h:1096
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:330
void SetDataSentCallback(Callback< void, Ptr< Socket >, uint32_t > dataSent)
Notify application when a packet has been sent from transport protocol (non-standard socket call) ...
Definition: socket.cc:114
uint8_t GetIpv6Tclass(void) const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:495
virtual void DoDispose(void)
Destructor implementation.
Definition: socket.cc:315
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:679
bool IsManualIpv6HopLimit(void) const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:383
void Disable(void)
Disables the DF (Don&#39;t Fragment) flag.
Definition: socket.cc:726
Describes an IPv6 address.
Definition: ipv6-address.h:49
read and write tag data
Definition: tag-buffer.h:51
Ptr< NetDevice > m_boundnetdevice
the device this socket is bound to (might be null).
Definition: socket.h:1076
void SetIpv6RecvHopLimit(bool ipv6RecvHopLimit)
Tells a socket to pass information about IPv6 Hop Limit up the stack.
Definition: socket.cc:551
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:642
Callback< void, Ptr< Socket > > m_normalClose
connection closed callback
Definition: socket.h:1083
void SetPriority(uint8_t priority)
Manually set the socket priority.
Definition: socket.cc:389
virtual uint8_t GetIpv6HopLimit(void) const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:545
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:705
indicates whether packets should be sent out with the DF (Don&#39;t Fragment) flag set.
Definition: socket.h:1211
bool IsIpv6RecvHopLimit(void) const
Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
Definition: socket.cc:557
SocketPriority
Enumeration of the possible socket priorities.
Definition: socket.h:118
void SetIpRecvTtl(bool ipv4RecvTtl)
Tells a socket to pass information about IP_TTL up the stack.
Definition: socket.cc:526
void Enable(void)
Enables the DF (Don&#39;t Fragment) flag.
Definition: socket.cc:720
void SetAcceptCallback(Callback< bool, Ptr< Socket >, const Address &> connectionRequest, Callback< void, Ptr< Socket >, const Address &> newConnectionCreated)
Accept connection requests from remote hosts.
Definition: socket.cc:104
uint8_t m_ipv6Tclass
the Tclass carried by the tag
Definition: socket.h:1394
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:648
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:814
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
Definition: socket.cc:364
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:826
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:689
virtual int GetPeerName(Address &address) const =0
Get the peer address of a connected socket.
virtual void Print(std::ostream &os) const
Definition: socket.cc:710
void SetConnectCallback(Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
Specify callbacks to allow the caller to determine if the connection succeeds of fails.
Definition: socket.cc:84
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:935
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:695
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
virtual void Print(std::ostream &os) const
Definition: socket.cc:946
Callback< void, Ptr< Socket >, uint32_t > m_sendCb
packet sent callback
Definition: socket.h:1088
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual void SetIpv6HopLimit(uint8_t ipHopLimit)
Manually set IPv6 Hop Limit.
Definition: socket.cc:538
virtual int Close(void)=0
Close a socket.
void SetPriority(uint8_t priority)
Set the tag&#39;s priority.
Definition: socket.cc:842
virtual uint32_t GetTxAvailable(void) const =0
Returns the number of bytes which can be sent in a single call to Send.
indicates whether the socket has IP_TOS set.
Definition: socket.h:1261
bool IsManualIpTtl(void) const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:377
uint8_t GetIpTos(void) const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:453
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
void SetIpTos(uint8_t ipTos)
Manually set IP Type of Service field.
Definition: socket.cc:437
a unique identifier for an interface.
Definition: type-id.h:58
uint8_t GetHopLimit(void) const
Get the tag&#39;s Hop Limit.
Definition: socket.cc:671
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:295
virtual void Print(std::ostream &os) const
Definition: socket.cc:773
virtual void Print(std::ostream &os) const
Definition: socket.cc:889
bool m_manualIpTtl
socket has IPv4 TTL set
Definition: socket.h:1094
void NotifyErrorClose(void)
Notify through the callback (if set) that the connection has been closed due to an error...
Definition: socket.cc:247
uint8_t GetPriority(void) const
Query the priority value of this socket.
Definition: socket.cc:396
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
Definition: socket.cc:513
uint8_t GetTtl(void) const
Get the tag&#39;s TTL.
Definition: socket.cc:611
bool m_ipv6RecvHopLimit
socket forwards IPv6 Hop Limit tag to L4
Definition: socket.h:1105
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
bool m_manualIpv6Tclass
socket has IPv6 Tclass set
Definition: socket.h:1102
bool m_ipv6RecvTclass
socket forwards IPv6 Tclass tag to L4
Definition: socket.h:1104