mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 12:37:01 +03:00
big merge
This commit is contained in:
41
components/spotify/cspot/include/ShannonConnection.h
Normal file
41
components/spotify/cspot/include/ShannonConnection.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SHANNONCONNECTION_H
|
||||
#define SHANNONCONNECTION_H
|
||||
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <string>
|
||||
#include <netdb.h>
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include "platform/WrappedMutex.h"
|
||||
#include "Utils.h"
|
||||
#include "Shannon.h"
|
||||
#include "PlainConnection.h"
|
||||
#include "Packet.h"
|
||||
|
||||
#define MAC_SIZE 4
|
||||
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user