add encryption

This commit is contained in:
2024-09-11 15:44:02 +03:00
parent 0d94699206
commit b24b5a1346
5 changed files with 25 additions and 6 deletions

View File

@@ -54,6 +54,8 @@ public:
int write(const void * d, const size_t s);
int write(const PIByteArray & ba) { return write(ba.data(), ba.size()); }
void enableSymmetricEncryption(const PIByteArray & key);
protected:
virtual void readed(PIByteArray data) {}
virtual void connected() {}

View File

@@ -49,7 +49,7 @@ public:
void setClientFactory(std::function<Client *()> f) { client_factory = f; }
void write(Client * c, const PIByteArray & data);
void enableSymmetricEncryption(const PIByteArray & key);
protected:
virtual void readed(Client * c, PIByteArray data) {}
@@ -61,6 +61,7 @@ private:
std::function<Client *()> client_factory;
PIEthernet * tcp_server = nullptr;
PIThread * clean_thread = nullptr;
PIByteArray crypt_key;
PIVector<Client *> clients;
PIMutex clients_mutex;