aboutsummaryrefslogtreecommitdiff
path: root/dep/src/sockets/UdpSocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/src/sockets/UdpSocket.cpp')
-rw-r--r--dep/src/sockets/UdpSocket.cpp43
1 files changed, 0 insertions, 43 deletions
diff --git a/dep/src/sockets/UdpSocket.cpp b/dep/src/sockets/UdpSocket.cpp
index f4c3d2f9657..a3d393c00e2 100644
--- a/dep/src/sockets/UdpSocket.cpp
+++ b/dep/src/sockets/UdpSocket.cpp
@@ -47,12 +47,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// include this to see strange sights
//#include <linux/in6.h>
-
#ifdef SOCKETS_NAMESPACE
namespace SOCKETS_NAMESPACE {
#endif
-
UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : Socket(h)
, m_ibuf(new char[ibufsz])
, m_ibufsz(ibufsz)
@@ -69,14 +67,12 @@ UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : So
#endif
}
-
UdpSocket::~UdpSocket()
{
Close();
delete[] m_ibuf;
}
-
int UdpSocket::Bind(port_t &port, int range)
{
#ifdef ENABLE_IPV6
@@ -92,7 +88,6 @@ int UdpSocket::Bind(port_t &port, int range)
return Bind(ad, range);
}
-
int UdpSocket::Bind(const std::string& intf, port_t &port, int range)
{
#ifdef ENABLE_IPV6
@@ -118,14 +113,12 @@ int UdpSocket::Bind(const std::string& intf, port_t &port, int range)
return -1;
}
-
int UdpSocket::Bind(ipaddr_t a, port_t &port, int range)
{
Ipv4Address ad(a, port);
return Bind(ad, range);
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
int UdpSocket::Bind(in6_addr a, port_t &port, int range)
@@ -136,7 +129,6 @@ int UdpSocket::Bind(in6_addr a, port_t &port, int range)
#endif
#endif
-
int UdpSocket::Bind(SocketAddress& ad, int range)
{
if (GetSocket() == INVALID_SOCKET)
@@ -169,7 +161,6 @@ int UdpSocket::Bind(SocketAddress& ad, int range)
return -1;
}
-
/** if you wish to use Send, first Open a connection */
bool UdpSocket::Open(ipaddr_t l, port_t port)
{
@@ -177,7 +168,6 @@ bool UdpSocket::Open(ipaddr_t l, port_t port)
return Open(ad);
}
-
bool UdpSocket::Open(const std::string& host, port_t port)
{
#ifdef ENABLE_IPV6
@@ -201,7 +191,6 @@ bool UdpSocket::Open(const std::string& host, port_t port)
return false;
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
bool UdpSocket::Open(struct in6_addr& a, port_t port)
@@ -212,7 +201,6 @@ bool UdpSocket::Open(struct in6_addr& a, port_t port)
#endif
#endif
-
bool UdpSocket::Open(SocketAddress& ad)
{
if (GetSocket() == INVALID_SOCKET)
@@ -234,7 +222,6 @@ bool UdpSocket::Open(SocketAddress& ad)
return false;
}
-
void UdpSocket::CreateConnection()
{
#ifdef ENABLE_IPV6
@@ -267,7 +254,6 @@ void UdpSocket::CreateConnection()
}
}
-
/** send to specified address */
void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags)
{
@@ -291,7 +277,6 @@ void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int
}
}
-
/** send to specified address */
void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags)
{
@@ -299,7 +284,6 @@ void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int f
SendToBuf(ad, data, len, flags);
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags)
@@ -310,7 +294,6 @@ void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int f
#endif
#endif
-
void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flags)
{
if (GetSocket() == INVALID_SOCKET)
@@ -327,19 +310,16 @@ void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flag
}
}
-
void UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags)
{
SendToBuf(a, p, str.c_str(), (int)str.size(), flags);
}
-
void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags)
{
SendToBuf(a, p, str.c_str(), (int)str.size(), flags);
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags)
@@ -349,13 +329,11 @@ void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags)
#endif
#endif
-
void UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags)
{
SendToBuf(ad, str.c_str(), (int)str.size(), flags);
}
-
/** send to connected address */
void UdpSocket::SendBuf(const char *data, size_t len, int flags)
{
@@ -370,13 +348,11 @@ void UdpSocket::SendBuf(const char *data, size_t len, int flags)
}
}
-
void UdpSocket::Send(const std::string& str, int flags)
{
SendBuf(str.c_str(), (int)str.size(), flags);
}
-
#if defined(LINUX) || defined(MACOSX)
int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts)
{
@@ -442,7 +418,6 @@ int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen
}
#endif
-
void UdpSocket::OnRead()
{
#ifdef ENABLE_IPV6
@@ -555,7 +530,6 @@ void UdpSocket::OnRead()
}
}
-
void UdpSocket::SetBroadcast(bool b)
{
int one = 1;
@@ -581,7 +555,6 @@ void UdpSocket::SetBroadcast(bool b)
}
}
-
bool UdpSocket::IsBroadcast()
{
int is_broadcast = 0;
@@ -598,7 +571,6 @@ bool UdpSocket::IsBroadcast()
return is_broadcast != 0;
}
-
void UdpSocket::SetMulticastTTL(int ttl)
{
if (GetSocket() == INVALID_SOCKET)
@@ -611,7 +583,6 @@ void UdpSocket::SetMulticastTTL(int ttl)
}
}
-
int UdpSocket::GetMulticastTTL()
{
int ttl = 0;
@@ -628,7 +599,6 @@ int UdpSocket::GetMulticastTTL()
return ttl;
}
-
void UdpSocket::SetMulticastLoop(bool x)
{
if (GetSocket() == INVALID_SOCKET)
@@ -655,7 +625,6 @@ void UdpSocket::SetMulticastLoop(bool x)
}
}
-
bool UdpSocket::IsMulticastLoop()
{
if (GetSocket() == INVALID_SOCKET)
@@ -685,7 +654,6 @@ bool UdpSocket::IsMulticastLoop()
return is_loop ? true : false;
}
-
void UdpSocket::AddMulticastMembership(const std::string& group, const std::string& local_if, int if_index)
{
if (GetSocket() == INVALID_SOCKET)
@@ -726,7 +694,6 @@ void UdpSocket::AddMulticastMembership(const std::string& group, const std::stri
}
}
-
void UdpSocket::DropMulticastMembership(const std::string& group, const std::string& local_if, int if_index)
{
if (GetSocket() == INVALID_SOCKET)
@@ -767,7 +734,6 @@ void UdpSocket::DropMulticastMembership(const std::string& group, const std::str
}
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
void UdpSocket::SetMulticastHops(int hops)
@@ -787,7 +753,6 @@ void UdpSocket::SetMulticastHops(int hops)
}
}
-
int UdpSocket::GetMulticastHops()
{
if (GetSocket() == INVALID_SOCKET)
@@ -810,44 +775,36 @@ int UdpSocket::GetMulticastHops()
#endif // IPPROTO_IPV6
#endif
-
bool UdpSocket::IsBound()
{
return m_bind_ok;
}
-
void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len)
{
}
-
void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len, struct timeval *ts)
{
}
-
port_t UdpSocket::GetPort()
{
return m_port;
}
-
int UdpSocket::GetLastSizeWritten()
{
return m_last_size_written;
}
-
void UdpSocket::SetTimestamp(bool x)
{
m_b_read_ts = x;
}
-
#ifdef SOCKETS_NAMESPACE
}
#endif
-