#ifndef SHANNONCONNECTION_H #define SHANNONCONNECTION_H #include #ifdef _WIN32 #include #include #include "win32shim.h" #else #include #include #include #endif #include #include #include #include #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 sendCipher; std::unique_ptr recvCipher; uint32_t sendNonce = 0; uint32_t recvNonce = 0; std::vector cipherPacket(uint8_t cmd, std::vector &data); WrappedMutex writeMutex; WrappedMutex readMutex; public: ShannonConnection(); ~ShannonConnection(); void wrapConnection(std::shared_ptr conn, std::vector &sendKey, std::vector &recvKey); void sendPacket(uint8_t cmd, std::vector &data); std::shared_ptr conn; std::unique_ptr recvPacket(); }; #endif