Implement Socket::GetSocketType
This commit is contained in:
1 parent
57023e40d8
commit
d1bba894fe
14 files changed
+63
No files matched your search
@@ -82,6 +82,11 @@ InitialPositionIs Waypoint. See RELEASE_NOTES for details. </p> </li>
|
||||
in Mbps (6, 9, 12, 18, 24, 36, 48, 54), are available for 802.11g.
|
||||
More details are in the RELEASE_NOTES for details. </p> </li>
|
||||
|
||||
<li><b>Socket::GetSocketType ()</b>
|
||||
<p>This is analogous to getsockopt(SO_TYPE). ipv4-raw-socket, ipv6-raw-socket,
|
||||
and packet-socket return SOCK_RAW. tcp-socket and nsc-tcp-socket return
|
||||
SOCK_STREAM. udp-socket returns SOCK_DGRAM.</p></li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Changes to existing API:</h2>
|
||||
|
||||
@@ -80,6 +80,13 @@ Ipv4RawSocketImpl::GetErrno (void) const
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_err;
|
||||
}
|
||||
|
||||
enum Socket::SocketType
|
||||
Ipv4RawSocketImpl::GetSocketType (void) const
|
||||
{
|
||||
return SOCK_RAW;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
Ipv4RawSocketImpl::GetNode (void) const
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
void SetNode (Ptr<Node> node);
|
||||
|
||||
virtual enum Socket::SocketErrno GetErrno (void) const;
|
||||
virtual enum Socket::SocketType GetSocketType (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (const Address &address);
|
||||
virtual int Bind ();
|
||||
|
||||
@@ -97,6 +97,11 @@ enum Socket::SocketErrno Ipv6RawSocketImpl::GetErrno () const
|
||||
return m_err;
|
||||
}
|
||||
|
||||
enum Socket::SocketType Ipv6RawSocketImpl::GetSocketType () const
|
||||
{
|
||||
return SOCK_RAW;
|
||||
}
|
||||
|
||||
int Ipv6RawSocketImpl::Bind (const Address& address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
|
||||
@@ -68,6 +68,12 @@ public:
|
||||
*/
|
||||
virtual enum Socket::SocketErrno GetErrno () const;
|
||||
|
||||
/**
|
||||
* \brief Get socket type (SOCK_RAW)
|
||||
* \return socket type
|
||||
*/
|
||||
virtual enum Socket::SocketType GetSocketType () const;
|
||||
|
||||
/**
|
||||
* \brief Get node.
|
||||
* \return node associated with this raw socket.
|
||||
|
||||
@@ -171,6 +171,12 @@ NscTcpSocketImpl::GetErrno (void) const
|
||||
return m_errno;
|
||||
}
|
||||
|
||||
enum Socket::SocketType
|
||||
NscTcpSocketImpl::GetSocketType (void) const
|
||||
{
|
||||
return SOCK_STREAM;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
NscTcpSocketImpl::GetNode (void) const
|
||||
{
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
void SetTcp (Ptr<NscTcpL4Protocol> tcp);
|
||||
|
||||
virtual enum SocketErrno GetErrno (void) const;
|
||||
virtual enum SocketType GetSocketType (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (void);
|
||||
virtual int Bind (const Address &address);
|
||||
|
||||
@@ -230,6 +230,12 @@ TcpSocketImpl::GetErrno (void) const
|
||||
return m_errno;
|
||||
}
|
||||
|
||||
enum Socket::SocketType
|
||||
TcpSocketImpl::GetSocketType (void) const
|
||||
{
|
||||
return SOCK_STREAM;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
TcpSocketImpl::GetNode (void) const
|
||||
{
|
||||
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
void SetRtt (Ptr<RttEstimator> rtt);
|
||||
|
||||
virtual enum SocketErrno GetErrno (void) const;
|
||||
virtual enum SocketType GetSocketType (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (void);
|
||||
virtual int Bind (const Address &address);
|
||||
|
||||
@@ -116,6 +116,12 @@ UdpSocketImpl::GetErrno (void) const
|
||||
return m_errno;
|
||||
}
|
||||
|
||||
enum Socket::SocketType
|
||||
UdpSocketImpl::GetSocketType (void) const
|
||||
{
|
||||
return SOCK_DGRAM;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
UdpSocketImpl::GetNode (void) const
|
||||
{
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
void SetUdp (Ptr<UdpL4Protocol> udp);
|
||||
|
||||
virtual enum SocketErrno GetErrno (void) const;
|
||||
virtual enum SocketType GetSocketType (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (void);
|
||||
virtual int Bind (const Address &address);
|
||||
|
||||
@@ -89,6 +89,12 @@ PacketSocket::GetErrno (void) const
|
||||
return m_errno;
|
||||
}
|
||||
|
||||
enum Socket::SocketType
|
||||
PacketSocket::GetSocketType (void) const
|
||||
{
|
||||
return SOCK_RAW;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
PacketSocket::GetNode (void) const
|
||||
{
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
void SetNode (Ptr<Node> node);
|
||||
|
||||
virtual enum SocketErrno GetErrno (void) const;
|
||||
virtual enum SocketType GetSocketType (void) const;
|
||||
virtual Ptr<Node> GetNode (void) const;
|
||||
virtual int Bind (void);
|
||||
virtual int Bind (const Address & address);
|
||||
|
||||
@@ -85,6 +85,13 @@ public:
|
||||
SOCKET_ERRNO_LAST
|
||||
};
|
||||
|
||||
enum SocketType {
|
||||
SOCK_STREAM,
|
||||
SOCK_SEQPACKET,
|
||||
SOCK_DGRAM,
|
||||
SOCK_RAW
|
||||
};
|
||||
|
||||
/**
|
||||
* This method wraps the creation of sockets that is performed
|
||||
* by a socket factory on a given node based on a TypeId.
|
||||
@@ -101,6 +108,10 @@ public:
|
||||
* when the socket is created.
|
||||
*/
|
||||
virtual enum Socket::SocketErrno GetErrno (void) const = 0;
|
||||
/**
|
||||
* \return the socket type, analogous to getsockopt (SO_TYPE)
|
||||
*/
|
||||
virtual enum Socket::SocketType GetSocketType (void) const = 0;
|
||||
/**
|
||||
* \returns the node this socket is associated with.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user