Mercurial > archived > louis > epitech > zia-api
diff include/handler/IHandler.hpp @ 41:7c8cd74023ce
Rework file layout, fix build, add README and SUPPORT
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Mon, 22 Mar 2010 02:08:24 +0100 |
parents | src/include/handler/IHandler.hpp@ed739a5746d3 |
children | dad671a5f028 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/handler/IHandler.hpp Mon Mar 22 02:08:24 2010 +0100 @@ -0,0 +1,56 @@ +#ifndef __ZIA_API_IHANDLER_HPP_ +# define __ZIA_API_IHANDLER_HPP_ + +# include "http/ITransaction.hpp" + +namespace zia +{ + namespace api + { + namespace handler + { + /** + * @brief Identify a connection point in the server. + */ + enum EHook + { + NetwordModifier, /**< Hook to replace read/write/accept function. (INetworkHandler) */ + RequestHeaderModifier, /**< Hook to modify the request's header. (IHeaderHandler) */ + RequestBodyModifier, /**< Hook to modify the request's body. (IBodyHandler) */ + ResponseProcessor, /**< Hook for content generation. (IBodyHandler) */ + ResponseHeaderModifier, /**< Hook to modify the response's header. (IHeaderHandler) */ + ResponseBodyModifier /**< Hook to modify the response's body. (IBodyHandler) */ + }; + + /** + * @brief Identify the values that each handler can return. + */ + enum ECode + { + Ok, /**< It works !*/ + Decline, /**< No treatment performed */ + ClientError, /**< Client error, module must have set the correct error code in the response headers. */ + ServerError /**< Server error, module must have set the correct error code in the response headers. */ + }; + + /** + * @brief Interface which all handler have to respect. + */ + class IHandler + { + public: + virtual ~IHandler(void) { } + + /** + * @brief Get where the hook has to be called. + * + * @return EHook which represent the location of where the hook + * should be added. + */ + virtual EHook getHook(void) const = 0; + }; + }; + }; +}; + +#endif /* ! __ZIA_API_IHANDLER_HPP_ */