Added some winsock2 functions

pull/47/head
David Hall 2019-02-20 10:50:17 -07:00
parent db5edfa2aa
commit f3d5187ef5
6 changed files with 3301 additions and 17 deletions

View File

@ -94,5 +94,8 @@
/// <summary>The win inet</summary>
public const string WinInet = "wininet.dll";
/// <summary>The Winsock2 dll</summary>
public const string Ws2_32 = "ws2_32.dll";
}
}

View File

@ -1,11 +1,11 @@
## Correlation report for Ws2_32.dll
### Methods (0% complete)
### Methods (5% complete)
Native Method | Native DLL | Header | Managed Method
--- | --- | --- | ---
[__WSAFDIsSet](https://www.google.com/search?num=5&q=__WSAFDIsSet+site%3Amicrosoft.com) | Ws2_32.dll | |
[accept](https://www.google.com/search?num=5&q=accept+site%3Amicrosoft.com) | Ws2_32.dll | |
[bind](https://www.google.com/search?num=5&q=bind+site%3Amicrosoft.com) | Ws2_32.dll | |
[closesocket](https://www.google.com/search?num=5&q=closesocket+site%3Amicrosoft.com) | Ws2_32.dll | |
[bind](http://msdn2.microsoft.com/en-us/library/3a651daa-7404-4ef7-8cff-0d3dff41a8e8) | Ws2_32.dll | winsock.h | Vanara.PInvoke.Ws2_32.bind
[closesocket](http://msdn2.microsoft.com/en-us/library/2f357aa8-389b-4c92-8a9f-289e048cc41c) | Ws2_32.dll | winsock.h | Vanara.PInvoke.Ws2_32.closesocket
[connect](https://www.google.com/search?num=5&q=connect+site%3Amicrosoft.com) | Ws2_32.dll | |
[freeaddrinfo](https://www.google.com/search?num=5&q=freeaddrinfo+site%3Amicrosoft.com) | Ws2_32.dll | |
[FreeAddrInfoEx](https://www.google.com/search?num=5&q=FreeAddrInfoEx+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -31,13 +31,13 @@ Native Method | Native DLL | Header | Managed Method
[htonl](https://www.google.com/search?num=5&q=htonl+site%3Amicrosoft.com) | Ws2_32.dll | |
[htons](https://www.google.com/search?num=5&q=htons+site%3Amicrosoft.com) | Ws2_32.dll | |
[inet_addr](https://www.google.com/search?num=5&q=inet_addr+site%3Amicrosoft.com) | Ws2_32.dll | |
[inet_ntoa](https://www.google.com/search?num=5&q=inet_ntoa+site%3Amicrosoft.com) | Ws2_32.dll | |
[inet_ntoa](http://msdn2.microsoft.com/en-us/library/01cd32e7-a01d-40e8-afb5-69223d643a0e) | Ws2_32.dll | wsipv6ok.h | Vanara.PInvoke.Ws2_32.inet_ntoa
[inet_ntop](https://www.google.com/search?num=5&q=inet_ntop+site%3Amicrosoft.com) | Ws2_32.dll | |
[inet_pton](https://www.google.com/search?num=5&q=inet_pton+site%3Amicrosoft.com) | Ws2_32.dll | |
[InetNtopW](https://www.google.com/search?num=5&q=InetNtopW+site%3Amicrosoft.com) | Ws2_32.dll | |
[InetPtonW](https://www.google.com/search?num=5&q=InetPtonW+site%3Amicrosoft.com) | Ws2_32.dll | |
[ioctlsocket](https://www.google.com/search?num=5&q=ioctlsocket+site%3Amicrosoft.com) | Ws2_32.dll | |
[listen](https://www.google.com/search?num=5&q=listen+site%3Amicrosoft.com) | Ws2_32.dll | |
[listen](http://msdn2.microsoft.com/en-us/library/1233feeb-a8c1-49ac-ab34-82af224ecf00) | Ws2_32.dll | winsock2.h | Vanara.PInvoke.Ws2_32.listen
[ntohl](https://www.google.com/search?num=5&q=ntohl+site%3Amicrosoft.com) | Ws2_32.dll | |
[ntohs](https://www.google.com/search?num=5&q=ntohs+site%3Amicrosoft.com) | Ws2_32.dll | |
[recv](https://www.google.com/search?num=5&q=recv+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -48,7 +48,7 @@ Native Method | Native DLL | Header | Managed Method
[SetAddrInfoEx](https://www.google.com/search?num=5&q=SetAddrInfoExA+site%3Amicrosoft.com) | Ws2_32.dll | |
[setsockopt](https://www.google.com/search?num=5&q=setsockopt+site%3Amicrosoft.com) | Ws2_32.dll | |
[shutdown](https://www.google.com/search?num=5&q=shutdown+site%3Amicrosoft.com) | Ws2_32.dll | |
[socket](https://www.google.com/search?num=5&q=socket+site%3Amicrosoft.com) | Ws2_32.dll | |
[socket](http://msdn2.microsoft.com/en-us/library/6bf6e6c4-6268-479c-86a6-52e90cf317db) | Ws2_32.dll | winsock2.h | Vanara.PInvoke.Ws2_32.socket
[WahCloseApcHelper](https://www.google.com/search?num=5&q=WahCloseApcHelper+site%3Amicrosoft.com) | Ws2_32.dll | |
[WahCloseHandleHelper](https://www.google.com/search?num=5&q=WahCloseHandleHelper+site%3Amicrosoft.com) | Ws2_32.dll | |
[WahCloseNotificationHandleHelper](https://www.google.com/search?num=5&q=WahCloseNotificationHandleHelper+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -76,8 +76,8 @@ Native Method | Native DLL | Header | Managed Method
[WEP](https://www.google.com/search?num=5&q=WEP+site%3Amicrosoft.com) | Ws2_32.dll | |
[WPUCompleteOverlappedRequest](https://www.google.com/search?num=5&q=WPUCompleteOverlappedRequest+site%3Amicrosoft.com) | Ws2_32.dll | |
[WPUGetProviderPathEx](https://www.google.com/search?num=5&q=WPUGetProviderPathEx+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAAccept](https://www.google.com/search?num=5&q=WSAAccept+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAAddressToString](https://www.google.com/search?num=5&q=WSAAddressToStringA+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAAccept](http://msdn2.microsoft.com/en-us/library/f385f63f-49b2-4eb7-8717-ad4cca1a2252) | Ws2_32.dll | winsock2.h | Vanara.PInvoke.Ws2_32.WSAAccept
[WSAAddressToString](http://msdn2.microsoft.com/en-us/library/d72e55e6-79a9-4386-9e1a-24a322f13426) | Ws2_32.dll | winsock2.h | Vanara.PInvoke.Ws2_32.WSAAddressToString
[WSAAdvertiseProvider](https://www.google.com/search?num=5&q=WSAAdvertiseProvider+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAAsyncGetHostByAddr](https://www.google.com/search?num=5&q=WSAAsyncGetHostByAddr+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAAsyncGetHostByName](https://www.google.com/search?num=5&q=WSAAsyncGetHostByName+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -88,7 +88,7 @@ Native Method | Native DLL | Header | Managed Method
[WSAAsyncSelect](https://www.google.com/search?num=5&q=WSAAsyncSelect+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSACancelAsyncRequest](https://www.google.com/search?num=5&q=WSACancelAsyncRequest+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSACancelBlockingCall](https://www.google.com/search?num=5&q=WSACancelBlockingCall+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSACleanup](https://www.google.com/search?num=5&q=WSACleanup+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSACleanup](http://msdn2.microsoft.com/en-us/library/72b7cc3e-be34-41e7-acbf-61742149ec8b) | Ws2_32.dll | winsock.h | Vanara.PInvoke.Ws2_32.WSACleanup
[WSACloseEvent](https://www.google.com/search?num=5&q=WSACloseEvent+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAConnect](https://www.google.com/search?num=5&q=WSAConnect+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAConnectByList](https://www.google.com/search?num=5&q=WSAConnectByList+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -135,7 +135,7 @@ Native Method | Native DLL | Header | Managed Method
[WSASetLastError](https://www.google.com/search?num=5&q=WSASetLastError+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSASetService](https://www.google.com/search?num=5&q=WSASetServiceA+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSASocket](https://www.google.com/search?num=5&q=WSASocketA+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAStartup](https://www.google.com/search?num=5&q=WSAStartup+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAStartup](http://msdn2.microsoft.com/en-us/library/08299592-867c-491d-9769-d16602133659) | Ws2_32.dll | winsock.h | Vanara.PInvoke.Ws2_32.WSAStartup
[WSAStringToAddress](https://www.google.com/search?num=5&q=WSAStringToAddressA+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAUnadvertiseProvider](https://www.google.com/search?num=5&q=WSAUnadvertiseProvider+site%3Amicrosoft.com) | Ws2_32.dll | |
[WSAUnhookBlockingHook](https://www.google.com/search?num=5&q=WSAUnhookBlockingHook+site%3Amicrosoft.com) | Ws2_32.dll | |
@ -183,10 +183,17 @@ Native Method | Native DLL | Header | Managed Method
### Structures
Native Structure | Header | Managed Structure
--- | --- | ---
[FLOWSPEC](http://msdn2.microsoft.com/en-us/library/268e0d3a-2b04-40fd-91eb-f1780236b3e4) | qos.h | Vanara.PInvoke.Ws2_32+FLOWSPEC
[IN_ADDR](https://www.google.com/search?num=5&q=IN_ADDR+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+IN_ADDR
[IN6_ADDR](https://www.google.com/search?num=5&q=IN6_ADDR+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+IN6_ADDR
[QOS](http://msdn2.microsoft.com/en-us/library/859faa13-bd66-46ee-8452-6ff5d53d66c9) | winsock2.h | Vanara.PInvoke.Ws2_32+QOS
[SOCKADDR_IN](https://www.google.com/search?num=5&q=SOCKADDR_IN+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+SOCKADDR_IN
[SOCKADDR_IN6](https://www.google.com/search?num=5&q=SOCKADDR_IN6+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+SOCKADDR_IN6
[SOCKADDR_IN6_PAIR](http://msdn2.microsoft.com/en-us/library/0265f8e0-8b35-4d9d-bf22-e98e9ff36a17) | ws2ipdef.h | Vanara.PInvoke.Ws2_32+SOCKADDR_IN6_PAIR
[SOCKADDR_INET](https://www.google.com/search?num=5&q=SOCKADDR_INET+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+SOCKADDR_INET
[SOCKET](https://www.google.com/search?num=5&q=SOCKET+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+SOCKET
[SOCKET_ADDRESS](https://www.google.com/search?num=5&q=SOCKET_ADDRESS+site%3Amicrosoft.com) | winsock2.h | Vanara.PInvoke.Ws2_32+SOCKET_ADDRESS
[WSABUF](http://msdn2.microsoft.com/en-us/library/a012c3ba-67fd-4fcf-84d1-85e9d495c29c) | ws2def.h | Vanara.PInvoke.Ws2_32+WSABUF
[WSADATA](http://msdn2.microsoft.com/en-us/library/c3c4c0d6-c8b3-4991-bedb-f45816cc8160) | winsock.h | Vanara.PInvoke.Ws2_32+WSADATA
[WSAPROTOCOL_INFO](http://msdn2.microsoft.com/en-us/library/758c5553-056f-4ea5-a851-30ef641ffb14) | winsock2.h | Vanara.PInvoke.Ws2_32+WSAPROTOCOL_INFO
[WSAPROTOCOLCHAIN](http://msdn2.microsoft.com/en-us/library/c0676f45-e3e3-45f2-9b34-d7318fddc282) | winsock2.h | Vanara.PInvoke.Ws2_32+WSAPROTOCOLCHAIN

343
PInvoke/Ws2_32/QoS.cs Normal file
View File

@ -0,0 +1,343 @@
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Ws2_32
{
/// <summary>Specifies the level of service to negotiate for the flow.</summary>
[PInvokeData("qos.h", MSDNShortId = "268e0d3a-2b04-40fd-91eb-f1780236b3e4")]
public enum SERVICETYPE : uint
{
/// <summary>
/// Indicates that no traffic will be transmitted in the specified direction. On duplex-capable media, this value signals
/// underlying software to set up unidirectional connections only. This service type is not valid for the TC API.
/// </summary>
SERVICETYPE_NOTRAFFIC = 0x00000000,
/// <summary>
/// Results in no action taken by the RSVP SP. Traffic control does create a BESTEFFORT flow, however, and traffic on the flow
/// will be handled by traffic control similarly to other BESTEFFORT traffic.
/// </summary>
SERVICETYPE_BESTEFFORT = 0x00000001,
/// <summary>
/// Provides an end-to-end QOS that closely approximates transmission quality provided by best-effort service, as expected under
/// unloaded conditions from the associated network components along the data path.
/// <para>Applications that use SERVICETYPE_CONTROLLEDLOAD may therefore assume the following:</para>
/// <list type="bullet">
/// <item>
/// The network will deliver a very high percentage of transmitted packets to its intended receivers. In other words, packet loss
/// will closely approximate the basic packet error rate of the transmission medium.
/// </item>
/// <item>
/// Transmission delay for a very high percentage of the delivered packets will not greatly exceed the minimum transit delay
/// experienced by any successfully delivered packet.
/// </item>
/// </list>
/// </summary>
SERVICETYPE_CONTROLLEDLOAD = 0x00000002,
/// <summary>
/// Guarantees that datagrams will arrive within the guaranteed delivery time and will not be discarded due to queue overflows,
/// provided the flow's traffic stays within its specified traffic parameters. This service is intended for applications that
/// need a firm guarantee that a datagram will arrive no later than a certain time after it was transmitted by its source.
/// </summary>
SERVICETYPE_GUARANTEED = 0x00000003,
/// <summary>Used to notify network changes.</summary>
SERVICETYPE_NETWORK_UNAVAILABLE = 0x00000004,
/// <summary>Specifies that all service types are supported for a flow. Can be used on sender side only.</summary>
SERVICETYPE_GENERAL_INFORMATION = 0x00000005,
/// <summary>
/// Indicates that the quality of service in the transmission using this ServiceType value is not changed. SERVICETYPE_NOCHANGE
/// can be used when requesting a change in the quality of service for one direction only, or when requesting a change only
/// within the ProviderSpecific parameters of a QOS specification, and not in the SendingFlowspec or ReceivingFlowspec.
/// </summary>
SERVICETYPE_NOCHANGE = 0x00000006,
/// <summary>Used to indicate nonconforming traffic.</summary>
SERVICETYPE_NONCONFORMING = 0x00000009,
/// <summary>
/// Used only for transmission of control packets (such as RSVP signaling messages). This ServiceType has the highest priority.
/// </summary>
SERVICETYPE_NETWORK_CONTROL = 0x0000000A,
/// <summary>
/// Indicates that the application requires better than BESTEFFORT transmission, but cannot quantify its transmission
/// requirements. Applications that use SERVICETYPE_QUALITATIVE can supply an application identifier policy object. The
/// application identification policy object enables policy servers on the network to identify the application, and accordingly,
/// assign an appropriate quality of service to the request. For more information on application identification, consult the IETF
/// Internet Draft draft-ietf-rap-rsvp-appid-00.txt, or the Microsoft white paper on Application Identification. Traffic control
/// treats flows of this type with the same priority as BESTEFFORT traffic on the local computer. However, application
/// programmers can get boosted priority for such flows by modifying the Layer 2 settings on the associated flow using the
/// QOS_TRAFFIC_CLASS QOS object.
/// </summary>
SERVICETYPE_QUALITATIVE = 0x0000000D,
/// <summary>Indicates that traffic control should not be invoked in the specified direction.</summary>
SERVICE_NO_TRAFFIC_CONTROL = 0x81000000,
/// <summary>Suppresses RSVP signaling in the specified direction.</summary>
SERVICE_NO_QOS_SIGNALING = 0x40000000
}
/// <summary>
/// <para>
/// The <c>FLOWSPEC</c> structure provides quality of service parameters to the RSVP SP. This allows QOS-aware applications to
/// invoke, modify, or remove QOS settings for a given flow. Some members of <c>FLOWSPEC</c> can be set to default values. See
/// Remarks for more information.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Many members of the <c>FLOWSPEC</c> structure can be set to default values by setting the member to QOS_NOT_SPECIFIED. Note that
/// the members that can be set to default values differ depending on whether the <c>FLOWSPEC</c> is a receiving <c>FLOWSPEC</c> or a
/// sending <c>FLOWSPEC</c>.
/// </para>
/// <para>There are a handful of considerations you should keep in mind when using <c>FLOWSPEC</c> with traffic control:</para>
/// <list type="bullet">
/// <item>
/// <term>
/// <c>TokenRate</c> can be QOS_NOT_SPECIFIED for SERVICETYPE_NETWORKCONTROL, SERVICETYPE_QUALITATIVE, and SERVICETYPE_BESTEFFORT.
/// <c>TokenRate</c> must be valid for all other <c>ServiceType</c> values.
/// </term>
/// </item>
/// <item>
/// <term>If <c>PeakBandwidth</c> is specified, it must be greater than or equal to <c>TokenRate</c>.</term>
/// </item>
/// </list>
/// <para>Many settings can be defaulted in a receiving <c>FLOWSPEC</c> except <c>ServiceType</c>, with the following considerations:</para>
/// <list type="bullet">
/// <item>
/// <term>For a Controlled Load Service receiver, the default values are derived from the sender <c>TSPEC</c>.</term>
/// </item>
/// <item>
/// <term>For a Guaranteed Service receiver, <c>ServiceType</c> and <c>TokenRate</c> must be specified.</term>
/// </item>
/// </list>
/// <para>
/// The following list specifies the values that are applied when a receiving <c>FLOWSPEC</c> sets the corresponding values to default:
/// </para>
/// <para>When the value of the <c>ServiceType</c> is set to SERVICETYPE_GUARANTEED, the following also applies:</para>
/// <list type="bullet">
/// <item>
/// <term>The RATE value in <c>RSPEC</c> is set to the value of TokenRate.</term>
/// </item>
/// <item>
/// <term>The DELAYSLACKTERM value in <c>RSPEC</c> is set to DelayVariation, which is set to zero if DelayVariation is set to QOS_NOT_SPECIFIED.</term>
/// </item>
/// <item>
/// <term>
/// For receivers requesting SERVICETYPE_GUARANTEED, the receiving TokenRate must be specified. This contrasts with a
/// SERVICETYPE_CONTROLLEDLOAD receiver, for which TokenRate may be set to QOS_NOT_SPECIFIED.
/// </term>
/// </item>
/// </list>
/// <para>
/// In a sending <c>FLOWSPEC</c>, everything can be defaulted except <c>ServiceType</c> and <c>TokenRate</c>. The following list
/// specifies the values that are applied when a sending <c>FLOWSPEC</c> sets the corresponding values to default:
/// </para>
/// <para>
/// <c>Traffic Control:</c> The following <c>ServiceType</c> s are invalid when specifically working with Traffic Control. If you are
/// unsure whether you are working directly with Traffic Control (and thereby need to be concerned about whether the following
/// <c>ServiceType</c> s are applicable in your situation), you probably are not:
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/qos/ns-qos-_flowspec typedef struct _flowspec { ULONG TokenRate; ULONG
// TokenBucketSize; ULONG PeakBandwidth; ULONG Latency; ULONG DelayVariation; SERVICETYPE ServiceType; ULONG MaxSduSize; ULONG
// MinimumPolicedSize; } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
[PInvokeData("qos.h", MSDNShortId = "268e0d3a-2b04-40fd-91eb-f1780236b3e4")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct FLOWSPEC
{
/// <summary>
/// <para>
/// Specifies the permitted rate at which data can be transmitted over the life of the flow. The <c>TokenRate</c> member is
/// similar to other token bucket models seen in such WAN technologies as Frame Relay, in which the token is analogous to a
/// credit. If such tokens are not used immediately, they accrue to allow data transmission up to a certain periodic limit (
/// <c>PeakBandwidth</c>, in the case of Windows 2000 quality of service). Accrual of credits is limited, however, to a specified
/// amount ( <c>TokenBucketSize</c>). Limiting total credits (tokens) avoids situations where, for example, flows that are
/// inactive for some time flood the available bandwidth with their large amount of accrued tokens. Because flows may accrue
/// transmission credits over time (at their <c>TokenRate</c> value) only up to the maximum of their <c>TokenBucketSize</c>, and
/// because they are limited in burst transmissions to their <c>PeakBandwidth</c>, traffic control and network-device resource
/// integrity are maintained. Traffic control is maintained because flows cannot send too much data at once, and network-device
/// resource integrity is maintained because such devices are spared high traffic bursts.
/// </para>
/// <para>
/// With this model, applications can transmit data only when sufficient credits are available. If sufficient credits are not
/// available, the application must either wait or discard the traffic (based on the value of QOS_SD_MODE). Therefore, it is
/// important that applications base their <c>TokenRate</c> requests on reasonable expectations for transmission requirements.
/// For example, in video applications, <c>TokenRate</c> is typically set to the average bit rate from peak to peak.
/// </para>
/// <para>
/// If <c>TokenRate</c> is set to QOS_NOT_SPECIFIED on the receiver only, the maximum transmission unit (MTU) is used for
/// <c>TokenRate</c>, and limits on the transmission rate (the token bucket model) will not be put into effect. Thus,
/// <c>TokenRate</c> is expressed in bytes per second.
/// </para>
/// <para>
/// The <c>TokenRate</c> member cannot be set to zero. Nor can it be set as a default (that is, set to QOS_NOT_SPECIFIED) in a
/// sending <c>FLOWSPEC</c>.
/// </para>
/// </summary>
public uint TokenRate;
/// <summary>
/// <para>
/// The maximum amount of credits a given direction of a flow can accrue, regardless of time, in bytes. In video applications,
/// <c>TokenBucketSize</c> will likely be the largest average frame size. In constant rate applications, <c>TokenBucketSize</c>
/// should be set to allow for small variations.
/// </para>
/// </summary>
public uint TokenBucketSize;
/// <summary>
/// <para>
/// The upper limit on time-based transmission permission for a given flow, in bytes per second. The <c>PeakBandwidth</c> member
/// restricts flows that may have accrued a significant amount of transmission credits, or tokens from overburdening network
/// resources with one-time or cyclical data bursts, by enforcing a per-second data transmission ceiling. Some intermediate
/// systems can take advantage of this information, resulting in more efficient resource allocation.
/// </para>
/// </summary>
public uint PeakBandwidth;
/// <summary>
/// <para>
/// Maximum acceptable delay between transmission of a bit by the sender and its receipt by one or more intended receivers, in
/// microseconds. The precise interpretation of this number depends on the level of guarantee specified in the QOS request.
/// </para>
/// </summary>
public uint Latency;
/// <summary>
/// <para>
/// Difference between the maximum and minimum possible delay a packet will experience, in microseconds. Applications use
/// <c>DelayVariation</c> to determine the amount of buffer space needed at the receiving end of the flow. This buffer space
/// information can be used to restore the original data transmission pattern.
/// </para>
/// </summary>
public uint DelayVariation;
/// <summary>
/// <para>
/// Specifies the level of service to negotiate for the flow. The <c>ServiceType</c> member can be one of the following defined
/// service types.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>SERVICETYPE_NOTRAFFIC</term>
/// <term>
/// Indicates that no traffic will be transmitted in the specified direction. On duplex-capable media, this value signals
/// underlying software to set up unidirectional connections only. This service type is not valid for the TC API.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_BESTEFFORT</term>
/// <term>
/// Results in no action taken by the RSVP SP. Traffic control does create a BESTEFFORT flow, however, and traffic on the flow
/// will be handled by traffic control similarly to other BESTEFFORT traffic.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_CONTROLLEDLOAD</term>
/// <term>
/// Provides an end-to-end QOS that closely approximates transmission quality provided by best-effort service, as expected under
/// unloaded conditions from the associated network components along the data path. Applications that use
/// SERVICETYPE_CONTROLLEDLOAD may therefore assume the following:
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_GUARANTEED</term>
/// <term>
/// Guarantees that datagrams will arrive within the guaranteed delivery time and will not be discarded due to queue overflows,
/// provided the flow's traffic stays within its specified traffic parameters. This service is intended for applications that
/// need a firm guarantee that a datagram will arrive no later than a certain time after it was transmitted by its source.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_QUALITATIVE</term>
/// <term>
/// Indicates that the application requires better than BESTEFFORT transmission, but cannot quantify its transmission
/// requirements. Applications that use SERVICETYPE_QUALITATIVE can supply an application identifier policy object. The
/// application identification policy object enables policy servers on the network to identify the application, and accordingly,
/// assign an appropriate quality of service to the request. For more information on application identification, consult the IETF
/// Internet Draft draft-ietf-rap-rsvp-appid-00.txt, or the Microsoft white paper on Application Identification. Traffic control
/// treats flows of this type with the same priority as BESTEFFORT traffic on the local computer. However, application
/// programmers can get boosted priority for such flows by modifying the Layer 2 settings on the associated flow using the
/// QOS_TRAFFIC_CLASS QOS object.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_NETWORK_UNAVAILBLE</term>
/// <term>Used to notify network changes.</term>
/// </item>
/// <item>
/// <term>SERVICETYPE_NETWORK_CONTROL</term>
/// <term>
/// Used only for transmission of control packets (such as RSVP signaling messages). This ServiceType has the highest priority.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_GENERAL_INFORMATION</term>
/// <term>Specifies that all service types are supported for a flow. Can be used on sender side only.</term>
/// </item>
/// <item>
/// <term>SERVICETYPE_NOCHANGE</term>
/// <term>
/// Indicates that the quality of service in the transmission using this ServiceType value is not changed. SERVICETYPE_NOCHANGE
/// can be used when requesting a change in the quality of service for one direction only, or when requesting a change only
/// within the ProviderSpecific parameters of a QOS specification, and not in the SendingFlowspec or ReceivingFlowspec.
/// </term>
/// </item>
/// <item>
/// <term>SERVICETYPE_NONCONFORMING</term>
/// <term>Used to indicate nonconforming traffic.</term>
/// </item>
/// <item>
/// <term>SERVICE_NO_TRAFFIC_CONTROL</term>
/// <term>Indicates that traffic control should not be invoked in the specified direction.</term>
/// </item>
/// <item>
/// <term>SERVICE_NO_QOS_SIGNALING</term>
/// <term>Suppresses RSVP signaling in the specified direction.</term>
/// </item>
/// </list>
/// <para>The following list identifies the relative priority of <c>ServiceType</c> settings:</para>
/// <para>SERVICETYPE_NETWORK_CONTROL</para>
/// <para>SERVICETYPE_GUARANTEED</para>
/// <para>SERVICETYPE_CONTROLLED_LOAD</para>
/// <para>SERVICETYPE_BESTEFFORT</para>
/// <para>SERVICETYPE_QUALITATIVE</para>
/// <para>Non-conforming traffic</para>
/// <para>
/// For a simple example, if a given network device were resource-bounded and had to choose among transmitting a packet from one
/// of the above <c>ServiceType</c> settings, it would first send a packet of SERVICETYPE_NETWORKCONTROL, and if there were no
/// packets of that <c>ServiceType</c> requiring transmission it would send a packet of <c>ServiceType</c>
/// SERVICETYPE_GUARANTEED, and so on.
/// </para>
/// </summary>
public SERVICETYPE ServiceType;
/// <summary>
/// <para>Specifies the maximum packet size permitted or used in the traffic flow, in bytes.</para>
/// </summary>
public uint MaxSduSize;
/// <summary>
/// <para>
/// Specifies the minimum packet size for which the requested quality of service will be provided, in bytes. Packets smaller than
/// this size are treated by traffic control as <c>MinimumPolicedSize</c>. When using the <c>FLOWSPEC</c> structure in
/// association with RSVP, the value of <c>MinimumPolicedSize</c> cannot be zero; however, if you are using the <c>FLOWSPEC</c>
/// structure specifically with the TC API, you can set <c>MinimumPolicedSize</c> to zero.
/// </para>
/// </summary>
public uint MinimumPolicedSize;
}
}
}

View File

@ -24,8 +24,11 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<PackageReleaseNotes>Currently implements:
Functions
bind, closesocket, inet_ntoa, listen, socket, WSAAccept, WSAAddressToStringA, WSAAddressToStringW, WSACleanup, WSAStartup
Structures
IN_ADDR, IN6_ADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_PAIR, SOCKADDR_INET, SOCKET_ADDRESS
FLOWSPEC, IN_ADDR, IN6_ADDR, QOS, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_PAIR, SOCKADDR_INET, SOCKET, SOCKET_ADDRESS, WSABUF, WSADATA, WSAPROTOCOL_INFO, WSAPROTOCOLCHAIN
</PackageReleaseNotes>
<LangVersion>latest</LangVersion>

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ All assemblies are available via NuGet and provide builds against .NET 2.0, 3.5,
var bret = GetComputerName(sb, ref sbSz);
```
5. In some cases there is a corresponding helper/wrapper class in one of the [Supporting Assemblies](#Supporting-Assemblies), especially for Security, System Services, Forms and Shell. Go to their library page (click on link in section) and look through the classes included in each library.
## Design Concepts
@ -26,8 +27,8 @@ I have tried to follow the concepts below in laying out the libraries.
* (e.g. The macro `HIWORD` and the structure `SIZE` are both in `Vanara.PInvoke.Shared` and classes to simplfy interop calls and native memory management are in `Vanara.Core`.)
* Inside a project, all constructs are contained in a file named after the header file (*.h) in which they are defined in the Windows API.
* (e.g. In the Vanara.PInvoke.Kernel32 project directory, you'll find a FileApi.cs, a WinBase.cs and a WinNT.cs file representing fileapi.h, winbase.h and winnt.h respectively.)
* Where the direct interpretation of a structure leads to memory leaks or misuse, I have tried to simplify their use.
* Where structures are always passed by reference and where that structure needs to clean up memory allocations, I have changed the structure to a class implementing `IDisposable`.
* Where the direct interpretation of a structure or function leads to memory leaks or misuse, I have tried to simplify its use.
* Where a structure is always passed by reference and where that structure needs to clean up memory allocations, I have changed the structure to a class implementing `IDisposable`.
* Wherever possible, all handles have been turned into `SafeHandle` derivatives named after the Windows API handle. If those handles require a call to a function to release/close/destroy, a derived `SafeHANDLE` exists that performs that function on disposal.
* e.g. `HTOKEN` is defined. `SafeHTOKEN` builds upon that handle with an automated release calling `CloseHandle`.
* Wherever possible, all functions that allocate memory that is to be freed by the caller use a safe memory handle.
@ -47,7 +48,7 @@ AclUI.dll | [Vanara.PInvoke.AclUI](https://github.com/dahall/Vanara/blob/master/
qmgr.dll (BITS) | [Vanara.PInvoke.BITS](https://github.com/dahall/Vanara/blob/master/PInvoke/BITS/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.BITS)](https://www.nuget.org/packages/Vanara.PInvoke.BITS)
ComCtl32.dll | [Vanara.PInvoke.ComCtl32](https://github.com/dahall/Vanara/blob/master/PInvoke/ComCtl32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.ComCtl32)](https://www.nuget.org/packages/Vanara.PInvoke.ComCtl32)
CredUI.dll | [Vanara.PInvoke.CredUI](https://github.com/dahall/Vanara/blob/master/PInvoke/CredUI/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.CredUI)](https://www.nuget.org/packages/Vanara.PInvoke.CredUI)
BCrypt.dll, Crypt32.dll and NCrypt.dll | [Vanara.PInvoke.Cryptography](https://github.com/dahall/Vanara/blob/master/PInvoke/Cryptography/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/23%25-yellow.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Cryptography)](https://www.nuget.org/packages/Vanara.PInvoke.Cryptography)
BCrypt.dll, Crypt32.dll and NCrypt.dll | [Vanara.PInvoke.Cryptography](https://github.com/dahall/Vanara/blob/master/PInvoke/Cryptography/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/23%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Cryptography)](https://www.nuget.org/packages/Vanara.PInvoke.Cryptography)
DwmApi.dll | [Vanara.PInvoke.DwmApi](https://github.com/dahall/Vanara/blob/master/PInvoke/DwmApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.DwmApi)](https://www.nuget.org/packages/Vanara.PInvoke.DwmApi)
Gdi32.dll | [Vanara.PInvoke.Gdi32](https://github.com/dahall/Vanara/blob/master/PInvoke/Gdi32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/5%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Gdi32)](https://www.nuget.org/packages/Vanara.PInvoke.Gdi32)
IpHlpApi.dll | [Vanara.PInvoke.IpHlpApi](https://github.com/dahall/Vanara/blob/master/PInvoke/IpHlpApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/60%25-yellow.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.IpHlpApi)](https://www.nuget.org/packages/Vanara.PInvoke.IpHlpApi)
@ -57,8 +58,8 @@ NetApi32.dll | [Vanara.PInvoke.NetApi32](https://github.com/dahall/Vanara/blob/m
NetListMgr.dll | [Vanara.PInvoke.NetListMgr](https://github.com/dahall/Vanara/blob/master/PInvoke/NetListMgr/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.NetListMgr)](https://www.nuget.org/packages/Vanara.PInvoke.NetListMgr)
NTDSApi.dll | [Vanara.PInvoke.NTDSApi](https://github.com/dahall/Vanara/blob/master/PInvoke/NTDSApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-yellow.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.NTDSApi)](https://www.nuget.org/packages/Vanara.PInvoke.NTDSApi)
NTDll.dll | [Vanara.PInvoke.NTDll](https://github.com/dahall/Vanara/blob/master/PInvoke/NTDll/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/4%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.NTDll)](https://www.nuget.org/packages/Vanara.PInvoke.NTDll)
Ole32.dll, OleAut32 and PropSys.dll | [Vanara.PInvoke.Ole](https://github.com/dahall/Vanara/blob/master/PInvoke/Ole/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/27%25-yellow.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Ole)](https://www.nuget.org/packages/Vanara.PInvoke.Ole)
AdvApi32.dll, Authz.dll and Secur32.dll | [Vanara.PInvoke.Security](https://github.com/dahall/Vanara/blob/master/PInvoke/Security/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/28%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Security)](https://www.nuget.org/packages/Vanara.PInvoke.Security)
Ole32.dll, OleAut32 and PropSys.dll | [Vanara.PInvoke.Ole](https://github.com/dahall/Vanara/blob/master/PInvoke/Ole/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/27%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Ole)](https://www.nuget.org/packages/Vanara.PInvoke.Ole)
AdvApi32.dll, Authz.dll and Secur32.dll | [Vanara.PInvoke.Security](https://github.com/dahall/Vanara/blob/master/PInvoke/Security/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/29%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Security)](https://www.nuget.org/packages/Vanara.PInvoke.Security)
Shell32.dll | [Vanara.PInvoke.Shell32](https://github.com/dahall/Vanara/blob/master/PInvoke/Shell32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Shell32)](https://www.nuget.org/packages/Vanara.PInvoke.Shell32)
ShlwApi.dll | [Vanara.PInvoke.ShlwApi](https://github.com/dahall/Vanara/blob/master/PInvoke/ShlwApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.ShlwApi)](https://www.nuget.org/packages/Vanara.PInvoke.ShlwApi)
TaskSchd.dll and MSTask.dll | [Vanara.PInvoke.TaskSchd](https://github.com/dahall/Vanara/blob/master/PInvoke/TaskSchd/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.TaskSchd)](https://www.nuget.org/packages/Vanara.PInvoke.TaskSchd)
@ -67,7 +68,7 @@ User32.dll that have GDI references | [Vanara.PInvoke.User32.Gdi](https://github
UxTheme.dll | [Vanara.PInvoke.UxTheme](https://github.com/dahall/Vanara/blob/master/PInvoke/UxTheme/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.UxTheme)](https://www.nuget.org/packages/Vanara.PInvoke.UxTheme)
VirtDisk.dll | [Vanara.PInvoke.VirtDisk](https://github.com/dahall/Vanara/blob/master/PInvoke/VirtDisk/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.VirtDisk)](https://www.nuget.org/packages/Vanara.PInvoke.VirtDisk)
WinINet.dll | [Vanara.PInvoke.WinINet](https://github.com/dahall/Vanara/blob/master/PInvoke/WinINet/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/8%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.WinINet)](https://www.nuget.org/packages/Vanara.PInvoke.WinINet)
Ws2_32.dll | [Vanara.PInvoke.Ws2_32](https://github.com/dahall/Vanara/blob/master/PInvoke/Ws2_32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/3%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Ws2_32)](https://www.nuget.org/packages/Vanara.PInvoke.Ws2_32)
Ws2_32.dll | [Vanara.PInvoke.Ws2_32](https://github.com/dahall/Vanara/blob/master/PInvoke/Ws2_32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/5%25-red.svg) | [![NuGet](https://buildstats.info/nuget/Vanara.PInvoke.Ws2_32)](https://www.nuget.org/packages/Vanara.PInvoke.Ws2_32)
## Supporting Assemblies