aboutsummaryrefslogtreecommitdiff
path: root/src/stable/client.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/stable/client.h
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/client.h')
-rw-r--r--src/stable/client.h224
1 files changed, 112 insertions, 112 deletions
diff --git a/src/stable/client.h b/src/stable/client.h
index 6bd41af..cacc8aa 100644
--- a/src/stable/client.h
+++ b/src/stable/client.h
@@ -16,118 +16,118 @@
16 16
17namespace Bu 17namespace Bu
18{ 18{
19 class Protocol; 19 class Protocol;
20 class Stream; 20 class Stream;
21 class TcpSocket; 21 class TcpSocket;
22 class ClientLinkFactory; 22 class ClientLinkFactory;
23 23
24 /** 24 /**
25 *@ingroup Serving 25 *@ingroup Serving
26 */ 26 */
27 class Client : public Bu::Stream 27 class Client : public Bu::Stream
28 { 28 {
29 public: 29 public:
30 Client( Bu::TcpSocket *pSocket, Bu::ClientLinkFactory *pfLink ); 30 Client( Bu::TcpSocket *pSocket, Bu::ClientLinkFactory *pfLink );
31 virtual ~Client(); 31 virtual ~Client();
32 32
33 void processInput(); 33 void processInput();
34 void processOutput(); 34 void processOutput();
35 35
36 //Bu::String &getInput(); 36 //Bu::String &getInput();
37 //Bu::String &getOutput(); 37 //Bu::String &getOutput();
38 Bu::size write( const Bu::String &sData ); 38 Bu::size write( const Bu::String &sData );
39 Bu::size write( const void *pData, Bu::size nBytes ); 39 Bu::size write( const void *pData, Bu::size nBytes );
40 Bu::size write( int8_t nData ); 40 Bu::size write( int8_t nData );
41 Bu::size write( int16_t nData ); 41 Bu::size write( int16_t nData );
42 Bu::size write( int32_t nData ); 42 Bu::size write( int32_t nData );
43 Bu::size write( int64_t nData ); 43 Bu::size write( int64_t nData );
44 Bu::size write( uint8_t nData ); 44 Bu::size write( uint8_t nData );
45 Bu::size write( uint16_t nData ); 45 Bu::size write( uint16_t nData );
46 Bu::size write( uint32_t nData ); 46 Bu::size write( uint32_t nData );
47 Bu::size write( uint64_t nData ); 47 Bu::size write( uint64_t nData );
48 Bu::size read( void *pData, Bu::size nBytes ); 48 Bu::size read( void *pData, Bu::size nBytes );
49 Bu::size peek( void *pData, int nBytes, int nOffset=0 ); 49 Bu::size peek( void *pData, int nBytes, int nOffset=0 );
50// void seek( int nBytes ); 50// void seek( int nBytes );
51 Bu::size getInputSize(); 51 Bu::size getInputSize();
52 Bu::size getOutputSize(); 52 Bu::size getOutputSize();
53 53
54 void setProtocol( Protocol *pProto ); 54 void setProtocol( Protocol *pProto );
55 Bu::Protocol *getProtocol(); 55 Bu::Protocol *getProtocol();
56 void clearProtocol(); 56 void clearProtocol();
57 57
58 bool isOpen(); 58 bool isOpen();
59 void close(); 59 void close();
60 void tick(); 60 void tick();
61 61
62 const Bu::TcpSocket *getSocket() const; 62 const Bu::TcpSocket *getSocket() const;
63 63
64 void disconnect(); 64 void disconnect();
65 bool wantsDisconnect(); 65 bool wantsDisconnect();
66 66
67 class ClientLink *getLink(); 67 class ClientLink *getLink();
68 68
69 void onMessage( const Bu::String &sMsg ); 69 void onMessage( const Bu::String &sMsg );
70 70
71 bool hasOutput() { return qbWrite.getSize() > 0; } 71 bool hasOutput() { return qbWrite.getSize() > 0; }
72 bool hasInput() { return qbRead.getSize() > 0; } 72 bool hasInput() { return qbRead.getSize() > 0; }
73 73
74 template<typename filter> 74 template<typename filter>
75 void pushFilter() 75 void pushFilter()
76 { 76 {
77 filter *pFlt = new filter( *pTopStream ); 77 filter *pFlt = new filter( *pTopStream );
78 pTopStream = pFlt; 78 pTopStream = pFlt;
79 lFilts.prepend( pFlt ); 79 lFilts.prepend( pFlt );
80 } 80 }
81 81
82 template<typename filter, typename p1t> 82 template<typename filter, typename p1t>
83 void pushFilter( p1t p1 ) 83 void pushFilter( p1t p1 )
84 { 84 {
85 filter *pFlt = new filter( *pTopStream, p1 ); 85 filter *pFlt = new filter( *pTopStream, p1 );
86 pTopStream = pFlt; 86 pTopStream = pFlt;
87 lFilts.prepend( pFlt ); 87 lFilts.prepend( pFlt );
88 } 88 }
89 89
90 template<typename filter, typename p1t, typename p2t> 90 template<typename filter, typename p1t, typename p2t>
91 void pushFilter( p1t p1, p2t p2 ) 91 void pushFilter( p1t p1, p2t p2 )
92 { 92 {
93 filter *pFlt = new filter( *pTopStream, p1, p2 ); 93 filter *pFlt = new filter( *pTopStream, p1, p2 );
94 pTopStream = pFlt; 94 pTopStream = pFlt;
95 lFilts.prepend( pFlt ); 95 lFilts.prepend( pFlt );
96 } 96 }
97 97
98 /* 98 /*
99 * These are required to qualify as a stream, I dunno how many will 99 * These are required to qualify as a stream, I dunno how many will
100 * be implemented. 100 * be implemented.
101 */ 101 */
102 virtual Bu::size tell(); 102 virtual Bu::size tell();
103 virtual void seek( Bu::size offset ); 103 virtual void seek( Bu::size offset );
104 virtual void setPos( Bu::size pos ); 104 virtual void setPos( Bu::size pos );
105 virtual void setPosEnd( Bu::size pos ); 105 virtual void setPosEnd( Bu::size pos );
106 virtual bool isEos(); 106 virtual bool isEos();
107 virtual void flush(); 107 virtual void flush();
108 virtual bool canRead(); 108 virtual bool canRead();
109 virtual bool canWrite(); 109 virtual bool canWrite();
110 virtual bool isReadable(); 110 virtual bool isReadable();
111 virtual bool isWritable(); 111 virtual bool isWritable();
112 virtual bool isSeekable(); 112 virtual bool isSeekable();
113 virtual bool isBlocking(); 113 virtual bool isBlocking();
114 virtual void setBlocking( bool bBlocking=true ); 114 virtual void setBlocking( bool bBlocking=true );
115 virtual void setSize( Bu::size iSize ); 115 virtual void setSize( Bu::size iSize );
116 virtual size getSize() const; 116 virtual size getSize() const;
117 virtual size getBlockSize() const; 117 virtual size getBlockSize() const;
118 virtual Bu::String getLocation() const; 118 virtual Bu::String getLocation() const;
119 119
120 private: 120 private:
121 typedef Bu::List<Bu::Stream *> FilterList; 121 typedef Bu::List<Bu::Stream *> FilterList;
122 FilterList lFilts; 122 FilterList lFilts;
123 Bu::Stream *pTopStream; 123 Bu::Stream *pTopStream;
124 Bu::TcpSocket *pSocket; 124 Bu::TcpSocket *pSocket;
125 Bu::Protocol *pProto; 125 Bu::Protocol *pProto;
126 Bu::QueueBuf qbRead; 126 Bu::QueueBuf qbRead;
127 Bu::QueueBuf qbWrite; 127 Bu::QueueBuf qbWrite;
128 bool bWantsDisconnect; 128 bool bWantsDisconnect;
129 class Bu::ClientLinkFactory *pfLink; 129 class Bu::ClientLinkFactory *pfLink;
130 }; 130 };
131} 131}
132 132
133#endif 133#endif