src/transaction.cc
/**
 * @name    processConnection
 * @brief   Perform the analysis on the connection.
 *
 * This method should be called at very beginning of a request process, it is
 * expected to be executed prior to the virtual host resolution, when the
 * connection arrives on the server.
 *
 * @note Remember to check for a possible intervention.
 *
 * @param transaction ModSecurity Transaction.
 * @param client Client's IP address in text format.
 * @param cPort Client's port
 * @param server Server's IP address in text format.
 * @param sPort Server's port
 *
 * @returns If the operation was successful or not.
 * @retval true Operation was successful.
 * @retval false Operation failed.
 *
 */
@name    processConnection
@brief   Perform the analysis on the connection.

This method should be called at very beginning of a request process, it is
expected to be executed prior to the virtual host resolution, when the
connection arrives on the server.

@note Remember to check for a possible intervention.

@param transaction ModSecurity Transaction.
@param client Client's IP address in text format.
@param cPort Client's port
@param server Server's IP address in text format.
@param sPort Server's port

@returns If the operation was successful or not.
@retval true Operation was successful.
@retval false Operation failed.
@name processConnection @brief Perform the analysis on the connection . This method should be called at very beginning of a request process it is expected to be executed prior to the virtual host resolution when the connection arrives on the server . @note Remember to check for a possible intervention . @param transaction ModSecurity Transaction . @param client Client ' s IP address in text format . @param cPort Client ' s port @param server Server ' s IP address in text format . @param sPort Server ' s port @returns If the operation was successful or not . @retval true Operation was successful . @retval false Operation failed .
int Transaction::processConnection(const char *client, int cPort,
    const char *server, int sPort) {
    this->m_clientIpAddress = client;
    this->m_serverIpAddress = server;
    this->m_clientPort = cPort;
    this->m_serverPort = sPort;
#ifndef NO_LOGS
    debug(4, "Transaction context created.");
    debug(4, "Starting phase CONNECTION. (SecRules 0)");
#endif
    this->m_collections.store("REMOTE_HOST", m_clientIpAddress);
    this->m_collections.store("UNIQUE_ID", m_id);
    this->m_collections.store("REMOTE_ADDR", m_clientIpAddress);
    this->m_collections.store("SERVER_ADDR", m_serverIpAddress);
    this->m_collections.store("SERVER_PORT",
        std::to_string(this->m_serverPort));
    this->m_collections.store("REMOTE_PORT",
        std::to_string(this->m_clientPort));
    this->m_rules->evaluate(modsecurity::ConnectionPhase, this);
    return true;
}
int Transaction :: processConnection ( const char * client , int cPort , const char * server , int sPort ) { this -> m_clientIpAddress = client ; this -> m_serverIpAddress = server ; this -> m_clientPort = cPort ; this -> m_serverPort = sPort ; #ifndef NO_LOGS debug ( 4 , " " ) ; debug ( 4 , " " ) ; #endif this -> m_collections . store ( " " , m_clientIpAddress ) ; this -> m_collections . store ( " " , m_id ) ; this -> m_collections . store ( " " , m_clientIpAddress ) ; this -> m_collections . store ( " " , m_serverIpAddress ) ; this -> m_collections . store ( " " , std :: to_string ( this -> m_serverPort ) ) ; this -> m_collections . store ( " " , std :: to_string ( this -> m_clientPort ) ) ; this -> m_rules -> evaluate ( modsecurity :: ConnectionPhase , this ) ; return true ; }
@name    processConnection
 @brief   Perform the analysis on the connection.
@name processConnection @brief Perform the analysis on the connection .