view include/http/ITransaction.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/http/ITransaction.hpp@cd9942c3faaa
children dad671a5f028
line wrap: on
line source

#ifndef __ZIA_API_TRANSACTION_HPP__
# define __ZIA_API_TRANSACTION_HPP__

# include "http/IRequest.hpp"
# include "http/IResponse.hpp"
# include "network/IEndPoint.hpp"

namespace   zia
{
    namespace   api
    {
        namespace   http
        {
            /**
             * @brief Provide a way to get all informations related to the
             * request and the response.
             *
             * Even if response is always available, it should not be modify in
             * RequestModifier * handler.
             *
             * @note We don't provide differents interfaces for the request and
             * the response, to avoid code duplication.
             */
            class   ITransaction
            {
            public:
                virtual ~ITransaction(void) { }

                /**
                 * @brief Get the request received.
                 *
                 * @return The request.
                 *
                 * @see IRequest
                 */
                virtual const IRequest &            getRequest(void) const = 0;

                /**
                 * @brief Get the response that will be sent.
                 *
                 * @return The response.
                 *
                 * @remarks This should not be used by RequestHeaderModifier
                 * and RequestBodyModifier.
                 *
                 * @see IResponse
                 * @see RequestHeaderModifier, RequestHeaderModifier, IResponse
                 */
                virtual const IResponse &           getResponse(void) const = 0;

                /**
                 * @brief Get client endpoint to know from where it is connected.
                 *
                 * @return The client connection point.
                 *
                 * @see network::IEndPoint
                 */
                virtual const network::IEndPoint &  getClientEndPoint(void) const = 0;

                /**
                 * @brief Get on what server the client is connected.
                 *
                 * @return The server connection point.
                 *
                 * @remarks This can be used to have a module adapted to different vhost
                 *
                 * @see network::IEndPoint
                 */
                virtual const network::IEndPoint &  getServerEndPoint(void) const = 0;

                /**
                 * @brief Get the request received.
                 *
                 * @return The request.
                 *
                 * @see IRequest
                 */
                virtual IRequest &                  getRequest(void) = 0;

                /**
                 * @brief Get the response that will be sent.
                 *
                 * @return The response.
                 *
                 * @remarks This should not be used by RequestHeaderModifier
                 * and RequestBodyModifier.
                 *
                 * @see IResponse
                 * @see handler::EHook
                 */
                virtual IResponse &                 getResponse(void) = 0;

                virtual network::IEndPoint &        getClientEndPoint(void) = 0;

                virtual network::IEndPoint &        getServerEndPoint(void) = 0;
            };
        };
    };
};

#endif	/* ! __ZIA_API_TRANSACTION_HPP__ */