Hybrid_Fa Documentation

This page contains the Hybrid_Fa Package documentation.

The test_hybrid_fa Module

class netbench.pattern_match.algorithms.hybrid_fa.test_hybrid_fa.test_hybrid_fa(methodName='runTest')

Bases: unittest.TestCase

Test module for class hybrid_fa.

test___init__()
__init__()
test__is_special()
_is_special()
test_compute()
compute()
test_get_state_num()
get_state_num()
test_get_trans_num()
get_state_num()
test_report_memory_naive()
report_memory_naive()
test_report_memory_optimal()
report_memory_optimal()
search()
test_set_max_head_size()
set_max_head_size()
test_set_max_tx()
set_max_tx()
test_set_special_min_depth()
set_special_min_depth()

The hybrid_fa Module

Module for pattern match: algorithm for Hybrid Finite Automat.

class netbench.pattern_match.algorithms.hybrid_fa.hybrid_fa.hybrid_fa

Bases: netbench.pattern_match.b_automaton.b_Automaton

Class for Hybrid Finite Automat.

Hybrid automaton is saved in:
  • self.dfa - Head DFA part of Hybrid FA
  • self.nfas - Tails NFA parts of Hybrid FA
  • self.tran_aut - List of border states

Indexes in self.tran_aut reffer to self.nfas list for particular NFA tails.

Based on:
“A hybrid finite automaton for practical deep packetinspection ISBN: 978-1-59593-770-4 URL: http://portal.acm.org/citation.cfm?id=1364656

Borders states are recognized in self._is_special(state) method based on implementation of this approach in regex tool from M. Becchi. Arguments for this method are saved in self._SPECIAL_MIN_DEPTH, self._MAX_TX and self._MAX_HEAD_SIZE and have setters like self.set_max_head_state() etc. Every option could by turn off by set -1 as value.

compute()
Computes Hybrid automaton.
get_automaton()

DFA head of automaton is save in self.dfa, NFA tails are in self.nfas. Read instruction in __init__ method.

Raises:empty_automaton_exception()
get_state_num()

Return number of states in Hybrid automaton.

Returns:Number of states in Hybrid automaton
Return type:int
get_trans_num()

Return number of transitions in Hybrid automaton.

Returns:Number of transitions in Hybrid automaton
Return type:int
report_memory_naive()

Report consumed memory in bytes. Read documentaion in b_dfa and b_nfa methods for more information.

Returns:Returns number of bytes.
Return type:int
report_memory_optimal()

Report consumed memory in bytes. Read documentaion in b_dfa and b_nfa methods for more information.

Returns:Returns number of bytes.
Return type:int
save_to_file(file_name)

DFA head of automaton is save in self.dfa, NFA tails are in self.nfas. Read instruction in __init__ method.

Raises:empty_automaton_exception()
search(input_string)

Function will find patterns in the given string.

Parameters:
  • input_string – Input string.
  • input_string – string
Returns:

Bitmap of matched regular expressions.

Return type:

list(int)

set_max_head_size(max_head_size)

Set argument for _is_special() predicate.

Parameter:max_head_size (int) – New value. Has to be greater or equal than 0, -1 for off.
Raises:ValueError
set_max_tx(max_tx)

Set argument for _is_special() predicate.

Parameter:max_tx (int) – New value. Has to be greater or equal than 0, -1 for off.
Raises:ValueError
set_special_min_depth(special_min_depth)

Set argument for _is_special() predicate.

Parameter:special_min_depth (int) – New value. Has to be greater than 0, -1 for off.
Raises:ValueError
show(file_name)

Print states, alphabet, start, transitions, final, Flags of DFA part and NFA parts. And save graphviz dot file, representing graphical structure of nfa_data.

Parameter:file_name (string) – Name of output DOT file

Table Of Contents

Previous topic

History_Fa Documentation

Next topic

J_Hybrid_Fa Documentation

This Page