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

Public Member Functions

str explicit_address (self, str addr, str type="ipv4")
 
dict parse (self, bool is_backward=False, str initiator="src")
 
- 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)
 
None add_field (self, str field, dict template_rules, bool is_backward=False, func=lambda x:x, backward_func=lambda x:x)
 

Static Public Attributes

string protocol_name = "arp"
 
int layer = 3
 
bool custom_parser = False
 
list supported_keys
 
dictionary mac_addrs
 
dictionary ip_addrs
 

Additional Inherited Members

- Static Public Member Functions inherited from protocols.Protocol.Protocol
Union[str, int] convert_value (str value)
 
- Public Attributes inherited from protocols.Protocol.Protocol
 protocol_data
 
 device
 
 rules
 

Member Function Documentation

◆ explicit_address()

str protocols.arp.arp.explicit_address (   self,
str  addr,
str   type = "ipv4" 
)
Return the explicit version of an IPv4 or MAC address alias.
Example: "local" -> "192.168.0.0/16"

:param addr: IPv4 or MAC address alias to explicit.
:param type: Type of address (ipv4 or mac).
:return: Explicit IPv4 or MAC address.
:raises ValueError: If the address is not a well-known alias or an explicit address.

◆ parse()

dict protocols.arp.arp.parse (   self,
bool   is_backward = False,
str   initiator = "src" 
)
Parse the ARP protocol.

:param is_backward (optional): Whether the protocol must be parsed for a backward rule.
                               Default is `False`.
:param initiator (optional): Connection initiator (src or dst).
                             Default is "src".
:return: Dictionary containing the (forward and backward) nftables and nfqueue rules for this policy.

Reimplemented from protocols.Protocol.Protocol.

Member Data Documentation

◆ ip_addrs

dictionary protocols.arp.arp.ip_addrs
static
Initial value:
= {
"local": "192.168.1.0/24",
"gateway": "192.168.1.1",
"phone": "192.168.1.222"
}

◆ mac_addrs

dictionary protocols.arp.arp.mac_addrs
static
Initial value:
= {
"gateway": "c0:56:27:73:46:0b",
"default": "00:00:00:00:00:00",
"broadcast": "ff:ff:ff:ff:ff:ff",
"phone": "3c:cd:5d:a2:a9:d7"
}

◆ supported_keys

list protocols.arp.arp.supported_keys
static
Initial value:
= [
"type", # ARP message type
"sha", # ARP source hardware address
"tha", # ARP target hardware address
"spa", # ARP source protocol address
"tpa" # ARP target protocol address
]

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