27 #ifndef _REC_RPC_CLIENTINFO_H_ 28 #define _REC_RPC_CLIENTINFO_H_ 31 #include <QHostAddress> 33 #include <QDataStream> 62 ClientInfo(
const QHostAddress& address_,
const int port_,
const QString& name_ = QString::null )
157 str +=
" " +
address.toString() +
":" + QString::number(
port );
187 if ( ( s >> info.
address ).status() != QDataStream::Ok )
189 if ( ( s >> info.
port ).status() != QDataStream::Ok )
198 dbg.nospace() <<
"(" << p.
address.toString() <<
", " << p.
port <<
", " << p.
name <<
", " << ( p.
isLocal() ?
"local" :
"remote" ) <<
")";
209 if ( i1.
address.protocol() == QAbstractSocket::IPv4Protocol )
211 quint32 a1 = i1.
address.toIPv4Address();
212 quint32 a2 = i2.
address.toIPv4Address();
216 else if ( i1.
address.protocol() == QAbstractSocket::IPv6Protocol )
218 QIPv6Address a1 = i1.
address.toIPv6Address();
219 QIPv6Address a2 = i2.
address.toIPv6Address();
220 for(
unsigned int i = 0; i < 16; ++i )
222 if ( a1[i] != a2[i] )
223 return a1[i] < a2[i];
249 #endif //_REC_RPC_CLIENTINFO_H_ QString name
Name (can be empty)
ClientInfo & operator=(const ClientInfo &other)
Assignment operator.
bool isNull() const
Null check.
ClientInfo(const QHostAddress &address_, const int port_, const QString &name_=QString::null)
Constructor with initializations.
void clear()
Clear all data.
int port
Client's TCP port.
bool operator==(const ClientInfo &other) const
Equality test.
QSet< ClientInfo > ClientInfoSet
Set of ClientInfos typedef.
QHostAddress address
Client's network address.
ClientInfo()
Default constructor.
QMap< QString, ClientInfo > ClientInfoMap
Map of ClientInfos typedef.
QDataStream & operator<<(QDataStream &out, const Serializable &data)
Serialize the data and write it into a data stream.
QDataStream & operator>>(QDataStream &in, Serializable &data)
Read data from a data stream and deserialize it.
bool isLocal() const
Check if client it connected via local socket.
ClientInfo(const ClientInfo &other)
Copy constructor.
bool operator!=(const ClientInfo &other) const
Unequality test.