equal
deleted
inserted
replaced
23 * Base buffer-manipulation operations for buffered socket send/recv |
23 * Base buffer-manipulation operations for buffered socket send/recv |
24 */ |
24 */ |
25 class NetworkBufferBase { |
25 class NetworkBufferBase { |
26 protected: |
26 protected: |
27 /** The socket that we use */ |
27 /** The socket that we use */ |
28 NetworkSocket socket; |
28 NetworkSocket *socket; |
29 |
29 |
30 /** The buffer itself */ |
30 /** The buffer itself */ |
31 char *buf; |
31 char *buf; |
32 |
32 |
33 /** Buffer size and current read/write offset */ |
33 /** Buffer size and current read/write offset */ |
35 |
35 |
36 public: |
36 public: |
37 /** |
37 /** |
38 * Allocate buf using the given initial size, and set offset to zero |
38 * Allocate buf using the given initial size, and set offset to zero |
39 */ |
39 */ |
40 NetworkBufferBase (NetworkSocket &socket, size_t size_hint); |
40 NetworkBufferBase (NetworkSocket *socket, size_t size_hint); |
41 |
41 |
42 /** |
42 /** |
43 * Free()'s the buf |
43 * Free()'s the buf |
44 */ |
44 */ |
45 ~NetworkBufferBase (void); |
45 ~NetworkBufferBase (void); |
74 class NetworkBufferInput : public NetworkBufferBase { |
74 class NetworkBufferInput : public NetworkBufferBase { |
75 public: |
75 public: |
76 /** |
76 /** |
77 * @see NetworkBufferBase |
77 * @see NetworkBufferBase |
78 */ |
78 */ |
79 NetworkBufferInput (NetworkSocket &socket, size_t size_hint); |
79 NetworkBufferInput (NetworkSocket *socket, size_t size_hint); |
80 |
80 |
81 private: |
81 private: |
82 /** |
82 /** |
83 * Attempts to recv the given number of bytes into our buf, returning true on success |
83 * Attempts to recv the given number of bytes into our buf, returning true on success |
84 * |
84 * |
185 class NetworkBufferOutput : public NetworkBufferBase { |
185 class NetworkBufferOutput : public NetworkBufferBase { |
186 public: |
186 public: |
187 /** |
187 /** |
188 * @see NetworkBufferBase |
188 * @see NetworkBufferBase |
189 */ |
189 */ |
190 NetworkBufferOutput (NetworkSocket &socket, size_t size_hint); |
190 NetworkBufferOutput (NetworkSocket *socket, size_t size_hint); |
191 |
191 |
192 private: |
192 private: |
193 /** |
193 /** |
194 * Write the given data to the socket, either now of later. |
194 * Write the given data to the socket, either now of later. |
195 * |
195 * |