diff --git a/PInvoke/Ws2_32/ws2ipdef.cs b/PInvoke/Ws2_32/ws2ipdef.cs index ff8947ff..f5455125 100644 --- a/PInvoke/Ws2_32/ws2ipdef.cs +++ b/PInvoke/Ws2_32/ws2ipdef.cs @@ -2,6 +2,7 @@ using System; using System.Runtime.InteropServices; using Vanara.Extensions; using Vanara.InteropServices; +using static Vanara.PInvoke.Ws2_32; #pragma warning disable IDE1006 // Naming Styles namespace Vanara.PInvoke; @@ -87,17 +88,198 @@ public static partial class Ws2_32 /// public static readonly uint SIOCSMSFILTER = _IOW('t', 126, typeof(uint)); + /// IPPROTO_IPV6 socket options + [PInvokeData("ws2ipdef.h")] + public enum IPV6 + { + /// Adds an interface index to the IFLIST associated with the IP_IFLIST option. + [CorrespondingType(typeof(uint))] + IPV6_ADD_IFLIST = 29, + /// + /// Join the socket to the supplied multicast group on the specified interface. This option is only valid on datagram and raw sockets + /// (the socket type must be SOCK_DGRAM or SOCK_RAW). + /// + //[CorrespondingType(typeof(ipv6_mreq))] + IPV6_ADD_MEMBERSHIP = 12, + /// + IPV6_CHECKSUM = 26, + /// + /// Removes an interface index from the IFLIST associated with the IP_IFLIST option. Entries can be removed only by the application, + /// so be aware that entries might go stale once an interface is removed. + /// + [CorrespondingType(typeof(uint))] + IPV6_DEL_IFLIST = 30, + /// Don't fragment IP datagrams. + IPV6_DONTFRAG = 14, + /// + /// Leave the supplied multicast group from the given interface. This option is only valid on datagram and raw sockets (the socket + /// type must be SOCK_DGRAM or SOCK_RAW). + /// + //[CorrespondingType(typeof(ipv6_mreq))] + IPV6_DROP_MEMBERSHIP = 13, + /// + IPV6_ECN = 50, + /// Gets the current IFLIST associated with the IP_IFLIST option. Returns error if IP_IFLIST is not enabled. + [CorrespondingType(typeof(uint[]))] + IPV6_GET_IFLIST = 33, + /// + /// Indicates the application provides the IPv6 header on all outgoing data. If the optval parameter is set to 1 on the call to + /// setsockopt, the option is enabled. If optval is set to 0, the option is disabled. The default value is disabled. This option is + /// only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW). A TCP/IP service provider that supports + /// SOCK_RAW should also support IPV6_HDRINCL. + /// + [CorrespondingType(typeof(BOOL))] + IPV6_HDRINCL = 2, + /// + /// Indicates that hop (TTL) information should be returned in the LPFN_WSARECVMSG (WSARecvMsg) function. If optval is set to 1 on + /// the call to setsockopt, the option is enabled. If set to 0, the option is disabled. This option is only valid for datagram and + /// raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW). + /// + [CorrespondingType(typeof(BOOL))] + IPV6_HOPLIMIT = 21, + /// + IPV6_HOPOPTS = 1, + /// + /// Gets or sets the IP_IFLIST state of the socket. When this option is set to true, Datagram reception is restricted to interfaces + /// that are in the IFLIST. Datagrams received on any other interfaces are ignored. IFLIST starts empty. Use IP_ADD_IFLIST and + /// IP_DEL_IFLIST to edit the IFLIST. + /// + [CorrespondingType(typeof(BOOL))] + IPV6_IFLIST = 28, + /// Same as IPV6_ADD_MEMBERSHIP + IPV6_JOIN_GROUP = IPV6_ADD_MEMBERSHIP, + /// Same as IPV6_DROP_MEMBERSHIP + IPV6_LEAVE_GROUP = IPV6_DROP_MEMBERSHIP, + /// Gets the system's estimate of the path MTU. Socket must be connected. + [CorrespondingType(typeof(uint))] + IPV6_MTU = 72, + /// + /// Gets or sets the path MTU discovery state for the socket. The default value is IP_PMTUDISC_NOT_SET. For stream sockets, + /// IP_PMTUDISC_NOT_SET and IP_PMTUDISC_DO will perform path MTU discovery. IP_PMTUDISC_DONT and IP_PMTUDISC_PROBE will turn off path + /// MTU discovery. For datagram sockets, if set to IP_PMTUDISC_DO , attempts to send packets larger than path MTU will result in an + /// error. If set to IP_PMTUDISC_DONT, packets will be fragmented according to interface MTU. If set to IP_PMTUDISC_PROBE, attempts + /// to send packets larger than interface MTU will result in an error. + /// + [CorrespondingType(typeof(uint))] + IPV6_MTU_DISCOVER = 71, + /// + /// Gets or sets the TTL value associated with IPv6 multicast traffic on the socket. It is illegal to set the TTL to a value greater + /// than 255. This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW). + /// + [CorrespondingType(typeof(uint))] + IPV6_MULTICAST_HOPS = 10, + /// + /// Gets or sets the outgoing interface for sending IPv6 multicast traffic. This option does not change the default interface for + /// receiving IPv6 multicast traffic. This option is important for multihomed computers. The input value for setting this option is a + /// 4-byte interface index of the desired outgoing interface in host byte order. The GetAdaptersAddresses function can be used to + /// obtain the interface index information. If optval is set to NULL on call to setsockopt, the default IPv6 interface is used. If + /// optval is zero , the default interface for receiving multicast is specified for sending multicast traffic. When getting this + /// option, the optval returns the current default interface index for sending multicast IPv6 traffic in host byte order. + /// + [CorrespondingType(typeof(uint))] + IPV6_MULTICAST_IF = 9, + /// + /// Indicates multicast data sent on the socket will be echoed to the sockets receive buffer if it is also joined on the destination + /// multicast group. If optval is set to 1 on the call to setsockopt, the option is enabled. If set to 0, the option is disabled. + /// This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW). + /// + [CorrespondingType(typeof(BOOL))] + IPV6_MULTICAST_LOOP = 11, + /// + IPV6_NRT_INTERFACE = 74, + /// Indicates that packet information should be returned by the LPFN_WSARECVMSG (WSARecvMsg) function. + [CorrespondingType(typeof(BOOL))] + IPV6_PKTINFO = 19, + /// + IPV6_PKTINFO_EX = 51, + /// + /// Enables restriction of a socket to a specified scope, such as addresses with the same link local or site local prefix. Provides + /// various restriction levels and default settings. See IPV6_PROTECTION_LEVEL for more information. + /// + [CorrespondingType(typeof(int))] + IPV6_PROTECTION_LEVEL = 23, + /// + IPV6_RECVDSTADDR = 25, + /// + IPV6_RECVECN = 50, + /// + IPV6_RECVERR = 75, + /// + /// Indicates whether the IP stack should populate the control buffer with details about which interface received a packet with a + /// datagram socket. When this value is true, the LPFN_WSARECVMSG (WSARecvMsg) function will return optional control data containing + /// the interface where the packet was received for datagram sockets. This option allows the IPv6 interface where the packet was + /// received to be returned in the WSAMSG structure. This option is only valid for datagram and raw sockets (the socket type must be + /// SOCK_DGRAM or SOCK_RAW). + /// + [CorrespondingType(typeof(BOOL))] + IPV6_RECVIF = 24, + /// + IPV6_RECVRTHDR = 38, + /// + /// Indicates whether the IP stack should populate the control buffer with a message containing the Traffic Class IPv6 header field + /// on a received datagram. When this value is true, the LPFN_WSARECVMSG (WSARecvMsg) function will return optional control data + /// containing the Traffic Class IPv6 header field value of the received datagram. This option allows the Traffic Class IPv6 header + /// field of the received datagram to be returned in the WSAMSG structure. The returned message type will be IPV6_TCLASS. All DSCP + /// and ECN bits of the Traffic Class field will be returned. This option is only valid on datagram sockets (the socket type must be SOCK_DGRAM). + /// + [CorrespondingType(typeof(BOOL))] + IPV6_RECVTCLASS = 40, + /// + IPV6_RTHDR = 32, + /// + IPV6_TCLASS = 39, + /// + /// Gets or sets the current TTL value associated with IPv6 socket for unicast traffic. It is illegal to set the TTL to a value + /// greater than 255. + /// + [CorrespondingType(typeof(uint))] + IPV6_UNICAST_HOPS = 4, + /// + /// Gets or sets the outgoing interface for sending IPv6 traffic. This option does not change the default interface for receiving + /// IPv6 traffic. This option is important for multihomed computers. The input value for setting this option is a 4-byte interface + /// index of the desired outgoing interface in host byte order. The GetAdaptersAddresses function can be used to obtain the interface + /// index information. If optval is zero, the default interface for sending IPv6 traffic is set to unspecified. When getting this + /// option, the optval returns the current default interface index for sending IPv6 traffic in host byte order. + /// + [CorrespondingType(typeof(uint))] + IPV6_UNICAST_IF = 31, + /// + /// Gets or sets an upper bound on the IP layer MTU (in bytes) for the given socket. If the value is higher than the system's + /// estimate of the path MTU (which you can retrieve on a connected socket by querying the IPV6_MTU socket option), then the option + /// has no effect. If the value is lower, then outbound packets larger than this will be fragmented, or will fail to send, depending + /// on the value of IPV6_DONTFRAG. Default value is IP_UNSPECIFIED_USER_MTU (MAXULONG). For type-safety, you should use the + /// WSAGetIPUserMtu and WSASetIPUserMtu functions instead of using the socket option directly. + /// + [CorrespondingType(typeof(uint))] + IPV6_USER_MTU = 76, + /// + /// Indicates if a socket created for the AF_INET6 address family is restricted to IPv6 communications only. Sockets created for the + /// AF_INET6 address family may be used for both IPv6 and IPv4 communications. Some applications may want to restrict their use of a + /// socket created for the AF_INET6 address family to IPv6 communications only. When this value is nonzero (the default on Windows), + /// a socket created for the AF_INET6 address family can be used to send and receive IPv6 packets only. When this value is zero, a + /// socket created for the AF_INET6 address family can be used to send and receive packets to and from an IPv6 address or an IPv4 + /// address. Note that the ability to interact with an IPv4 address requires the use of IPv4 mapped addresses. This socket option is + /// supported on Windows Vista or later. + /// + [CorrespondingType(typeof(BOOL))] + IPV6_V6ONLY = 27, + /// + IPV6_WFP_REDIRECT_CONTEXT = 70, + /// + IPV6_WFP_REDIRECT_RECORDS = 60, + } + /// The MULTICAST_MODE_TYPE enumeration specifies the filter mode for multicast group addresses. /// /// This enumeration is supported on Windows Vistaand later. /// - /// The MULTICAST_MODE_TYPE enumeration is used in the gf_fmode member of the GROUP_SOURCE_REQ structure to determine - /// if a list of IP addresses should included or excluded. The values from this enumeration can also be used in the - /// imsf_fmode member of the ip_msfilter structure. + /// The MULTICAST_MODE_TYPE enumeration is used in the gf_fmode member of the GROUP_SOURCE_REQ structure to determine if a + /// list of IP addresses should included or excluded. The values from this enumeration can also be used in the imsf_fmode member + /// of the ip_msfilter structure. /// /// - /// The MULTICAST_MODE_TYPE enumeration is defined in the Ws2ipdef.h header file which is automatically included in the - /// Ws2tcpip.h header file. The Ws2ipdef.h header files should never be used directly. + /// The MULTICAST_MODE_TYPE enumeration is defined in the Ws2ipdef.h header file which is automatically included in the Ws2tcpip.h + /// header file. The Ws2ipdef.h header files should never be used directly. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/ws2ipdef/ne-ws2ipdef-multicast_mode_type typedef enum { MCAST_INCLUDE,