remove uint8_t * from the send path of the socket API
This commit is contained in:
1 parent
42b8ef0573
commit
ea46e29e24
7 files changed
+16
-51
No files matched your search
@@ -155,23 +155,13 @@ UdpSocket::Connect(const Address & address)
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
UdpSocket::Send (const uint8_t* buffer,
|
||||
uint32_t size)
|
||||
UdpSocket::Send (const Packet &p)
|
||||
{
|
||||
if (!m_connected)
|
||||
{
|
||||
m_errno = ERROR_NOTCONN;
|
||||
return -1;
|
||||
}
|
||||
Packet p;
|
||||
if (buffer == 0)
|
||||
{
|
||||
p = Packet (size);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = Packet (buffer, size);
|
||||
}
|
||||
return DoSendTo (p, m_defaultAddress, m_defaultPort);
|
||||
}
|
||||
int
|
||||
@@ -205,24 +195,13 @@ UdpSocket::DoSendTo (const Packet &p, Ipv4Address ipv4, uint16_t port)
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
UdpSocket::SendTo(const Address &address,
|
||||
const uint8_t *buffer,
|
||||
uint32_t size)
|
||||
UdpSocket::SendTo(const Address &address, const Packet &p)
|
||||
{
|
||||
if (m_connected)
|
||||
{
|
||||
m_errno = ERROR_ISCONN;
|
||||
return -1;
|
||||
}
|
||||
Packet p;
|
||||
if (buffer == 0)
|
||||
{
|
||||
p = Packet (size);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = Packet (buffer, size);
|
||||
}
|
||||
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
|
||||
Ipv4Address ipv4 = transport.GetIpv4 ();
|
||||
uint16_t port = transport.GetPort ();
|
||||
|
||||
@@ -51,8 +51,8 @@ public:
|
||||
virtual int ShutdownSend (void);
|
||||
virtual int ShutdownRecv (void);
|
||||
virtual int Connect(const Address &address);
|
||||
virtual int Send (const uint8_t* buffer, uint32_t size);
|
||||
virtual int SendTo(const Address &address,const uint8_t *buffer, uint32_t size);
|
||||
virtual int Send (const Packet &p);
|
||||
virtual int SendTo(const Address &address,const Packet &p);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in new issue
Block a user