Public Member Functions

fawkes::DynamicWebReply Class Reference

Dynamic web reply. More...

#include <>>

Inheritance diagram for fawkes::DynamicWebReply:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DynamicWebReply (response_code_t code)
 Constructor.
virtual size_t chunk_size ()
 Chunksize.
virtual size_t size ()=0
 Total size of the web reply.
virtual size_t next_chunk (size_t pos, char *buffer, size_t buf_max_size)=0
 Get data of next chunk.

Detailed Description

Dynamic web reply.

A reply of this type is send out in chunks, not all as a whole. It should be used for payloads that can get very large, like file transfers.

Author:
Tim Niemueller

Definition at line 114 of file reply.h.


Constructor & Destructor Documentation

fawkes::DynamicWebReply::DynamicWebReply ( response_code_t  code  ) 

Constructor.

Parameters:
code HTTP response code

Definition at line 114 of file reply.cpp.


Member Function Documentation

size_t fawkes::DynamicWebReply::chunk_size (  )  [virtual]

Chunksize.

The size that a single chunk should have. A sub-class may override this if a specific chunk size is beneficial or even required. The default is 32kb.

Returns:
chunk size in bytes

Definition at line 126 of file reply.cpp.

Referenced by fawkes::WebRequestDispatcher::process_request().

size_t fawkes::DynamicWebReply::next_chunk ( size_t  pos,
char *  buffer,
size_t  buf_max_size 
) [pure virtual]

Get data of next chunk.

Parameters:
pos position in the stream. Note that a certain position may be called several times.
buffer buffer to store data in
buf_max_size maximum size in bytes of data that can be put into buffer
Returns:
number of bytes written to buffer, or -1 to immediately stop the transfer.

Implemented in fawkes::DynamicFileWebReply.

Referenced by fawkes::dynamic_reply_data_cb().

size_t fawkes::DynamicWebReply::size (  )  [pure virtual]

Total size of the web reply.

Return the total size of the reply if known, or 0 if it is not known. In the latter case your next_chunk() method has to return -1 at some point to end the transfer. If possible by any means return a meaningful value, as it will improve the experience of users, especially for long transfers!

Returns:
total size of reply in bytes

Implemented in fawkes::DynamicFileWebReply.

Referenced by fawkes::WebRequestDispatcher::process_request().


The documentation for this class was generated from the following files: