diff options
Diffstat (limited to '')
-rw-r--r-- | src/client.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h new file mode 100644 index 0000000..5947521 --- /dev/null +++ b/src/client.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef BU_CLIENT_H | ||
2 | #define BU_CLIENT_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "bu/fstring.h" | ||
7 | |||
8 | namespace Bu | ||
9 | { | ||
10 | class Protocol; | ||
11 | class Socket; | ||
12 | |||
13 | /** | ||
14 | * | ||
15 | */ | ||
16 | class Client | ||
17 | { | ||
18 | public: | ||
19 | Client( Bu::Socket *pSocket ); | ||
20 | virtual ~Client(); | ||
21 | |||
22 | void processInput(); | ||
23 | void processOutput(); | ||
24 | |||
25 | Bu::FString &getInput(); | ||
26 | Bu::FString &getOutput(); | ||
27 | void write( const void *pData, int nBytes ); | ||
28 | void write( int8_t nData ); | ||
29 | void write( int16_t nData ); | ||
30 | void write( int32_t nData ); | ||
31 | void write( int64_t nData ); | ||
32 | void write( uint8_t nData ); | ||
33 | void write( uint16_t nData ); | ||
34 | void write( uint32_t nData ); | ||
35 | void write( uint64_t nData ); | ||
36 | void read( void *pData, int nBytes ); | ||
37 | void peek( void *pData, int nBytes ); | ||
38 | void seek( int nBytes ); | ||
39 | long getInputSize(); | ||
40 | |||
41 | void setProtocol( Protocol *pProto ); | ||
42 | Bu::Protocol *getProtocol(); | ||
43 | void clearProtocol(); | ||
44 | |||
45 | bool isOpen(); | ||
46 | |||
47 | const Bu::Socket *getSocket() const; | ||
48 | |||
49 | /** | ||
50 | *@todo Make this not suck. | ||
51 | */ | ||
52 | void disconnect(); | ||
53 | |||
54 | private: | ||
55 | Bu::Socket *pSocket; | ||
56 | Bu::Protocol *pProto; | ||
57 | Bu::FString sReadBuf; | ||
58 | int nRBOffset; | ||
59 | Bu::FString sWriteBuf; | ||
60 | }; | ||
61 | } | ||
62 | |||
63 | #endif | ||