dhcpkit.ipv6.server.message_handler module

The code to handle a message

class dhcpkit.ipv6.server.message_handler.MessageHandler(server_id: dhcpkit.ipv6.duids.DUID, sub_filters: Iterable = None, sub_handlers: Iterable = None, allow_rapid_commit: bool = False, rapid_commit_rejections: bool = False)[source]

Bases: object

Message processing class

construct_leasequery_status_reply(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle, option: dhcpkit.ipv6.options.StatusCodeOption) → dhcpkit.ipv6.extensions.leasequery.LeasequeryReplyMessage[source]

Construct a leasequery reply message signalling a status code to the client.

Parameters:
  • bundle – The transaction bundle containing the incoming request
  • option – The status code option to include in the reply
Returns:

A leasequery reply with only the bare necessities and a status code

construct_plain_status_reply(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle, option: dhcpkit.ipv6.options.StatusCodeOption) → dhcpkit.ipv6.messages.ReplyMessage[source]

Construct a reply message signalling a status code to the client.

Parameters:
  • bundle – The transaction bundle containing the incoming request
  • option – The status code option to include in the reply
Returns:

A reply with only the bare necessities and a status code

construct_use_multicast_reply(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle) → Union[source]

Construct a message signalling to the client that they should have used multicast.

Parameters:bundle – The transaction bundle containing the incoming request
Returns:The proper answer to tell a client to use multicast
static get_cleanup_handlers() → List[source]

Build a list of cleanup handlers and cache it

Returns:The list of handlers
get_handlers(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle) → List[source]

Get all handlers that are going to be applied to the request in the bundle.

Parameters:bundle – The transaction bundle
Returns:The list of handlers to apply
get_setup_handlers() → List[source]

Build a list of setup handlers and cache it

Returns:The list of handlers
handle(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle, statistics: dhcpkit.ipv6.server.statistics.StatisticsSet)[source]

The main dispatcher for incoming messages.

Parameters:
  • bundle – The transaction bundle
  • statistics – Container for shared memory with statistics counters
static init_response(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Create the message object in bundle.response

Parameters:bundle – The transaction bundle
worker_init()[source]

Separate initialisation that will be called in each worker process that is created. Things that can’t be forked (think database connections etc) have to be initialised here.