Ground-Zerro / Phobos Public
Code Issues Pull requests Actions Releases View on GitHub ↗
11.8 KB go
// Code generated by 'go generate'; DO NOT EDIT.

package winipcfg

import (
	"syscall"
	"unsafe"

	"golang.org/x/sys/windows"
)

var _ unsafe.Pointer

// Do the interface allocations only once for common
// Errno values.
const (
	errnoERROR_IO_PENDING = 997
)

var (
	errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
	errERROR_EINVAL     error = syscall.EINVAL
)

// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e syscall.Errno) error {
	switch e {
	case 0:
		return errERROR_EINVAL
	case errnoERROR_IO_PENDING:
		return errERROR_IO_PENDING
	}
	// TODO: add more here, after collecting data on the common
	// error values see on Windows. (perhaps when running
	// all.bat?)
	return e
}

var (
	modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll")

	procCancelMibChangeNotify2          = modiphlpapi.NewProc("CancelMibChangeNotify2")
	procConvertInterfaceGuidToLuid      = modiphlpapi.NewProc("ConvertInterfaceGuidToLuid")
	procConvertInterfaceIndexToLuid     = modiphlpapi.NewProc("ConvertInterfaceIndexToLuid")
	procConvertInterfaceLuidToGuid      = modiphlpapi.NewProc("ConvertInterfaceLuidToGuid")
	procCreateAnycastIpAddressEntry     = modiphlpapi.NewProc("CreateAnycastIpAddressEntry")
	procCreateIpForwardEntry2           = modiphlpapi.NewProc("CreateIpForwardEntry2")
	procCreateUnicastIpAddressEntry     = modiphlpapi.NewProc("CreateUnicastIpAddressEntry")
	procDeleteAnycastIpAddressEntry     = modiphlpapi.NewProc("DeleteAnycastIpAddressEntry")
	procDeleteIpForwardEntry2           = modiphlpapi.NewProc("DeleteIpForwardEntry2")
	procDeleteUnicastIpAddressEntry     = modiphlpapi.NewProc("DeleteUnicastIpAddressEntry")
	procFreeMibTable                    = modiphlpapi.NewProc("FreeMibTable")
	procGetAnycastIpAddressEntry        = modiphlpapi.NewProc("GetAnycastIpAddressEntry")
	procGetAnycastIpAddressTable        = modiphlpapi.NewProc("GetAnycastIpAddressTable")
	procGetIfEntry2                     = modiphlpapi.NewProc("GetIfEntry2")
	procGetIfTable2Ex                   = modiphlpapi.NewProc("GetIfTable2Ex")
	procGetIpForwardEntry2              = modiphlpapi.NewProc("GetIpForwardEntry2")
	procGetIpForwardTable2              = modiphlpapi.NewProc("GetIpForwardTable2")
	procGetIpInterfaceEntry             = modiphlpapi.NewProc("GetIpInterfaceEntry")
	procGetIpInterfaceTable             = modiphlpapi.NewProc("GetIpInterfaceTable")
	procGetUnicastIpAddressEntry        = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
	procGetUnicastIpAddressTable        = modiphlpapi.NewProc("GetUnicastIpAddressTable")
	procInitializeIpForwardEntry        = modiphlpapi.NewProc("InitializeIpForwardEntry")
	procInitializeIpInterfaceEntry      = modiphlpapi.NewProc("InitializeIpInterfaceEntry")
	procInitializeUnicastIpAddressEntry = modiphlpapi.NewProc("InitializeUnicastIpAddressEntry")
	procNotifyIpInterfaceChange         = modiphlpapi.NewProc("NotifyIpInterfaceChange")
	procNotifyRouteChange2              = modiphlpapi.NewProc("NotifyRouteChange2")
	procNotifyUnicastIpAddressChange    = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
	procSetInterfaceDnsSettings         = modiphlpapi.NewProc("SetInterfaceDnsSettings")
	procSetIpForwardEntry2              = modiphlpapi.NewProc("SetIpForwardEntry2")
	procSetIpInterfaceEntry             = modiphlpapi.NewProc("SetIpInterfaceEntry")
	procSetUnicastIpAddressEntry        = modiphlpapi.NewProc("SetUnicastIpAddressEntry")
)

func cancelMibChangeNotify2(notificationHandle windows.Handle) (ret error) {
	r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func convertInterfaceGUIDToLUID(interfaceGUID *windows.GUID, interfaceLUID *LUID) (ret error) {
	r0, _, _ := syscall.SyscallN(procConvertInterfaceGuidToLuid.Addr(), uintptr(unsafe.Pointer(interfaceGUID)), uintptr(unsafe.Pointer(interfaceLUID)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func convertInterfaceIndexToLUID(interfaceIndex uint32, interfaceLUID *LUID) (ret error) {
	r0, _, _ := syscall.SyscallN(procConvertInterfaceIndexToLuid.Addr(), uintptr(interfaceIndex), uintptr(unsafe.Pointer(interfaceLUID)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func convertInterfaceLUIDToGUID(interfaceLUID *LUID, interfaceGUID *windows.GUID) (ret error) {
	r0, _, _ := syscall.SyscallN(procConvertInterfaceLuidToGuid.Addr(), uintptr(unsafe.Pointer(interfaceLUID)), uintptr(unsafe.Pointer(interfaceGUID)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func createAnycastIPAddressEntry(row *MibAnycastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procCreateAnycastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func createIPForwardEntry2(route *MibIPforwardRow2) (ret error) {
	r0, _, _ := syscall.SyscallN(procCreateIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(route)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func createUnicastIPAddressEntry(row *MibUnicastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procCreateUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func deleteAnycastIPAddressEntry(row *MibAnycastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procDeleteAnycastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func deleteIPForwardEntry2(route *MibIPforwardRow2) (ret error) {
	r0, _, _ := syscall.SyscallN(procDeleteIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(route)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func deleteUnicastIPAddressEntry(row *MibUnicastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procDeleteUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func freeMibTable(memory unsafe.Pointer) {
	syscall.SyscallN(procFreeMibTable.Addr(), uintptr(memory))
	return
}

func getAnycastIPAddressEntry(row *MibAnycastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetAnycastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getAnycastIPAddressTable(family AddressFamily, table **mibAnycastIPAddressTable) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetAnycastIpAddressTable.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIfEntry2(row *MibIfRow2) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIfEntry2.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIfTable2Ex(level MibIfEntryLevel, table **mibIfTable2) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIfTable2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(table)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIPForwardEntry2(route *MibIPforwardRow2) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(route)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIPForwardTable2(family AddressFamily, table **mibIPforwardTable2) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIpForwardTable2.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIPInterfaceEntry(row *MibIPInterfaceRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIpInterfaceEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getIPInterfaceTable(family AddressFamily, table **mibIPInterfaceTable) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetIpInterfaceTable.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getUnicastIPAddressEntry(row *MibUnicastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func getUnicastIPAddressTable(family AddressFamily, table **mibUnicastIPAddressTable) (ret error) {
	r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressTable.Addr(), uintptr(family), uintptr(unsafe.Pointer(table)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func initializeIPForwardEntry(route *MibIPforwardRow2) {
	syscall.SyscallN(procInitializeIpForwardEntry.Addr(), uintptr(unsafe.Pointer(route)))
	return
}

func initializeIPInterfaceEntry(row *MibIPInterfaceRow) {
	syscall.SyscallN(procInitializeIpInterfaceEntry.Addr(), uintptr(unsafe.Pointer(row)))
	return
}

func initializeUnicastIPAddressEntry(row *MibUnicastIPAddressRow) {
	syscall.SyscallN(procInitializeUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	return
}

func notifyIPInterfaceChange(family AddressFamily, callback uintptr, callerContext uintptr, initialNotification bool, notificationHandle *windows.Handle) (ret error) {
	var _p0 uint32
	if initialNotification {
		_p0 = 1
	}
	r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func notifyRouteChange2(family AddressFamily, callback uintptr, callerContext uintptr, initialNotification bool, notificationHandle *windows.Handle) (ret error) {
	var _p0 uint32
	if initialNotification {
		_p0 = 1
	}
	r0, _, _ := syscall.SyscallN(procNotifyRouteChange2.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func notifyUnicastIPAddressChange(family AddressFamily, callback uintptr, callerContext uintptr, initialNotification bool, notificationHandle *windows.Handle) (ret error) {
	var _p0 uint32
	if initialNotification {
		_p0 = 1
	}
	r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setInterfaceDnsSettingsByPtr(guid *windows.GUID, settings *DnsInterfaceSettings) (ret error) {
	ret = procSetInterfaceDnsSettings.Find()
	if ret != nil {
		return
	}
	r0, _, _ := syscall.SyscallN(procSetInterfaceDnsSettings.Addr(), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(settings)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setInterfaceDnsSettingsByQwords(guid1 uintptr, guid2 uintptr, settings *DnsInterfaceSettings) (ret error) {
	ret = procSetInterfaceDnsSettings.Find()
	if ret != nil {
		return
	}
	r0, _, _ := syscall.SyscallN(procSetInterfaceDnsSettings.Addr(), uintptr(guid1), uintptr(guid2), uintptr(unsafe.Pointer(settings)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setInterfaceDnsSettingsByDwords(guid1 uintptr, guid2 uintptr, guid3 uintptr, guid4 uintptr, settings *DnsInterfaceSettings) (ret error) {
	ret = procSetInterfaceDnsSettings.Find()
	if ret != nil {
		return
	}
	r0, _, _ := syscall.SyscallN(procSetInterfaceDnsSettings.Addr(), uintptr(guid1), uintptr(guid2), uintptr(guid3), uintptr(guid4), uintptr(unsafe.Pointer(settings)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setIPForwardEntry2(route *MibIPforwardRow2) (ret error) {
	r0, _, _ := syscall.SyscallN(procSetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(route)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setIPInterfaceEntry(row *MibIPInterfaceRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procSetIpInterfaceEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}

func setUnicastIPAddressEntry(row *MibUnicastIPAddressRow) (ret error) {
	r0, _, _ := syscall.SyscallN(procSetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row)))
	if r0 != 0 {
		ret = syscall.Errno(r0)
	}
	return
}