File: handler.go

package info (click to toggle)
golang-github-coredhcp-coredhcp 0.0.0%2Bgit.20220602.a2552c5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 564 kB
  • sloc: makefile: 8; sh: 6
file content (23 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2018-present the CoreDHCP Authors. All rights reserved
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

package handler

import (
	"github.com/insomniacslk/dhcp/dhcpv4"
	"github.com/insomniacslk/dhcp/dhcpv6"
)

// Handler6 is a function that is called on a given DHCPv6 packet.
// It returns a DHCPv6 packet and a boolean.
// If the boolean is true, this will be the last handler to be called.
// The two input packets are the original request, and a response packet.
// The response packet may or may not be modified by the function, and
// the result will be returned by the handler.
// If the returned boolean is true, the returned packet may be nil or
// invalid, in which case no response will be sent.
type Handler6 func(req, resp dhcpv6.DHCPv6) (dhcpv6.DHCPv6, bool)

// Handler4 behaves like Handler6, but for DHCPv4 packets.
type Handler4 func(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool)