X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fio%2FslipBio.h;h=a2fd3c2de2dfd7836e70c663a929d86a2150d084;hb=da9f337a893bd317460118f89efa83a3427f797f;hp=26de30aefa75f6dad29b3fa1d91d80ba98e05dda;hpb=f69f31caeda734d6d9c8ab00e693671ac7512bea;p=cassiopeia.git diff --git a/src/io/slipBio.h b/src/io/slipBio.h index 26de30a..a2fd3c2 100644 --- a/src/io/slipBio.h +++ b/src/io/slipBio.h @@ -3,7 +3,7 @@ #include #include -#include "bios.h" +#include "io/bios.h" class SlipBIO : public OpensslBIO { private: @@ -11,26 +11,32 @@ private: std::vector buffer; + std::vector header = {0, 0, 0, 0, 0, 0, 0, 0}; + int resetCounter = -1; // -1 means waiting for start byte + unsigned int decodeTarget; unsigned int decodePos; unsigned int rawPos; - bool failed; + bool waitForConnection = true; + bool waitForReset = false; bool packageLeft = false; + bool server = false; + private: - bool unmask(); + int unmask(); public: SlipBIO( std::shared_ptr target ); SlipBIO(); ~SlipBIO(); - void setTarget( std::shared_ptr target ); + void setTarget( std::shared_ptr target, bool server ); - virtual int write( const char* buf, int num ); - virtual int read( char* buf, int size ); - virtual long ctrl( int cmod, long arg1, void* arg2 ); + virtual int write( const char *buf, int num ); + virtual int read( char *buf, int size ); + virtual long ctrl( int cmod, long arg1, void *arg2 ); - static const char* getName(); + static const char *getName(); };