handler.go 993 B

1234567891011121314151617181920212223
  1. // Copyright 2018-present the CoreDHCP Authors. All rights reserved
  2. // This source code is licensed under the MIT license found in the
  3. // LICENSE file in the root directory of this source tree.
  4. package handler
  5. import (
  6. "github.com/insomniacslk/dhcp/dhcpv4"
  7. "github.com/insomniacslk/dhcp/dhcpv6"
  8. )
  9. // Handler6 is a function that is called on a given DHCPv6 packet.
  10. // It returns a DHCPv6 packet and a boolean.
  11. // If the boolean is true, this will be the last handler to be called.
  12. // The two input packets are the original request, and a response packet.
  13. // The response packet may or may not be modified by the function, and
  14. // the result will be returned by the handler.
  15. // If the returned boolean is true, the returned packet may be nil or
  16. // invalid, in which case no response will be sent.
  17. type Handler6 func(req, resp dhcpv6.DHCPv6) (dhcpv6.DHCPv6, bool)
  18. // Handler4 behaves like Handler6, but for DHCPv4 packets.
  19. type Handler4 func(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool)