Rename the SocketErrno enumeration values, from ESOMETHING to ERROR_SOMETHING, to avoid conflict with errno #define's; fixes compilation in mingw32.

Gustavo J. A. M. Carneiro 2007-05-17 15:50:20 +01:00
parent 6e7e5822fb
commit 4c68aff164
2 changed files with 12 additions and 12 deletions

View File

@ -30,7 +30,7 @@ UdpSocket::UdpSocket (Ptr<INode> node, Ptr<Udp> udp)
: m_endPoint (0), : m_endPoint (0),
m_node (node), m_node (node),
m_udp (udp), m_udp (udp),
m_errno (ENOTERROR), m_errno (ERROR_NOTERROR),
m_shutdownSend (false), m_shutdownSend (false),
m_shutdownRecv (false), m_shutdownRecv (false),
m_connected (false) m_connected (false)
@ -154,7 +154,7 @@ UdpSocket::DoAccept(ns3::Callback<bool, Ptr<Socket>, const Ipv4Address&, uint16_
ns3::Callback<void, Ptr<Socket> > closeRequested) ns3::Callback<void, Ptr<Socket> > closeRequested)
{ {
// calling accept on a udp socket is a programming error. // calling accept on a udp socket is a programming error.
m_errno = EOPNOTSUPP; m_errno = ERROR_OPNOTSUPP;
return -1; return -1;
} }
int int
@ -164,7 +164,7 @@ UdpSocket::DoSend (const uint8_t* buffer,
{ {
if (!m_connected) if (!m_connected)
{ {
m_errno = ENOTCONN; m_errno = ERROR_NOTCONN;
return -1; return -1;
} }
Packet p; Packet p;
@ -193,7 +193,7 @@ UdpSocket::DoSendPacketTo (const Packet &p, Ipv4Address daddr, uint16_t dport,
} }
if (m_shutdownSend) if (m_shutdownSend)
{ {
m_errno = ESHUTDOWN; m_errno = ERROR_SHUTDOWN;
return -1; return -1;
} }
m_udp->Send (p, m_endPoint->GetLocalAddress (), daddr, m_udp->Send (p, m_endPoint->GetLocalAddress (), daddr,
@ -213,7 +213,7 @@ UdpSocket::DoSendTo(const Ipv4Address &address,
{ {
if (m_connected) if (m_connected)
{ {
m_errno = EISCONN; m_errno = ERROR_ISCONN;
return -1; return -1;
} }
Packet p; Packet p;

View File

@ -46,13 +46,13 @@ public:
virtual ~Socket(); virtual ~Socket();
enum SocketErrno { enum SocketErrno {
ENOTERROR, ERROR_NOTERROR,
EISCONN, ERROR_ISCONN,
ENOTCONN, ERROR_NOTCONN,
EMSGSIZE, ERROR_MSGSIZE,
EAGAIN, ERROR_AGAIN,
ESHUTDOWN, ERROR_SHUTDOWN,
EOPNOTSUPP, ERROR_OPNOTSUPP,
SOCKET_ERRNO_LAST SOCKET_ERRNO_LAST
}; };