mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
move to new cspot
This commit is contained in:
@@ -1,47 +1,41 @@
|
||||
#ifndef SHANNONCONNECTION_H
|
||||
#define SHANNONCONNECTION_H
|
||||
|
||||
#include <vector>
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include "win32shim.h"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include "platform/WrappedMutex.h"
|
||||
#include "Utils.h"
|
||||
#include "Shannon.h"
|
||||
#include "PlainConnection.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Packet.h"
|
||||
#include "PlainConnection.h"
|
||||
#include "Shannon.h"
|
||||
#include <mutex>
|
||||
#include "Utils.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#define MAC_SIZE 4
|
||||
namespace cspot {
|
||||
class ShannonConnection {
|
||||
private:
|
||||
std::unique_ptr<Shannon> sendCipher;
|
||||
std::unique_ptr<Shannon> recvCipher;
|
||||
uint32_t sendNonce = 0;
|
||||
uint32_t recvNonce = 0;
|
||||
std::vector<uint8_t> cipherPacket(uint8_t cmd, std::vector<uint8_t>& data);
|
||||
std::mutex writeMutex;
|
||||
std::mutex readMutex;
|
||||
|
||||
|
||||
class ShannonConnection
|
||||
{
|
||||
private:
|
||||
std::unique_ptr<Shannon> sendCipher;
|
||||
std::unique_ptr<Shannon> recvCipher;
|
||||
uint32_t sendNonce = 0;
|
||||
uint32_t recvNonce = 0;
|
||||
std::vector<uint8_t> cipherPacket(uint8_t cmd, std::vector<uint8_t> &data);
|
||||
WrappedMutex writeMutex;
|
||||
WrappedMutex readMutex;
|
||||
|
||||
public:
|
||||
ShannonConnection();
|
||||
~ShannonConnection();
|
||||
void wrapConnection(std::shared_ptr<PlainConnection> conn, std::vector<uint8_t> &sendKey, std::vector<uint8_t> &recvKey);
|
||||
void sendPacket(uint8_t cmd, std::vector<uint8_t> &data);
|
||||
std::shared_ptr<PlainConnection> conn;
|
||||
std::unique_ptr<Packet> recvPacket();
|
||||
public:
|
||||
ShannonConnection();
|
||||
~ShannonConnection();
|
||||
void wrapConnection(std::shared_ptr<PlainConnection> conn,
|
||||
std::vector<uint8_t>& sendKey,
|
||||
std::vector<uint8_t>& recvKey);
|
||||
void sendPacket(uint8_t cmd, std::vector<uint8_t>& data);
|
||||
std::shared_ptr<PlainConnection> conn;
|
||||
Packet recvPacket();
|
||||
};
|
||||
} // namespace cspot
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user