blackberry release
git-svn-id: svn://db.shs.com.ru/pip@134 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -53,9 +53,12 @@
|
|||||||
//! Macro is defined when host is any Windows
|
//! Macro is defined when host is any Windows
|
||||||
# define WINDOWS
|
# define WINDOWS
|
||||||
|
|
||||||
//! Macro is defined when host is QNX
|
//! Macro is defined when host is QNX or Blackberry
|
||||||
# define QNX
|
# define QNX
|
||||||
|
|
||||||
|
//! Macro is defined when host is Blackberry
|
||||||
|
# define BLACKBERRY
|
||||||
|
|
||||||
//! Macro is defined when host is FreeBSD
|
//! Macro is defined when host is FreeBSD
|
||||||
# define FREE_BSD
|
# define FREE_BSD
|
||||||
|
|
||||||
|
|||||||
@@ -341,11 +341,13 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
|||||||
if (!params[Broadcast])
|
if (!params[Broadcast])
|
||||||
;//piCoutObj << "Warning: \"Broadcast\" parameter not set, \"joinMulticastGroup(\"" << group << "\")\" may be useless!";
|
;//piCoutObj << "Warning: \"Broadcast\" parameter not set, \"joinMulticastGroup(\"" << group << "\")\" may be useless!";
|
||||||
parseAddress(path(), &ip_, &port_);
|
parseAddress(path(), &ip_, &port_);
|
||||||
|
struct
|
||||||
#ifndef QNX
|
#ifndef QNX
|
||||||
struct ip_mreqn mreq;
|
ip_mreqn
|
||||||
#else
|
#else
|
||||||
struct ip_mreq mreq;
|
ip_mreq
|
||||||
#endif
|
#endif
|
||||||
|
mreq;
|
||||||
memset(&mreq, 0, sizeof(mreq));
|
memset(&mreq, 0, sizeof(mreq));
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
//mreq.imr_address.s_addr = INADDR_ANY;
|
//mreq.imr_address.s_addr = INADDR_ANY;
|
||||||
@@ -353,13 +355,16 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
|
|||||||
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
||||||
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
if (ci != 0) mreq.imr_ifindex = ci->index;*/
|
||||||
#endif
|
#endif
|
||||||
|
in_addr_t addr;
|
||||||
|
if (params[PIEthernet::Broadcast]) addr = INADDR_ANY;
|
||||||
|
else addr = inet_addr(ip_.dataAscii());
|
||||||
|
mreq.
|
||||||
#ifndef QNX
|
#ifndef QNX
|
||||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
imr_address
|
||||||
else mreq.imr_address.s_addr = inet_addr(ip_.dataAscii());
|
|
||||||
#else
|
#else
|
||||||
if (params[PIEthernet::Broadcast]) mreq.imr_interface.s_addr = INADDR_ANY;
|
imr_interface
|
||||||
else mreq.imr_interface.s_addr = inet_addr(ip_.dataAscii());
|
|
||||||
#endif
|
#endif
|
||||||
|
.s_addr = addr;
|
||||||
/*#ifndef WINDOWS
|
/*#ifndef WINDOWS
|
||||||
PIEthernet::InterfaceList il = interfaces();
|
PIEthernet::InterfaceList il = interfaces();
|
||||||
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
const PIEthernet::Interface * ci = il.getByAddress(ip_);
|
||||||
@@ -402,19 +407,24 @@ bool PIEthernet::leaveMulticastGroup(const PIString & group) {
|
|||||||
PIFlags<Parameters> params = parameters();
|
PIFlags<Parameters> params = parameters();
|
||||||
/// TODO windows
|
/// TODO windows
|
||||||
parseAddress(path(), &ip_, &port_);
|
parseAddress(path(), &ip_, &port_);
|
||||||
|
struct
|
||||||
#ifndef QNX
|
#ifndef QNX
|
||||||
struct ip_mreqn mreq;
|
ip_mreqn
|
||||||
#else
|
#else
|
||||||
struct ip_mreq mreq;
|
ip_mreq
|
||||||
#endif
|
#endif
|
||||||
|
mreq;
|
||||||
memset(&mreq, 0, sizeof(mreq));
|
memset(&mreq, 0, sizeof(mreq));
|
||||||
|
in_addr_t addr;
|
||||||
|
if (params[PIEthernet::Broadcast]) addr = INADDR_ANY;
|
||||||
|
else addr = inet_addr(ip_.dataAscii());
|
||||||
|
mreq.
|
||||||
#ifndef QNX
|
#ifndef QNX
|
||||||
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
|
imr_address
|
||||||
else mreq.imr_address.s_addr = inet_addr(ip_.dataAscii());
|
|
||||||
#else
|
#else
|
||||||
if (params[PIEthernet::Broadcast]) mreq.imr_interface.s_addr = INADDR_ANY;
|
imr_interface
|
||||||
else mreq.imr_interface.s_addr = inet_addr(ip_.dataAscii());
|
|
||||||
#endif
|
#endif
|
||||||
|
.s_addr = addr;
|
||||||
mreq.imr_multiaddr.s_addr = inet_addr(group.dataAscii());
|
mreq.imr_multiaddr.s_addr = inet_addr(group.dataAscii());
|
||||||
if (ethSetsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) {
|
if (ethSetsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) {
|
||||||
piCoutObj << "Can`t leave multicast group " << group << ", " << ethErrorString();
|
piCoutObj << "Can`t leave multicast group " << group << ", " << ethErrorString();
|
||||||
|
|||||||
@@ -136,18 +136,15 @@ PIByteArray PICrypt::decrypt(const PIByteArray & crypt_data, PIByteArray key, bo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
PIByteArray PICrypt::hash(const PIString & secret) {
|
PIByteArray PICrypt::hash(const PIString & secret) {
|
||||||
PIByteArray hash;
|
PIByteArray hash;
|
||||||
qDebug() << "hash start";
|
|
||||||
#ifdef PIP_CRYPT
|
#ifdef PIP_CRYPT
|
||||||
sodium_init();
|
sodium_init();
|
||||||
qDebug() << "sodium_init ok";
|
|
||||||
hash.resize(crypto_generichash_BYTES);
|
hash.resize(crypto_generichash_BYTES);
|
||||||
PIByteArray s(secret.data(), secret.size());
|
PIByteArray s(secret.data(), secret.size());
|
||||||
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
|
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
|
||||||
#endif
|
#endif
|
||||||
qDebug() << "hash end";
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,14 @@
|
|||||||
# ifndef FREE_BSD
|
# ifndef FREE_BSD
|
||||||
# ifndef MAC_OS
|
# ifndef MAC_OS
|
||||||
# ifndef ANDROID
|
# ifndef ANDROID
|
||||||
|
# ifndef BLACKBERRY
|
||||||
# define LINUX
|
# define LINUX
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# if defined(__LP64__) || defined(_LP64_) || defined(LP64)
|
# if defined(__LP64__) || defined(_LP64_) || defined(LP64)
|
||||||
|
|||||||
Reference in New Issue
Block a user