]> WPIA git - cassiopeia.git/blobdiff - src/io/slipBio.h
fmt: run format script excluding lambdas
[cassiopeia.git] / src / io / slipBio.h
index 26de30aefa75f6dad29b3fa1d91d80ba98e05dda..a2fd3c2de2dfd7836e70c663a929d86a2150d084 100644 (file)
@@ -3,7 +3,7 @@
 #include <memory>
 #include <vector>
 
-#include "bios.h"
+#include "io/bios.h"
 
 class SlipBIO : public OpensslBIO {
 private:
@@ -11,26 +11,32 @@ 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 charbuf, int num );
-    virtual int read( charbuf, int size );
-    virtual long ctrl( int cmod, long arg1, voidarg2 );
+    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 chargetName();
+    static const char *getName();
 };