dhcpkit.ipv6.server.handlers.basic module

Basic handlers for options

class dhcpkit.ipv6.server.handlers.basic.CopyOptionHandler(option_class: Type, *, always_send: bool = False)[source]

Bases: dhcpkit.ipv6.server.handlers.Handler

This handler just copies a type of option from the request to the response

Parameters:
  • option_class – The option class to copy
  • always_send – Always send this option, even if the OptionRequestOption doesn’t ask for it
always_send = None

Whether an OptionRequestOption in the request should be ignored

handle(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Copy the option from the request to the response.

Parameters:bundle – The transaction bundle
option_class = None

The class of the option from the request to the response

class dhcpkit.ipv6.server.handlers.basic.OverwriteOptionHandler(option: dhcpkit.ipv6.options.Option, *, always_send: bool = False)[source]

Bases: dhcpkit.ipv6.server.handlers.Handler

Overwriting handler for simple static options.

Parameters:
  • option – The option instance to use
  • always_send – Always send this option, even if the OptionRequestOption doesn’t ask for it
always_send = None

Whether an OptionRequestOption in the request should be ignored

handle(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Overwrite the option in the response in the bundle.

Parameters:bundle – The transaction bundle
option = None

The option to add to the response

option_class = None

The class of the option

class dhcpkit.ipv6.server.handlers.basic.SimpleOptionHandler(option: dhcpkit.ipv6.options.Option, *, append: bool = False, always_send: bool = False)[source]

Bases: dhcpkit.ipv6.server.handlers.Handler

Standard handler for simple static options

Parameters:
  • option – The option instance to add to the response
  • append – Always add, even if an option of this class already exists
  • always_send – Always send this option, even if the OptionRequestOption doesn’t ask for it
always_send = None

Always send this option, even if the OptionRequestOption doesn’t ask for it

append = None

Always add, even if an option of this class already exists

combine(existing_options: Iterable) → Union[source]

If an option of this type already exists this method can combine the existing option with our own option to create a combined option.

Parameters:existing_options – The existing options
Returns:The combined option which will replace all existing options, or None to leave the existing options
handle(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Add the option to the response in the bundle.

Parameters:bundle – The transaction bundle
option = None

The option instance to add to the response

option_class = None

The class of the option