]> WPIA git - cassiopeia.git/blob - src/slipBio.h
add: Basic BIO implementation for SLIP
[cassiopeia.git] / src / 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
20 private:
21     bool unmask();
22
23 public:
24     SlipBIO( std::shared_ptr<OpensslBIO> target );
25     ~SlipBIO();
26
27     virtual int write( const char* buf, int num );
28     virtual int read( char* buf, int size );
29     virtual long ctrl( int cmod, long arg1, void* arg2 );
30
31     static const char* getName();
32 };