]> WPIA git - cassiopeia.git/blobdiff - src/io/slipBio.h
fix: check cert before operating on it
[cassiopeia.git] / src / io / slipBio.h
index 26de30aefa75f6dad29b3fa1d91d80ba98e05dda..918b9f7b3e9ff741891f9159a377f1e943a68d2a 100644 (file)
@@ -3,7 +3,7 @@
 #include <memory>
 #include <vector>
 
-#include "bios.h"
+#include "io/bios.h"
 
 class SlipBIO : public OpensslBIO {
 private:
@@ -11,22 +11,28 @@ private:
 
     std::vector<char> buffer;
 
+    std::vector<char> 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<OpensslBIO> target );
     SlipBIO();
     ~SlipBIO();
 
-    void setTarget( std::shared_ptr<OpensslBIO> target );
+    void setTarget( std::shared_ptr<OpensslBIO> target, bool server );
 
     virtual int write( const char* buf, int num );
     virtual int read( char* buf, int size );