dhcpsapi

package
v0.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var (
	ERROR_DHCP_SUBNET_NOT_PRESENT           = windows.Errno(20005)
	ERROR_DHCP_FO_SCOPE_NOT_IN_RELATIONSHIP = windows.Errno(20116)
)
View Source
var DHCP_SUBNET_STATE_NAMES = map[DHCP_SUBNET_STATE]string{
	DhcpSubnetEnabled:          "Enabled",
	DhcpSubnetDisabled:         "Disabled",
	DhcpSubnetEnabledSwitched:  "EnabledSwitched",
	DhcpSubnetDisabledSwitched: "DisabledSwitched",
	DhcpSubnetInvalidState:     "InvalidState",
}

Functions

func Load added in v0.32.0

func Load() error

Load checks that dhcpsapi.dll exports every function of this package. Call it in Build: a missing export panics on the first call otherwise.

Types

type DHCPV4Scope

type DHCPV4Scope struct {
	Name             string
	State            DHCP_SUBNET_STATE
	SuperScopeName   string
	SuperScopeNumber uint32
	ScopeIPAddress   net.IPNet

	AddressesFree                 float64
	AddressesFreeOnPartnerServer  float64
	AddressesFreeOnThisServer     float64
	AddressesInUse                float64
	AddressesInUseOnPartnerServer float64
	AddressesInUseOnThisServer    float64
	PendingOffers                 float64
	ReservedAddress               float64
}

func GetDHCPV4ScopeStatistics

func GetDHCPV4ScopeStatistics() ([]DHCPV4Scope, error)

GetDHCPV4ScopeStatistics returns the IPv4 scopes of the local DHCP server. A scope that fails is skipped and its error joined to the result, so the other scopes are still returned. A scope removed while the scopes are read is skipped without an error.

type DHCP_FAILOVER_STATISTICS

type DHCP_FAILOVER_STATISTICS struct {
	NumAddr          win32.DWORD
	AddrFree         win32.DWORD
	AddrInUse        win32.DWORD
	PartnerAddrFree  win32.DWORD
	ThisAddrFree     win32.DWORD
	PartnerAddrInUse win32.DWORD
	ThisAddrInUse    win32.DWORD
}

type DHCP_HOST_INFO

type DHCP_HOST_INFO struct {
	IpAddress   DHCP_IP_ADDRESS
	NetBiosName win32.LPWSTR
	HostName    win32.LPWSTR
}

type DHCP_IP_ADDRESS

type DHCP_IP_ADDRESS win32.DWORD

func (DHCP_IP_ADDRESS) IPv4

func (ip DHCP_IP_ADDRESS) IPv4() net.IP

type DHCP_IP_MASK

type DHCP_IP_MASK win32.DWORD

func (DHCP_IP_MASK) IPv4Mask

func (ip DHCP_IP_MASK) IPv4Mask() net.IPMask

type DHCP_MIB_INFO_V5

type DHCP_MIB_INFO_V5 struct {
	Discovers               win32.DWORD
	Offers                  win32.DWORD
	Requests                win32.DWORD
	Acks                    win32.DWORD
	Naks                    win32.DWORD
	Declines                win32.DWORD
	Releases                win32.DWORD
	ServerStartTime         win32.DATE_TIME
	QtnNumLeases            win32.DWORD
	QtnPctQtnLeases         win32.DWORD
	QtnProbationLeases      win32.DWORD
	QtnNonQtnLeases         win32.DWORD
	QtnExemptLeases         win32.DWORD
	QtnCapableClients       win32.DWORD
	QtnIASErrors            win32.DWORD
	DelayedOffers           win32.DWORD
	ScopesWithDelayedOffers win32.DWORD
	Scopes                  win32.DWORD
	ScopeInfo               *DHCP_SUBNET_MIB_INFO_V5
}

type DHCP_SUBNET_INFO

type DHCP_SUBNET_INFO struct {
	SubnetAddress DHCP_IP_ADDRESS
	SubnetMask    DHCP_IP_MASK
	SubnetName    win32.LPWSTR
	SubnetComment win32.LPWSTR
	PrimaryHost   DHCP_HOST_INFO
	SubnetState   DHCP_SUBNET_STATE
}

DHCP_SUBNET_INFO https://learn.microsoft.com/de-de/windows/win32/api/dhcpsapi/ns-dhcpsapi-dhcp_subnet_info

type DHCP_SUBNET_MIB_INFO_V5

type DHCP_SUBNET_MIB_INFO_V5 struct {
	Subnet            DHCP_IP_ADDRESS
	NumAddressesInUse win32.DWORD
	NumAddressesFree  win32.DWORD
	NumPendingOffers  win32.DWORD
}

type DHCP_SUBNET_STATE

type DHCP_SUBNET_STATE uint32

DHCP_SUBNET_STATE https://learn.microsoft.com/de-de/windows/win32/api/dhcpsapi/ne-dhcpsapi-dhcp_subnet_state

const (
	DhcpSubnetEnabled          DHCP_SUBNET_STATE = 0
	DhcpSubnetDisabled         DHCP_SUBNET_STATE = 1
	DhcpSubnetEnabledSwitched  DHCP_SUBNET_STATE = 2
	DhcpSubnetDisabledSwitched DHCP_SUBNET_STATE = 3
	DhcpSubnetInvalidState     DHCP_SUBNET_STATE = 4
)

type DHCP_SUPER_SCOPE_TABLE

type DHCP_SUPER_SCOPE_TABLE struct {
	Count   win32.DWORD
	Entries *DHCP_SUPER_SCOPE_TABLE_ENTRY
}

type DHCP_SUPER_SCOPE_TABLE_ENTRY

type DHCP_SUPER_SCOPE_TABLE_ENTRY struct {
	SubnetAddress    DHCP_IP_ADDRESS
	SuperScopeNumber win32.DWORD
	NextInSuperScope win32.DWORD
	SuperScopeName   win32.LPWSTR
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL