bitz-server  1.0.0
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bitz::RequestHandler Class Reference
Inheritance diagram for bitz::RequestHandler:
bitz::OptionsRequestHandler bitz::ReqmodRequestHandler bitz::RespmodRequestHandler

Classes

struct  handler_t
 
struct  req_handler_t
 

Public Member Functions

 RequestHandler (const std::string &method)
 
const std::string & method () const throw ()
 
virtual icap::Responseprocess (icap::RequestHeader *req_header, psocksxx::iosockstream *socket) throw ()
 

Protected Member Functions

bool load_modifier (const std::string &file, Modifier::symbols_t &symbols) throw ()
 
void unload_modifier (void *modifier) throw ()
 
void load_modules () throw ()
 
void cleanup_modules () throw ()
 
icap::Responseprocess_preview (icap::Request *request, psocksxx::iosockstream *socket) throw ()
 
icap::Responseprocess_modify (icap::Request *request) throw ()
 
bool preview_continue (icap::Response *response, icap::Request *request, psocksxx::iosockstream *socket) throw ()
 

Protected Attributes

unsigned int _handlers_count
 
handler_t_handlers
 

Member Function Documentation

void bitz::RequestHandler::cleanup_modules ( )
throw (
)
protected

Cleanup all the loaded modifier modules

bool bitz::RequestHandler::load_modifier ( const std::string &  file,
Modifier::symbols_t symbols 
)
throw (
)
protected

Load a modifier module

Parameters
filefile name / path of the module
symbolsstructure to return the symbols
Returns
boolean to denote success or failure
void bitz::RequestHandler::load_modules ( )
throw (
)
protected

Load all the configured modifier modules for this request handler

const std::string & bitz::RequestHandler::method ( ) const
throw (
)

Returns the request method handled by this handler

Returns
method
bool bitz::RequestHandler::preview_continue ( icap::Response response,
icap::Request request,
psocksxx::iosockstream *  socket 
)
throw (
)
protected

Helper method to set a '100 Continue' response back to the client and read the full request.

Parameters
responseresponse object with status 100
requestrequest object
socketsocket object to read / write data
Returns
icap::Response * bitz::RequestHandler::process ( icap::RequestHeader req_header,
psocksxx::iosockstream *  socket 
)
throw (
)
virtual

Process the request and return a new response object. This will also read from the passed in socket if more data needs to be read.

Parameters
req_headerrequest header object
socketsocket object to read the data from
Returns
response object

Reimplemented in bitz::OptionsRequestHandler.

icap::Response * bitz::RequestHandler::process_modify ( icap::Request request)
throw (
)
protected

This method will use the loaded handler modules to get a response to the request.

Parameters
requestrequest object
Returns
response object
icap::Response * bitz::RequestHandler::process_preview ( icap::Request request,
psocksxx::iosockstream *  socket 
)
throw (
)
protected

Given a request instance and a socket instance to communicate, this method will use the loaded handler modules to grab a preview response. This will return a icap::Response object or NULL after processing a '100 Continue' response.

Parameters
requestrequest object
socketsocket object to read data from
Returns
preview response (response object)
void bitz::RequestHandler::unload_modifier ( void *  modifier)
throw (
)
protected

Unload a modifier module

Parameters
modifierpointer to the modifier to unload