View Source GenICMP.Filter (GenICMP v0.1.0)

Generate ICMPv6 packet filters. To apply a filter to a socket, use GenICMP.filter/2.

example

Example

# only allow echo requests and replies:
filter = GenICMP.Filter.block_all()
|> GenICMP.Filter.set_pass(:echo)
|> GenICMP.Filter.set_pass(:echoreply)

GenICMP.open()
|> GenICMP.filter(filter)

Link to this section Summary

Functions

Create a new filter that blocks all packets.

Create a new filter that allows all packets.

Set a packet type to be dropped by the filter.

Set a packet type to pass through the filter.

Check if a packet type will be dropped by the filter.

Check if a packet type will pass through the filter.

Link to this section Types

@type filter() :: <<_::256>>

Link to this section Functions

@spec block_all() :: filter()

Create a new filter that blocks all packets.

@spec pass_all() :: filter()

Create a new filter that allows all packets.

@spec set_block(filter(), GenICMP.icmp_type()) :: filter()

Set a packet type to be dropped by the filter.

@spec set_pass(filter(), GenICMP.icmp_type()) :: filter()

Set a packet type to pass through the filter.

Link to this function

will_block?(filter, type)

View Source
@spec will_block?(filter(), GenICMP.icmp_type()) :: boolean()

Check if a packet type will be dropped by the filter.

Link to this function

will_pass?(filter, type)

View Source
@spec will_pass?(filter(), GenICMP.icmp_type()) :: boolean()

Check if a packet type will pass through the filter.