]> WPIA git - cassiopeia.git/blob - src/io/slipBio.h
Merge remote-tracking branch 'origin/libs/detectcoll/local'
[cassiopeia.git] / src / io / slipBio.h
1 #pragma once
2
3 #include <memory>
4 #include <vector>
5
6 #include "bios.h"
7
8 class SlipBIO : public OpensslBIO {
9 private:
10     std::shared_ptr<OpensslBIO> target;
11
12     std::vector<char> buffer;
13
14     unsigned int decodeTarget;
15     unsigned int decodePos;
16     unsigned int rawPos;
17
18     bool failed;
19     bool packageLeft = false;
20
21 private:
22     bool unmask();
23
24 public:
25     SlipBIO( std::shared_ptr<OpensslBIO> target );
26     SlipBIO();
27     ~SlipBIO();
28
29     void setTarget( std::shared_ptr<OpensslBIO> target );
30
31     virtual int write( const char* buf, int num );
32     virtual int read( char* buf, int size );
33     virtual long ctrl( int cmod, long arg1, void* arg2 );
34
35     static const char* getName();
36 };