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 
120  static Ptr<Socket> CreateSocket (Ptr<Node> node, TypeId tid);
128  virtual enum Socket::SocketErrno GetErrno (void) const = 0;
132  virtual enum Socket::SocketType GetSocketType (void) const = 0;
137  virtual Ptr<Node> GetNode (void) const = 0;
150  void SetConnectCallback (Callback<void, Ptr<Socket> > connectionSucceeded,
151  Callback<void, Ptr<Socket> > connectionFailed);
167  void SetCloseCallbacks (Callback<void, Ptr<Socket> > normalClose,
168  Callback<void, Ptr<Socket> > errorClose);
187  const Address &> connectionRequest,
188  Callback<void, Ptr<Socket>,
189  const Address&> newConnectionCreated);
198  uint32_t> dataSent);
213  void SetSendCallback (Callback<void, Ptr<Socket>, uint32_t> sendCb);
221  void SetRecvCallback (Callback<void, Ptr<Socket> >);
227  virtual int Bind (const Address &address) = 0;
228 
234  virtual int Bind () = 0;
235 
241  virtual int Bind6 () = 0;
242 
250  virtual int Close (void) = 0;
251 
258  virtual int ShutdownSend (void) = 0;
259 
266  virtual int ShutdownRecv (void) = 0;
267 
273  virtual int Connect (const Address &address) = 0;
274 
279  virtual int Listen (void) = 0;
280 
293  virtual uint32_t GetTxAvailable (void) const = 0;
294 
340  virtual int Send (Ptr<Packet> p, uint32_t flags) = 0;
341 
355  virtual int SendTo (Ptr<Packet> p, uint32_t flags,
356  const Address &toAddress) = 0;
357 
366  virtual uint32_t GetRxAvailable (void) const = 0;
367 
419  virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags) = 0;
420 
440  virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags,
441  Address &fromAddress) = 0;
442 
444  // The remainder of these public methods are overloaded methods //
445  // or variants of Send() and Recv(), and they are non-virtual //
447 
457  int Send (Ptr<Packet> p);
458 
473  int Send (const uint8_t* buf, uint32_t size, uint32_t flags);
474 
475 
492  int SendTo (const uint8_t* buf, uint32_t size, uint32_t flags,
493  const Address &address);
494 
504  Ptr<Packet> Recv (void);
505 
520  int Recv (uint8_t* buf, uint32_t size, uint32_t flags);
521 
535  Ptr<Packet> RecvFrom (Address &fromAddress);
536 
554  int RecvFrom (uint8_t* buf, uint32_t size, uint32_t flags,
555  Address &fromAddress);
561  virtual int GetSockName (Address &address) const = 0;
562 
585  virtual void BindToNetDevice (Ptr<NetDevice> netdevice);
586 
597 
598 
610  virtual bool SetAllowBroadcast (bool allowBroadcast) = 0;
611 
620  virtual bool GetAllowBroadcast () const = 0;
621 
634  void SetRecvPktInfo (bool flag);
635 
641  bool IsRecvPktInfo () const;
642 
654  void SetIpTos (uint8_t ipTos);
655 
664  uint8_t GetIpTos (void) const;
665 
677  void SetIpRecvTos (bool ipv4RecvTos);
678 
687  bool IsIpRecvTos (void) const;
688 
699  void SetIpv6Tclass (int ipTclass);
700 
709  uint8_t GetIpv6Tclass (void) const;
710 
722  void SetIpv6RecvTclass (bool ipv6RecvTclass);
723 
732  bool IsIpv6RecvTclass (void) const;
733 
742  virtual void SetIpTtl (uint8_t ipTtl);
743 
752  virtual uint8_t GetIpTtl (void) const;
753 
765  void SetIpRecvTtl (bool ipv4RecvTtl);
766 
775  bool IsIpRecvTtl (void) const;
776 
785  virtual void SetIpv6HopLimit (uint8_t ipHopLimit);
786 
795  virtual uint8_t GetIpv6HopLimit (void) const;
796 
808  void SetIpv6RecvHopLimit (bool ipv6RecvHopLimit);
809 
818  bool IsIpv6RecvHopLimit (void) const;
819 
820 protected:
825  void NotifyConnectionSucceeded (void);
826 
831  void NotifyConnectionFailed (void);
832 
837  void NotifyNormalClose (void);
838 
843  void NotifyErrorClose (void);
844 
856  bool NotifyConnectionRequest (const Address &from);
857 
862  void NotifyNewConnectionCreated (Ptr<Socket> socket, const Address &from);
863 
869  void NotifyDataSent (uint32_t size);
870 
876  void NotifySend (uint32_t spaceAvailable);
877 
881  void NotifyDataRecv (void);
882 
883  // inherited function, no doc necessary
884  virtual void DoDispose (void);
885 
891  bool IsManualIpTos (void) const;
892 
898  bool IsManualIpv6Tclass (void) const;
899 
905  bool IsManualIpTtl (void) const;
906 
912  bool IsManualIpv6HopLimit (void) const;
913 
916 
917 private:
927 
928  //IPv4 options
931  bool m_ipRecvTos;
932  bool m_ipRecvTtl;
933 
934  uint8_t m_ipTos;
935  uint8_t m_ipTtl;
936 
937  //IPv6 options
942 
943  uint8_t m_ipv6Tclass;
944  uint8_t m_ipv6HopLimit;
945 };
946 
951 class SocketAddressTag : public Tag
952 {
953 public:
954  SocketAddressTag ();
955 
961  void SetAddress (Address addr);
962 
968  Address GetAddress (void) const;
969 
974  static TypeId GetTypeId (void);
975 
976  // inherited function, no need to doc.
977  virtual TypeId GetInstanceTypeId (void) const;
978 
979  // inherited function, no need to doc.
980  virtual uint32_t GetSerializedSize (void) const;
981 
982  // inherited function, no need to doc.
983  virtual void Serialize (TagBuffer i) const;
984 
985  // inherited function, no need to doc.
986  virtual void Deserialize (TagBuffer i);
987 
988  // inherited function, no need to doc.
989  virtual void Print (std::ostream &os) const;
990 
991 private:
993 };
994 
999 class SocketIpTtlTag : public Tag
1000 {
1001 public:
1002  SocketIpTtlTag ();
1003 
1009  void SetTtl (uint8_t ttl);
1010 
1016  uint8_t GetTtl (void) const;
1017 
1022  static TypeId GetTypeId (void);
1023 
1024  // inherited function, no need to doc.
1025  virtual TypeId GetInstanceTypeId (void) const;
1026 
1027  // inherited function, no need to doc.
1028  virtual uint32_t GetSerializedSize (void) const;
1029 
1030  // inherited function, no need to doc.
1031  virtual void Serialize (TagBuffer i) const;
1032 
1033  // inherited function, no need to doc.
1034  virtual void Deserialize (TagBuffer i);
1035 
1036  // inherited function, no need to doc.
1037  virtual void Print (std::ostream &os) const;
1038 
1039 private:
1040  uint8_t m_ttl;
1041 };
1042 
1048 {
1049 public:
1051 
1057  void SetHopLimit (uint8_t hopLimit);
1058 
1064  uint8_t GetHopLimit (void) const;
1065 
1070  static TypeId GetTypeId (void);
1071 
1072  // inherited function, no need to doc.
1073  virtual TypeId GetInstanceTypeId (void) const;
1074 
1075  // inherited function, no need to doc.
1076  virtual uint32_t GetSerializedSize (void) const;
1077 
1078  // inherited function, no need to doc.
1079  virtual void Serialize (TagBuffer i) const;
1080 
1081  // inherited function, no need to doc.
1082  virtual void Deserialize (TagBuffer i);
1083 
1084  // inherited function, no need to doc.
1085  virtual void Print (std::ostream &os) const;
1086 
1087 private:
1088  uint8_t m_hopLimit;
1089 };
1090 
1096 {
1097 public:
1099 
1103  void Enable (void);
1104 
1108  void Disable (void);
1109 
1115  bool IsEnabled (void) const;
1116 
1121  static TypeId GetTypeId (void);
1122 
1123  // inherited function, no need to doc.
1124  virtual TypeId GetInstanceTypeId (void) const;
1125 
1126  // inherited function, no need to doc.
1127  virtual uint32_t GetSerializedSize (void) const;
1128 
1129  // inherited function, no need to doc.
1130  virtual void Serialize (TagBuffer i) const;
1131 
1132  // inherited function, no need to doc.
1133  virtual void Deserialize (TagBuffer i);
1134 
1135  // inherited function, no need to doc.
1136  virtual void Print (std::ostream &os) const;
1137 private:
1139 };
1140 
1145 class SocketIpTosTag : public Tag
1146 {
1147 public:
1148  SocketIpTosTag ();
1149 
1155  void SetTos (uint8_t tos);
1156 
1162  uint8_t GetTos (void) const;
1163 
1168  static TypeId GetTypeId (void);
1169 
1170  // inherited function, no need to doc.
1171  virtual TypeId GetInstanceTypeId (void) const;
1172 
1173  // inherited function, no need to doc.
1174  virtual uint32_t GetSerializedSize (void) const;
1175 
1176  // inherited function, no need to doc.
1177  virtual void Serialize (TagBuffer i) const;
1178 
1179  // inherited function, no need to doc.
1180  virtual void Deserialize (TagBuffer i);
1181 
1182  // inherited function, no need to doc.
1183  virtual void Print (std::ostream &os) const;
1184 private:
1185  uint8_t m_ipTos;
1186 };
1187 
1192 class SocketIpv6TclassTag : public Tag
1193 {
1194 public:
1196 
1202  void SetTclass (uint8_t tclass);
1203 
1209  uint8_t GetTclass (void) const;
1210 
1215  static TypeId GetTypeId (void);
1216 
1217  // inherited function, no need to doc.
1218  virtual TypeId GetInstanceTypeId (void) const;
1219 
1220  // inherited function, no need to doc.
1221  virtual uint32_t GetSerializedSize (void) const;
1222 
1223  // inherited function, no need to doc.
1224  virtual void Serialize (TagBuffer i) const;
1225 
1226  // inherited function, no need to doc.
1227  virtual void Deserialize (TagBuffer i);
1228 
1229  // inherited function, no need to doc.
1230  virtual void Print (std::ostream &os) const;
1231 private:
1232  uint8_t m_ipv6Tclass;
1233 };
1234 
1235 } // namespace ns3
1236 
1237 #endif /* NS3_SOCKET_H */
uint8_t m_ipv6HopLimit
the socket IPv6 Hop Limit
Definition: socket.h:944
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:600
void SetTclass(uint8_t tclass)
Set the tag's Tclass.
Definition: socket.cc:822
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:857
bool IsManualIpTtl(void) const
Checks if the socket has a specific IPv4 TTL set.
Definition: socket.cc:383
virtual void Print(std::ostream &os) const
Definition: socket.cc:868
virtual void Print(std::ostream &os) const
Definition: socket.cc:634
bool IsIpv6RecvHopLimit(void) const
Ask if the socket is currently passing information about IPv6 Hop Limit up the stack.
Definition: socket.cc:508
bool m_manualIpv6HopLimit
socket has IPv6 Hop Limit set
Definition: socket.h:939
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:566
virtual uint8_t GetIpTtl(void) const
Query the value of IP Time to Live field of this socket.
Definition: socket.cc:471
Callback template class.
Definition: callback.h:1164
void SetIpv6RecvTclass(bool ipv6RecvTclass)
Tells a socket to pass information about IPv6 Traffic Class up the stack.
Definition: socket.cc:452
uint8_t GetIpTos(void) const
Query the value of IP Type of Service of this socket.
Definition: socket.cc:404
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer...
Definition: socket.h:1047
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:1088
void NotifyDataRecv(void)
Notify through the callback (if set) that some data have been received.
Definition: socket.cc:305
uint8_t GetTos(void) const
Get the tag's TOS.
Definition: socket.cc:771
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:735
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:1138
Socket(void)
Definition: socket.cc:45
void SetAddress(Address addr)
Set the tag's address.
Definition: socket.cc:523
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:560
void NotifyConnectionFailed(void)
Notify through the callback (if set) that the connection has not been established due to an error...
Definition: socket.cc:227
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:721
Callback< bool, Ptr< Socket >, const Address & > m_connectionRequest
connection request callback
Definition: socket.h:922
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:863
virtual int GetSockName(Address &address) const =0
Get socket address.
virtual int ShutdownRecv(void)=0
void SetIpRecvTos(bool ipv4RecvTos)
Tells a socket to pass information about IP Type of Service up the stack.
Definition: socket.cc:410
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:549
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:834
bool IsManualIpTos(void) const
Checks if the socket has a specific IPv4 ToS set.
Definition: socket.cc:371
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:788
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
virtual uint8_t GetIpv6HopLimit(void) const
Query the value of IP Hop Limit field of this socket.
Definition: socket.cc:496
SocketType
Enumeration of the possible socket types.
Definition: socket.h:104
Callback< void, Ptr< Socket > > m_connectionSucceeded
connection succeeded callback
Definition: socket.h:918
void SetTos(uint8_t tos)
Set the tag's TOS.
Definition: socket.cc:765
bool m_recvPktInfo
if the socket should add packet info tags to the packet forwarded to L4.
Definition: socket.h:915
bool IsEnabled(void) const
Checks if the DF (Don't Fragment) flag is set.
Definition: socket.cc:712
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:741
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
Definition: socket.h:999
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
bool m_ipRecvTos
socket forwards IPv4 TOS tag to L4
Definition: socket.h:931
virtual void Print(std::ostream &os) const
Definition: socket.cc:572
bool IsRecvPktInfo() const
Get status indicating whether enable/disable packet information to socket.
Definition: socket.cc:364
uint8_t m_ipv6Tclass
the socket IPv6 Tclass
Definition: socket.h:943
virtual enum Socket::SocketErrno GetErrno(void) const =0
Get last error number.
a polymophic address class
Definition: address.h:90
virtual int Listen(void)=0
Listen for incoming connections.
bool IsIpRecvTos(void) const
Ask if the socket is currently passing information about IP Type of Service up the stack...
Definition: socket.cc:416
void SetRecvPktInfo(bool flag)
Enable/Disable receive packet information to socket.
Definition: socket.cc:358
Ptr< NetDevice > GetBoundNetDevice()
Returns socket'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
uint8_t GetTclass(void) const
Get the tag's Tclass.
Definition: socket.cc:828
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:584
uint8_t m_ipTos
the socket IPv4 TOS
Definition: socket.h:934
virtual int Bind()=0
Allocate a local IPv4 endpoint for this socket.
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:539
Callback< void, Ptr< Socket > > m_receivedData
data received callback
Definition: socket.h:926
Callback< void, Ptr< Socket >, const Address & > m_newConnectionCreated
connection created callback
Definition: socket.h:923
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:777
This class implements a tag that carries an address of a packet across the socket interface...
Definition: socket.h:951
Callback< void, Ptr< Socket > > m_connectionFailed
connection failed callback
Definition: socket.h:919
virtual bool GetAllowBroadcast() const =0
Query whether broadcast datagram transmissions are allowed.
bool IsManualIpv6Tclass(void) const
Checks if the socket has a specific IPv6 Tclass set.
Definition: socket.cc:377
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 Print(std::ostream &os) const
Definition: socket.cc:753
virtual enum Socket::SocketType GetSocketType(void) const =0
void SetHopLimit(uint8_t hopLimit)
Set the tag's Hop Limit.
Definition: socket.cc:645
uint8_t m_ipTos
the TOS carried by the tag
Definition: socket.h:1185
bool m_manualIpTos
socket has IPv4 TOS set
Definition: socket.h:929
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:921
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Callback< void, Ptr< Socket >, uint32_t > m_dataSent
data sent callback
Definition: socket.h:924
bool IsManualIpv6HopLimit(void) const
Checks if the socket has a specific IPv6 Hop Limit set.
Definition: socket.cc:389
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:616
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
uint8_t m_ipTtl
the socket IPv4 TTL
Definition: socket.h:935
void SetIpv6Tclass(int ipTclass)
Manually set IPv6 Traffic Class field.
Definition: socket.cc:422
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:680
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
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:675
indicates whether the socket has IPV6_TCLASS set.
Definition: socket.h:1192
uint8_t GetIpv6Tclass(void) const
Query the value of IPv6 Traffic Class field of this socket.
Definition: socket.cc:446
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:37
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:845
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:747
Address m_address
the address carried by the tag
Definition: socket.h:992
bool IsIpv6RecvTclass(void) const
Ask if the socket is currently passing information about IPv6 Traffic Class up the stack...
Definition: socket.cc:458
uint8_t m_ttl
the ttl carried by the tag
Definition: socket.h:1040
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:932
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
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
virtual void DoDispose(void)
Destructor implementation.
Definition: socket.cc:315
bool IsIpRecvTtl(void) const
Ask if the socket is currently passing information about IP_TTL up the stack.
Definition: socket.cc:483
static TypeId GetTypeId(void)
Get the type ID.
Definition: socket.cc:659
uint8_t GetHopLimit(void) const
Get the tag's Hop Limit.
Definition: socket.cc:651
void Disable(void)
Disables the DF (Don't Fragment) flag.
Definition: socket.cc:706
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:914
void SetIpv6RecvHopLimit(bool ipv6RecvHopLimit)
Tells a socket to pass information about IPv6 Hop Limit up the stack.
Definition: socket.cc:502
Callback< void, Ptr< Socket > > m_normalClose
connection closed callback
Definition: socket.h:920
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:851
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:610
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:800
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with.
Address GetAddress(void) const
Get the tag's address.
Definition: socket.cc:530
virtual void Print(std::ostream &os) const
Definition: socket.cc:811
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:685
indicates whether packets should be sent out with the DF (Don't Fragment) flag set.
Definition: socket.h:1095
virtual void Serialize(TagBuffer i) const
Definition: socket.cc:622
void SetIpRecvTtl(bool ipv4RecvTtl)
Tells a socket to pass information about IP_TTL up the stack.
Definition: socket.cc:477
void Enable(void)
Enables the DF (Don't Fragment) flag.
Definition: socket.cc:700
uint8_t m_ipv6Tclass
the Tclass carried by the tag
Definition: socket.h:1232
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:628
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
virtual void Deserialize(TagBuffer i)
Definition: socket.cc:806
virtual void Print(std::ostream &os) const
Definition: socket.cc:690
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
A base class which provides memory management and object aggregation.
Definition: object.h:87
tuple address
Definition: first.py:37
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.
uint8_t GetTtl(void) const
Get the tag's TTL.
Definition: socket.cc:591
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:554
Callback< void, Ptr< Socket >, uint32_t > m_sendCb
packet sent callback
Definition: socket.h:925
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:730
virtual void SetIpv6HopLimit(uint8_t ipHopLimit)
Manually set IPv6 Hop Limit.
Definition: socket.cc:489
virtual int Close(void)=0
Close a socket.
virtual uint32_t GetTxAvailable(void) const =0
Returns the number of bytes which can be sent in a single call to Send.
virtual uint32_t GetSerializedSize(void) const
Definition: socket.cc:794
indicates whether the socket has IP_TOS set.
Definition: socket.h:1145
void SetIpTos(uint8_t ipTos)
Manually set IP Type of Service field.
Definition: socket.cc:395
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: socket.cc:669
a unique identifier for an interface.
Definition: type-id.h:58
void NotifySend(uint32_t spaceAvailable)
Notify through the callback (if set) that some data have been sent.
Definition: socket.cc:295
bool m_manualIpTtl
socket has IPv4 TTL set
Definition: socket.h:930
void NotifyErrorClose(void)
Notify through the callback (if set) that the connection has been closed due to an error...
Definition: socket.cc:247
virtual void SetIpTtl(uint8_t ipTtl)
Manually set IP Time to Live field.
Definition: socket.cc:464
bool m_ipv6RecvHopLimit
socket forwards IPv6 Hop Limit tag to L4
Definition: socket.h:941
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:938
bool m_ipv6RecvTclass
socket forwards IPv6 Tclass tag to L4
Definition: socket.h:940