blackberry release

git-svn-id: svn://db.shs.com.ru/pip@134 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-05-21 06:24:21 +00:00
parent 0ab3bb388f
commit e6dde535b9
4 changed files with 30 additions and 18 deletions

View File

@@ -53,9 +53,12 @@
//! Macro is defined when host is any Windows
# define WINDOWS
//! Macro is defined when host is QNX
//! Macro is defined when host is QNX or Blackberry
# define QNX
//! Macro is defined when host is Blackberry
# define BLACKBERRY
//! Macro is defined when host is FreeBSD
# define FREE_BSD

View File

@@ -341,11 +341,13 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
if (!params[Broadcast])
;//piCoutObj << "Warning: \"Broadcast\" parameter not set, \"joinMulticastGroup(\"" << group << "\")\" may be useless!";
parseAddress(path(), &ip_, &port_);
struct
#ifndef QNX
struct ip_mreqn mreq;
ip_mreqn
#else
struct ip_mreq mreq;
ip_mreq
#endif
mreq;
memset(&mreq, 0, sizeof(mreq));
#ifdef LINUX
//mreq.imr_address.s_addr = INADDR_ANY;
@@ -353,13 +355,16 @@ bool PIEthernet::joinMulticastGroup(const PIString & group) {
const PIEthernet::Interface * ci = il.getByAddress(ip_);
if (ci != 0) mreq.imr_ifindex = ci->index;*/
#endif
in_addr_t addr;
if (params[PIEthernet::Broadcast]) addr = INADDR_ANY;
else addr = inet_addr(ip_.dataAscii());
mreq.
#ifndef QNX
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
else mreq.imr_address.s_addr = inet_addr(ip_.dataAscii());
imr_address
#else
if (params[PIEthernet::Broadcast]) mreq.imr_interface.s_addr = INADDR_ANY;
else mreq.imr_interface.s_addr = inet_addr(ip_.dataAscii());
imr_interface
#endif
.s_addr = addr;
/*#ifndef WINDOWS
PIEthernet::InterfaceList il = interfaces();
const PIEthernet::Interface * ci = il.getByAddress(ip_);
@@ -402,19 +407,24 @@ bool PIEthernet::leaveMulticastGroup(const PIString & group) {
PIFlags<Parameters> params = parameters();
/// TODO windows
parseAddress(path(), &ip_, &port_);
struct
#ifndef QNX
struct ip_mreqn mreq;
ip_mreqn
#else
struct ip_mreq mreq;
ip_mreq
#endif
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
if (params[PIEthernet::Broadcast]) mreq.imr_address.s_addr = INADDR_ANY;
else mreq.imr_address.s_addr = inet_addr(ip_.dataAscii());
imr_address
#else
if (params[PIEthernet::Broadcast]) mreq.imr_interface.s_addr = INADDR_ANY;
else mreq.imr_interface.s_addr = inet_addr(ip_.dataAscii());
imr_interface
#endif
.s_addr = addr;
mreq.imr_multiaddr.s_addr = inet_addr(group.dataAscii());
if (ethSetsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) == -1) {
piCoutObj << "Can`t leave multicast group " << group << ", " << ethErrorString();

View File

@@ -136,18 +136,15 @@ PIByteArray PICrypt::decrypt(const PIByteArray & crypt_data, PIByteArray key, bo
return ret;
}
#include <QDebug>
PIByteArray PICrypt::hash(const PIString & secret) {
PIByteArray hash;
qDebug() << "hash start";
#ifdef PIP_CRYPT
sodium_init();
qDebug() << "sodium_init ok";
hash.resize(crypto_generichash_BYTES);
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);
#endif
qDebug() << "hash end";
return hash;
}

View File

@@ -50,12 +50,14 @@
# ifndef FREE_BSD
# ifndef MAC_OS
# ifndef ANDROID
# ifndef BLACKBERRY
# define LINUX
# endif
# endif
# endif
# endif
# endif
#endif
#ifndef WINDOWS
# if defined(__LP64__) || defined(_LP64_) || defined(LP64)