library/src/blockclass/BP-BlockClass.cc
// if a jit check results in a match, you can use this to store the match in the db
// Uses member data for propagation.
if a jit check results in a match, you can use this to store the match in the db
Uses member data for propagation.
if a jit check results in a match you can use this to store the match in the db Uses member data for propagation .
BP_ERROR_T Block::insertWebJITExpressionMatches()
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	if(!this->web_request_jit_match_n)
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	size_t n = 0;
	for(; n < this->web_request_jit_match_n; n++)
	{
		size_t j = 0;
		for(; j < this->web_request_jit_match_set[n].match_info.pcre_num_matched; j++)
		{
			size_t group_id  = this->web_request_jit_match_set[n].group_id;
			size_t test_id   = this->web_request_jit_match_set[n].id;
			size_t result_id = this->web_result_id;
			char * match_val = this->web_request_jit_match_set[n].match_info.preg_matches[j].matched_string;
			size_t match_len = this->web_request_jit_match_set[n].match_info.preg_matches[j].match_len;
			this->insertWebJITExpressionMatch(group_id, test_id, result_id, match_val, match_len);
		}
	}
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: insertWebJITExpressionMatches ( ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; if ( ! this -> web_request_jit_match_n ) BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; size_t n = 0 ; for ( ; n < this -> web_request_jit_match_n ; n ++ ) { size_t j = 0 ; for ( ; j < this -> web_request_jit_match_set [ n ] . match_info . pcre_num_matched ; j ++ ) { size_t group_id = this -> web_request_jit_match_set [ n ] . group_id ; size_t test_id = this -> web_request_jit_match_set [ n ] . id ; size_t result_id = this -> web_result_id ; char * match_val = this -> web_request_jit_match_set [ n ] . match_info . preg_matches [ j ] . matched_string ; size_t match_len = this -> web_request_jit_match_set [ n ] . match_info . preg_matches [ j ] . match_len ; this -> insertWebJITExpressionMatch ( group_id , test_id , result_id , match_val , match_len ) ; } } BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
if a jit check results in a match, you can use this to store the match in the db
Uses member data for propagation.
if a jit check results in a match you can use this to store the match in the db Uses member data for propagation .
// ensure we have a mysql session // enter critical section // walk through each pcre match // set insert values // insert the expression match // return indicating success