Smart Home firewall
Profile-based Smart Home firewall
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
protocols.Custom.Custom Class Reference
Inheritance diagram for protocols.Custom.Custom:
Inheritance graph
[legend]
Collaboration diagram for protocols.Custom.Custom:
Collaboration graph
[legend]

Public Member Functions

None add_field (self, str field, dict template_rules, bool is_backward=False, func=lambda x:x, backward_func=lambda x:x)
 
- Public Member Functions inherited from protocols.Protocol.Protocol
None __init__ (self, dict protocol_data, dict device)
 
Protocol init_protocol (c, str protocol_name, dict protocol_data, dict device)
 
str format_list (self, list l, func=lambda x:x)
 
dict parse (self, bool is_backward=False, str initiator="src")
 

Static Public Member Functions

dict build_nfq_list_match (list l, dict template_rules, bool is_backward=False, func=lambda x:x, backward_func=lambda x:x)
 
- Static Public Member Functions inherited from protocols.Protocol.Protocol
Union[str, int] convert_value (str value)
 

Static Public Attributes

bool custom_parser = True
 

Additional Inherited Members

- Public Attributes inherited from protocols.Protocol.Protocol
 protocol_data
 
 device
 
 rules
 

Member Function Documentation

◆ add_field()

None protocols.Custom.Custom.add_field (   self,
str  field,
dict  template_rules,
bool   is_backward = False,
  func = lambda x: x,
  backward_func = lambda x: x 
)
Add a new nfqueue match to the accumulator.
Overrides the nftables version.

:param field: Field to add the rule for.
:param template_rules: Dictionary containing the protocol-specific rules to add.
:param is_backward: Whether the field to add is for a backward rule.
:param func: Function to apply to the field value before writing it.
             Optional, default is the identity function.
:param backward_func: Function to apply to the field value in the case of a backwards rule.
                      Will be applied after `func`.
                      Optional, default is the identity function.
Args:
    field (str): Field to add the rule for.
    template_rules (dict): Dictionary containing the protocol-specific rules to add.
    is_backward (bool): Whether the field to add is for a backward rule.
    func (lambda): Function to apply to the field value before writing it.
                   Optional, default is the identity function.
    backward_func (lambda): Function to apply to the field value in the case of a backwards rule.
                   Will be applied after `func`.
                   Optional, default is the identity function.

Reimplemented from protocols.Protocol.Protocol.

◆ build_nfq_list_match()

dict protocols.Custom.Custom.build_nfq_list_match ( list  l,
dict  template_rules,
bool   is_backward = False,
  func = lambda x: x,
  backward_func = lambda x: x 
)
static
Produce a nfqueue match for a list of values.

:param l: List of values.
:param template_rules: Dictionary containing the protocol-specific rules to add.
:param is_backward: Whether the field to add is for a backward rule.
:param func: Function to apply to the field value before writing it.
             Optional, default is the identity function.
:param backward_func: Function to apply to the field value in the case of a backwards rule.
                      Will be applied after `func`.
                      Optional, default is the identity function.

The documentation for this class was generated from the following file: