PICloud change protocol > server_uuid

This commit is contained in:
2021-04-12 11:35:34 +03:00
parent f75ce1e8e0
commit dbd2267a8c
12 changed files with 56 additions and 33 deletions

View File

@@ -38,6 +38,7 @@ class PIP_CLOUD_EXPORT TCP {
public:
enum Version {
Version_1 = 1,
Version_2 = 2,
};
enum Role {
@@ -66,7 +67,7 @@ public:
PIPair<PICloud::TCP::Type, PICloud::TCP::Role> parseHeader(PIByteArray & ba);
PIByteArray parseData(PIByteArray & ba);
PIPair<uint, PIByteArray> parseDataServer(PIByteArray & ba);
PIString parseConnect_d(PIByteArray & ba);
PIByteArray parseConnect_d(PIByteArray & ba);
uint parseConnect(PIByteArray & ba);
uint parseDisconnect(PIByteArray & ba);
@@ -79,7 +80,7 @@ private:
};
Header header;
PIString sname;
PIByteArray suuid;
PIStreamPacker * streampacker;
};

View File

@@ -181,6 +181,12 @@ public:
return true;
}
inline bool operator !=(const PIDeque<T> & t) const {return !(*this == t);}
inline bool operator >(const PIDeque<T> & t) const {
if (pid_size != t.pid_size) return pid_size > t.pid_size;
for (size_t i = 0; i < pid_size; ++i)
if (t[i] != (*this)[i]) return t[i] > (*this)[i];
return false;
}
inline bool contains(const T & v) const {
for (size_t i = pid_start; i < pid_start + pid_size; ++i)
if (v == pid_data[i])

View File

@@ -58,6 +58,9 @@ public:
//! Generate hash from bytearray
static PIByteArray hash(const PIByteArray & data);
//! Returns hash size
static size_t sizeHash();
//! Generate short hash from string "s", may be used for hash table
static ullong shorthash(const PIString & s, PIByteArray key = PIByteArray());