github.com/MerlinKodo/sing-tun@v0.1.15/internal/winipcfg/types_32.go (about)

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