github.com/apernet/sing-tun@v0.2.6-0.20240323130332-b9f6511036ad/internal/winipcfg/types_64.go (about)

     1  //go:build amd64 || arm64
     2  
     3  /* SPDX-License-Identifier: MIT
     4   *
     5   * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved.
     6   */
     7  
     8  package winipcfg
     9  
    10  import (
    11  	"golang.org/x/sys/windows"
    12  )
    13  
    14  // IPAdapterWINSServerAddress structure stores a single Windows Internet Name Service (WINS) server address in a linked list of WINS server addresses for a particular adapter.
    15  // https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_wins_server_address_lh
    16  type IPAdapterWINSServerAddress struct {
    17  	Length  uint32
    18  	_       uint32
    19  	Next    *IPAdapterWINSServerAddress
    20  	Address windows.SocketAddress
    21  }
    22  
    23  // IPAdapterGatewayAddress structure stores a single gateway address in a linked list of gateway addresses for a particular adapter.
    24  // https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_gateway_address_lh
    25  type IPAdapterGatewayAddress struct {
    26  	Length  uint32
    27  	_       uint32
    28  	Next    *IPAdapterGatewayAddress
    29  	Address windows.SocketAddress
    30  }
    31  
    32  // IPAdapterAddresses structure is the header node for a linked list of addresses for a particular adapter. This structure can simultaneously be used as part of a linked list of IP_ADAPTER_ADDRESSES structures.
    33  // https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_addresses_lh
    34  // This is a modified and extended version of windows.IpAdapterAddresses.
    35  type IPAdapterAddresses struct {
    36  	Length                 uint32
    37  	IfIndex                uint32
    38  	Next                   *IPAdapterAddresses
    39  	adapterName            *byte
    40  	FirstUnicastAddress    *windows.IpAdapterUnicastAddress
    41  	FirstAnycastAddress    *windows.IpAdapterAnycastAddress
    42  	FirstMulticastAddress  *windows.IpAdapterMulticastAddress
    43  	FirstDNSServerAddress  *windows.IpAdapterDnsServerAdapter
    44  	dnsSuffix              *uint16
    45  	description            *uint16
    46  	friendlyName           *uint16
    47  	physicalAddress        [windows.MAX_ADAPTER_ADDRESS_LENGTH]byte
    48  	physicalAddressLength  uint32
    49  	Flags                  IPAAFlags
    50  	MTU                    uint32
    51  	IfType                 IfType
    52  	OperStatus             IfOperStatus
    53  	IPv6IfIndex            uint32
    54  	ZoneIndices            [16]uint32
    55  	FirstPrefix            *windows.IpAdapterPrefix
    56  	TransmitLinkSpeed      uint64
    57  	ReceiveLinkSpeed       uint64
    58  	FirstWINSServerAddress *IPAdapterWINSServerAddress
    59  	FirstGatewayAddress    *IPAdapterGatewayAddress
    60  	Ipv4Metric             uint32
    61  	Ipv6Metric             uint32
    62  	LUID                   LUID
    63  	DHCPv4Server           windows.SocketAddress
    64  	CompartmentID          uint32
    65  	NetworkGUID            windows.GUID
    66  	ConnectionType         NetIfConnectionType
    67  	TunnelType             TunnelType
    68  	DHCPv6Server           windows.SocketAddress
    69  	dhcpv6ClientDUID       [maxDHCPv6DUIDLength]byte
    70  	dhcpv6ClientDUIDLength uint32
    71  	DHCPv6IAID             uint32
    72  	FirstDNSSuffix         *IPAdapterDNSSuffix
    73  }
    74  
    75  // MibIPInterfaceRow structure stores interface management information for a particular IP address family on a network interface.
    76  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_ipinterface_row
    77  type MibIPInterfaceRow struct {
    78  	Family                               AddressFamily
    79  	InterfaceLUID                        LUID
    80  	InterfaceIndex                       uint32
    81  	MaxReassemblySize                    uint32
    82  	InterfaceIdentifier                  uint64
    83  	MinRouterAdvertisementInterval       uint32
    84  	MaxRouterAdvertisementInterval       uint32
    85  	AdvertisingEnabled                   bool
    86  	ForwardingEnabled                    bool
    87  	WeakHostSend                         bool
    88  	WeakHostReceive                      bool
    89  	UseAutomaticMetric                   bool
    90  	UseNeighborUnreachabilityDetection   bool
    91  	ManagedAddressConfigurationSupported bool
    92  	OtherStatefulConfigurationSupported  bool
    93  	AdvertiseDefaultRoute                bool
    94  	RouterDiscoveryBehavior              RouterDiscoveryBehavior
    95  	DadTransmits                         uint32
    96  	BaseReachableTime                    uint32
    97  	RetransmitTime                       uint32
    98  	PathMTUDiscoveryTimeout              uint32
    99  	LinkLocalAddressBehavior             LinkLocalAddressBehavior
   100  	LinkLocalAddressTimeout              uint32
   101  	ZoneIndices                          [ScopeLevelCount]uint32
   102  	SitePrefixLength                     uint32
   103  	Metric                               uint32
   104  	NLMTU                                uint32
   105  	Connected                            bool
   106  	SupportsWakeUpPatterns               bool
   107  	SupportsNeighborDiscovery            bool
   108  	SupportsRouterDiscovery              bool
   109  	ReachableTime                        uint32
   110  	TransmitOffload                      OffloadRod
   111  	ReceiveOffload                       OffloadRod
   112  	DisableDefaultRoutes                 bool
   113  }
   114  
   115  // mibIPInterfaceTable structure contains a table of IP interface entries.
   116  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_ipinterface_table
   117  type mibIPInterfaceTable struct {
   118  	numEntries uint32
   119  	table      [anySize]MibIPInterfaceRow
   120  }
   121  
   122  // MibIfRow2 structure stores information about a particular interface.
   123  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_if_row2
   124  type MibIfRow2 struct {
   125  	InterfaceLUID               LUID
   126  	InterfaceIndex              uint32
   127  	InterfaceGUID               windows.GUID
   128  	alias                       [ifMaxStringSize + 1]uint16
   129  	description                 [ifMaxStringSize + 1]uint16
   130  	physicalAddressLength       uint32
   131  	physicalAddress             [ifMaxPhysAddressLength]byte
   132  	permanentPhysicalAddress    [ifMaxPhysAddressLength]byte
   133  	MTU                         uint32
   134  	Type                        IfType
   135  	TunnelType                  TunnelType
   136  	MediaType                   NdisMedium
   137  	PhysicalMediumType          NdisPhysicalMedium
   138  	AccessType                  NetIfAccessType
   139  	DirectionType               NetIfDirectionType
   140  	InterfaceAndOperStatusFlags InterfaceAndOperStatusFlags
   141  	OperStatus                  IfOperStatus
   142  	AdminStatus                 NetIfAdminStatus
   143  	MediaConnectState           NetIfMediaConnectState
   144  	NetworkGUID                 windows.GUID
   145  	ConnectionType              NetIfConnectionType
   146  	TransmitLinkSpeed           uint64
   147  	ReceiveLinkSpeed            uint64
   148  	InOctets                    uint64
   149  	InUcastPkts                 uint64
   150  	InNUcastPkts                uint64
   151  	InDiscards                  uint64
   152  	InErrors                    uint64
   153  	InUnknownProtos             uint64
   154  	InUcastOctets               uint64
   155  	InMulticastOctets           uint64
   156  	InBroadcastOctets           uint64
   157  	OutOctets                   uint64
   158  	OutUcastPkts                uint64
   159  	OutNUcastPkts               uint64
   160  	OutDiscards                 uint64
   161  	OutErrors                   uint64
   162  	OutUcastOctets              uint64
   163  	OutMulticastOctets          uint64
   164  	OutBroadcastOctets          uint64
   165  	OutQLen                     uint64
   166  }
   167  
   168  // mibIfTable2 structure contains a table of logical and physical interface entries.
   169  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_if_table2
   170  type mibIfTable2 struct {
   171  	numEntries uint32
   172  	table      [anySize]MibIfRow2
   173  }
   174  
   175  // MibUnicastIPAddressRow structure stores information about a unicast IP address.
   176  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_unicastipaddress_row
   177  type MibUnicastIPAddressRow struct {
   178  	Address            RawSockaddrInet
   179  	InterfaceLUID      LUID
   180  	InterfaceIndex     uint32
   181  	PrefixOrigin       PrefixOrigin
   182  	SuffixOrigin       SuffixOrigin
   183  	ValidLifetime      uint32
   184  	PreferredLifetime  uint32
   185  	OnLinkPrefixLength uint8
   186  	SkipAsSource       bool
   187  	DadState           DadState
   188  	ScopeID            uint32
   189  	CreationTimeStamp  int64
   190  }
   191  
   192  // mibUnicastIPAddressTable structure contains a table of unicast IP address entries.
   193  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_unicastipaddress_table
   194  type mibUnicastIPAddressTable struct {
   195  	numEntries uint32
   196  	table      [anySize]MibUnicastIPAddressRow
   197  }
   198  
   199  // MibAnycastIPAddressRow structure stores information about an anycast IP address.
   200  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_anycastipaddress_row
   201  type MibAnycastIPAddressRow struct {
   202  	Address        RawSockaddrInet
   203  	InterfaceLUID  LUID
   204  	InterfaceIndex uint32
   205  	ScopeID        uint32
   206  }
   207  
   208  // mibAnycastIPAddressTable structure contains a table of anycast IP address entries.
   209  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-mib_anycastipaddress_table
   210  type mibAnycastIPAddressTable struct {
   211  	numEntries uint32
   212  	table      [anySize]MibAnycastIPAddressRow
   213  }
   214  
   215  // mibIPforwardTable2 structure contains a table of IP route entries.
   216  // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_ipforward_table2
   217  type mibIPforwardTable2 struct {
   218  	numEntries uint32
   219  	table      [anySize]MibIPforwardRow2
   220  }