dhcpkit.ipv6.server.transaction_bundle module¶
An object to hold everything related to a request/response transaction
-
class
dhcpkit.ipv6.server.transaction_bundle.
MessagesList
(first_message: dhcpkit.ipv6.messages.ClientServerMessage = None, subsequent_messages: Iterator = None)[source]¶ Bases:
object
A weird iterator wrapper. This allows handlers to manipulate the first message while not needing to load all of the subsequent messages in memory.
-
class
dhcpkit.ipv6.server.transaction_bundle.
TransactionBundle
(incoming_message: dhcpkit.ipv6.messages.Message, received_over_multicast: bool, received_over_tcp: bool = False, allow_rapid_commit: bool = False, marks: Iterable = None)[source]¶ Bases:
object
A bundle with all data about a transaction. This makes it much easier to pass around multiple pieces of information.
-
allow_rapid_commit
= None¶ Allow rapid commit? May be set to True on creation, may be set to False by handlers, not vice versa
-
allow_unicast
= None¶ Allow the client use unicast to contact the server. Set to True by handlers
-
create_outgoing_relay_messages
()[source]¶ Create a plain chain of RelayReplyMessages for the current response
-
get_unhandled_options
(option_types: Type) → List[source]¶ Get a list of all Options in the request that haven’t been marked as handled
Returns: The list of unanswered Options
-
handled_options
= None¶ A list of options from the request that have been handled, only applies to IA type options
-
handler_data
= None¶ A place for handlers to store data related to this transaction
-
incoming_message
= None¶ The incoming message including the relay chain
-
incoming_relay_messages
= None¶ The chain of relay messages starting with the one closest to the client
-
link_address
¶ Find the link address that identifies where this request is coming from. For TCP connections we use the remote endpoint of the connection instead.
-
mark_handled
(option: dhcpkit.ipv6.options.Option)[source]¶ Mark the given option as handled. Not all options are specifically handled. This is mostly useful for options like IANAOption, IATAOption and IAPDOption.
Parameters: option – The option to mark as handled
-
marks
= None¶ A set of marks that have been applied to this message
-
outgoing_message
¶ Wrap the response in a relay chain if necessary. Only works when there is a single response.
-
outgoing_messages
¶ Wrap the responses in a relay chain if necessary and iterate over them.
Warning
Be careful when iterating over outgoing messages. When iterating over multiple responses the original relay messages will be updated to contain the next response when proceeding the the next one!
-
outgoing_relay_messages
= None¶ This is where the user puts the reply relay chain by calling
create_outgoing_relay_messages()
-
received_over_multicast
= None¶ A flag indicating whether the client used multicast to contact the server
-
received_over_tcp
= None¶ A flag indicating whether the client used TCP to contact the server
-
relays
¶ Get a list of all the relays that this message went through
-
request
= None¶ The incoming request without the relay messages
-
response
¶ Backwards-compatibility handling for when we only supported one response. TCP connections can support more than one response, but for normal DHCPv6 a single response is all we need is a single one, so make this use-case easy and backwards-compatible.
Returns: The first response
-
responses
= None¶ This is where we keep our responses, potentially more than one
-