From 4c7077ec60eeb233fdff4640ef2286500c7689a7 Mon Sep 17 00:00:00 2001 From: database64128 Date: Mon, 29 Jul 2024 06:53:55 +0000 Subject: [PATCH] windows: add enums for IpAdapterUnicastAddress These are for the enum fields in IpAdapterUnicastAddress. Change-Id: Ibcb6ce674ab41a94dbe46d394f035208a94b6dae GitHub-Last-Rev: 1837ff9c32357fe7eb64257001b9bf42485b1c8c GitHub-Pull-Request: golang/sys#204 Reviewed-on: https://go-review.googlesource.com/c/sys/+/598895 LUCI-TryBot-Result: Go LUCI Reviewed-by: Alex Brainman Reviewed-by: Michael Knyszek Reviewed-by: David Chase --- windows/types_windows.go | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/windows/types_windows.go b/windows/types_windows.go index 4d0c15745..3f03b3d57 100644 --- a/windows/types_windows.go +++ b/windows/types_windows.go @@ -2031,6 +2031,50 @@ const ( IF_TYPE_IEEE1394 = 144 ) +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + type SocketAddress struct { Sockaddr *syscall.RawSockaddrAny SockaddrLength int32