1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

SDRdaemon sink: removed throw lists as they are dprecated in c++11 (gcc7 warning)

This commit is contained in:
f4exb 2017-12-31 02:46:03 +01:00
parent 3f96ce4187
commit c23894e567
2 changed files with 42 additions and 44 deletions

View File

@ -48,7 +48,7 @@ CSocket::~CSocket()
m_sockDesc = -1;
}
CSocket::CSocket( SocketType type, NetworkLayerProtocol protocol ) throw(CSocketException):m_sockDesc(-1)
CSocket::CSocket( SocketType type, NetworkLayerProtocol protocol ):m_sockDesc(-1)
{
m_sockDesc = socket(protocol, type, 0);
if (m_sockDesc < 0)
@ -72,7 +72,7 @@ void CSocket::operator=(const CSocket &sock)
m_sockDesc = sock.m_sockDesc;
}
std::string CSocket::GetLocalAddress() throw(CSocketException)
std::string CSocket::GetLocalAddress()
{
sockaddr_in addr;
unsigned int addr_len = sizeof(addr);
@ -83,7 +83,7 @@ std::string CSocket::GetLocalAddress() throw(CSocketException)
return inet_ntoa(addr.sin_addr);
}
unsigned short CSocket::GetLocalPort() throw(CSocketException)
unsigned short CSocket::GetLocalPort()
{
sockaddr_in addr;
unsigned int addr_len = sizeof(addr);
@ -94,7 +94,7 @@ unsigned short CSocket::GetLocalPort() throw(CSocketException)
return ntohs(addr.sin_port);
}
void CSocket::BindLocalPort( unsigned short localPort ) throw(CSocketException)
void CSocket::BindLocalPort( unsigned short localPort )
{
// Bind the socket to its port
sockaddr_in localAddr;
@ -109,7 +109,6 @@ void CSocket::BindLocalPort( unsigned short localPort ) throw(CSocketException)
}
void CSocket::BindLocalAddressAndPort( const string &localAddress, unsigned short localPort /*= 0*/ )
throw(CSocketException)
{
// Get the address of the requested host
sockaddr_in localAddr;
@ -147,7 +146,7 @@ unsigned long int CSocket::GetReadBufferSize()
return nSize;
}
void CSocket::SetReadBufferSize( unsigned int nSize ) throw(CSocketException)
void CSocket::SetReadBufferSize( unsigned int nSize )
{
if (setsockopt(m_sockDesc, SOL_SOCKET, SO_RCVBUF, &nSize, sizeof(nSize)) == -1)
{
@ -155,7 +154,7 @@ void CSocket::SetReadBufferSize( unsigned int nSize ) throw(CSocketException)
}
}
void CSocket::SetNonBlocking( bool bBlocking ) throw(CSocketException)
void CSocket::SetNonBlocking( bool bBlocking )
{
int opts;
@ -174,7 +173,7 @@ void CSocket::SetNonBlocking( bool bBlocking ) throw(CSocketException)
fcntl ( m_sockDesc, F_SETFL,opts );
}
void CSocket::ConnectToHost( const string &foreignAddress, unsigned short foreignPort ) throw(CSocketException)
void CSocket::ConnectToHost( const string &foreignAddress, unsigned short foreignPort )
{
//cout<<"\nstart Connect to host";
// Get the address of the requested host
@ -191,14 +190,14 @@ void CSocket::ConnectToHost( const string &foreignAddress, unsigned short foreig
}
void CSocket::Send( const void *buffer, int bufferLen ) throw(CSocketException)
void CSocket::Send( const void *buffer, int bufferLen )
{
if (::send(m_sockDesc, (void *) buffer, bufferLen, 0) < 0) {
throw CSocketException("Send failed (send())", true);
}
}
int CSocket::Recv( void *buffer, int bufferLen ) throw(CSocketException)
int CSocket::Recv( void *buffer, int bufferLen )
{
int nBytes;
if ((nBytes = ::recv(m_sockDesc, (void *) buffer, bufferLen, 0)) < 0) {
@ -209,7 +208,7 @@ int CSocket::Recv( void *buffer, int bufferLen ) throw(CSocketException)
return nBytes;
}
std::string CSocket::GetPeerAddress() throw(CSocketException)
std::string CSocket::GetPeerAddress()
{
sockaddr_in addr;
unsigned int addr_len = sizeof(addr);
@ -220,7 +219,7 @@ std::string CSocket::GetPeerAddress() throw(CSocketException)
return inet_ntoa(addr.sin_addr);
}
unsigned short CSocket::GetPeerPort() throw(CSocketException)
unsigned short CSocket::GetPeerPort()
{
sockaddr_in addr;
unsigned int addr_len = sizeof(addr);
@ -296,7 +295,7 @@ int CSocket::OnDataRead(unsigned long timeToWait)
return nRet;
}
void CSocket::SetBindToDevice( const string& sInterface ) throw(CSocketException)
void CSocket::SetBindToDevice( const string& sInterface )
{
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
@ -310,26 +309,26 @@ void CSocket::SetBindToDevice( const string& sInterface ) throw(CSocketException
}*/
}
UDPSocket::UDPSocket() throw(CSocketException):CSocket(UdpSocket,IPv4Protocol)
UDPSocket::UDPSocket():CSocket(UdpSocket,IPv4Protocol)
{
SetBroadcast();
}
UDPSocket::UDPSocket( unsigned short localPort ) throw(CSocketException):
UDPSocket::UDPSocket( unsigned short localPort ):
CSocket(UdpSocket,IPv4Protocol)
{
BindLocalPort(localPort);
SetBroadcast();
}
UDPSocket::UDPSocket( const string &localAddress, unsigned short localPort ) throw(CSocketException):
UDPSocket::UDPSocket( const string &localAddress, unsigned short localPort ):
CSocket(UdpSocket,IPv4Protocol)
{
BindLocalAddressAndPort(localAddress, localPort);
SetBroadcast();
}
void UDPSocket::DisconnectFromHost() throw(CSocketException)
void UDPSocket::DisconnectFromHost()
{
sockaddr_in nullAddr;
memset(&nullAddr, 0, sizeof(nullAddr));
@ -345,7 +344,7 @@ void UDPSocket::DisconnectFromHost() throw(CSocketException)
}
void UDPSocket::SendDataGram( const void *buffer, int bufferLen, const string &foreignAddress,
unsigned short foreignPort ) throw(CSocketException)
unsigned short foreignPort )
{
//cout<<"Befor Fill addr";
sockaddr_in destAddr;
@ -360,7 +359,6 @@ void UDPSocket::SendDataGram( const void *buffer, int bufferLen, const string &f
}
int UDPSocket::RecvDataGram( void *buffer, int bufferLen, string &sourceAddress, unsigned short &sourcePort )
throw(CSocketException)
{
sockaddr_in clntAddr;
socklen_t addrLen = sizeof(clntAddr);
@ -377,7 +375,7 @@ int UDPSocket::RecvDataGram( void *buffer, int bufferLen, string &sourceAddress,
return nBytes;
}
void UDPSocket::SetMulticastTTL( unsigned char multicastTTL ) throw(CSocketException)
void UDPSocket::SetMulticastTTL( unsigned char multicastTTL )
{
if (setsockopt(m_sockDesc, IPPROTO_IP, IP_MULTICAST_TTL, (void *) &multicastTTL, sizeof(multicastTTL)) < 0)
{
@ -385,7 +383,7 @@ void UDPSocket::SetMulticastTTL( unsigned char multicastTTL ) throw(CSocketExcep
}
}
void UDPSocket::JoinGroup( const string &multicastGroup ) throw(CSocketException)
void UDPSocket::JoinGroup( const string &multicastGroup )
{
struct ip_mreq multicastRequest;
@ -400,7 +398,7 @@ void UDPSocket::JoinGroup( const string &multicastGroup ) throw(CSocketException
}
void UDPSocket::LeaveGroup( const string &multicastGroup ) throw(CSocketException)
void UDPSocket::LeaveGroup( const string &multicastGroup )
{
struct ip_mreq multicastRequest;

View File

@ -114,7 +114,7 @@ public:
* @exception CSocketException thrown if fetch fails
*/
string GetLocalAddress() throw(CSocketException);
string GetLocalAddress();
/**
* Get the local port
@ -122,7 +122,7 @@ public:
* @exception CSocketException thrown if fetch fails
*/
unsigned short GetLocalPort() throw(CSocketException);
unsigned short GetLocalPort();
/**
@ -132,7 +132,7 @@ public:
* @exception CSocketException thrown if setting local port fails
*/
void BindLocalPort(unsigned short localPort) throw(CSocketException);
void BindLocalPort(unsigned short localPort);
/**
* Set the local port to the specified port and the local address
@ -143,7 +143,7 @@ public:
* @exception CSocketException thrown if setting local port or address fails
*/
void BindLocalAddressAndPort(const string &localAddress, unsigned short localPort = 0) throw(CSocketException);
void BindLocalAddressAndPort(const string &localAddress, unsigned short localPort = 0);
/**
* Returns the size of the internal read buffer. This limits the amount of data that the client
@ -155,13 +155,13 @@ public:
* Sets the read buffer size of the socket.
* @param Size of the buffer.
*/
void SetReadBufferSize(unsigned int nSize) throw(CSocketException);
void SetReadBufferSize(unsigned int nSize);
/**
* Sets the socket to Blocking/Non blocking state.
* @param Bool flag for Non blocking status.
*/
void SetNonBlocking(bool bBlocking) throw(CSocketException);
void SetNonBlocking(bool bBlocking);
/**
* Establish a socket connection with the given foreign
@ -170,7 +170,7 @@ public:
* @param foreignPort foreign port
* @exception SocketException thrown if unable to establish connection
*/
void ConnectToHost(const string &foreignAddress, unsigned short foreignPort) throw(CSocketException);
void ConnectToHost(const string &foreignAddress, unsigned short foreignPort);
/**
* Write the given buffer to this socket. Call connect() before
@ -179,7 +179,7 @@ public:
* @param bufferLen number of bytes from buffer to be written
* @exception SocketException thrown if unable to send data
*/
void Send(const void *buffer, int bufferLen) throw(CSocketException);
void Send(const void *buffer, int bufferLen);
/**
* Read into the given buffer up to bufferLen bytes data from this
@ -189,21 +189,21 @@ public:
* @return number of bytes read, 0 for EOF, and -1 for error
* @exception SocketException thrown if unable to receive data
*/
int Recv(void *buffer, int bufferLen) throw(CSocketException);
int Recv(void *buffer, int bufferLen);
/**
* Get the foreign address. Call connect() before calling recv()
* @return foreign address
* @exception SocketException thrown if unable to fetch foreign address
*/
string GetPeerAddress() throw(CSocketException);
string GetPeerAddress();
/**
* Get the foreign port. Call connect() before calling recv()
* @return foreign port
* @exception SocketException thrown if unable to fetch foreign port
*/
unsigned short GetPeerPort() throw(CSocketException);
unsigned short GetPeerPort();
/**
* Writing sStr to socket
@ -225,7 +225,7 @@ public:
* To Bind socket to a symbolic device name like eth0
* @param sInterface NIC device name
*/
void SetBindToDevice(const string& sInterface) throw(CSocketException);
void SetBindToDevice(const string& sInterface);
protected:
/**
@ -233,7 +233,7 @@ protected:
**/
int m_sockDesc;
CSocket(SocketType type, NetworkLayerProtocol protocol) throw(CSocketException);
CSocket(SocketType type, NetworkLayerProtocol protocol);
CSocket(int sockDesc);
static void FillAddr( const string & localAddress, unsigned short localPort, sockaddr_in& localAddr );
@ -254,13 +254,13 @@ public:
* Construct a UDP socket
* @exception SocketException thrown if unable to create UDP socket
*/
UDPSocket() throw(CSocketException);
UDPSocket();
/**
* Construct a UDP socket with the given local port
* @param localPort local port
* @exception SocketException thrown if unable to create UDP socket
*/
UDPSocket(unsigned short localPort) throw(CSocketException);
UDPSocket(unsigned short localPort);
/**
* Construct a UDP socket with the given local port and address
@ -268,7 +268,7 @@ public:
* @param localPort local port
* @exception SocketException thrown if unable to create UDP socket
*/
UDPSocket(const string &localAddress, unsigned short localPort) throw(CSocketException);
UDPSocket(const string &localAddress, unsigned short localPort);
/**
* Unset foreign address and port
@ -281,7 +281,7 @@ public:
* @return true if disassociation is successful
* @exception SocketException thrown if unable to disconnect UDP socket
*/
void DisconnectFromHost() throw(CSocketException);
void DisconnectFromHost();
/**
* Send the given buffer as a UDP datagram to the
@ -294,7 +294,7 @@ public:
* @exception SocketException thrown if unable to send datagram
*/
void SendDataGram(const void *buffer, int bufferLen, const string &foreignAddress,
unsigned short foreignPort) throw(CSocketException);
unsigned short foreignPort);
/**
* Read read up to bufferLen bytes data from this socket. The given buffer
@ -307,28 +307,28 @@ public:
* @exception SocketException thrown if unable to receive datagram
*/
int RecvDataGram(void *buffer, int bufferLen, string &sourceAddress,
unsigned short &sourcePort) throw(CSocketException);
unsigned short &sourcePort);
/**
* Set the multicast TTL
* @param multicastTTL multicast TTL
* @exception SocketException thrown if unable to set TTL
*/
void SetMulticastTTL(unsigned char multicastTTL) throw(CSocketException);
void SetMulticastTTL(unsigned char multicastTTL);
/**
* Join the specified multicast group
* @param multicastGroup multicast group address to join
* @exception SocketException thrown if unable to join group
*/
void JoinGroup(const string &multicastGroup) throw(CSocketException);
void JoinGroup(const string &multicastGroup);
/**
* Leave the specified multicast group
* @param multicastGroup multicast group address to leave
* @exception SocketException thrown if unable to leave group
*/
void LeaveGroup(const string &multicastGroup) throw(CSocketException);
void LeaveGroup(const string &multicastGroup);
private:
void SetBroadcast();