diff --git a/.metadata/ConstantsScraper.settings.rsp b/.metadata/ConstantsScraper.settings.rsp new file mode 100644 index 0000000..e69de29 diff --git a/.metadata/MsQuic.Win32.c b/.metadata/MsQuic.Win32.c new file mode 100644 index 0000000..017a9a2 --- /dev/null +++ b/.metadata/MsQuic.Win32.c @@ -0,0 +1 @@ +#include "MsQuic.Win32.h" \ No newline at end of file diff --git a/.metadata/MsQuic.Win32.h b/.metadata/MsQuic.Win32.h new file mode 100644 index 0000000..3875d97 --- /dev/null +++ b/.metadata/MsQuic.Win32.h @@ -0,0 +1,42 @@ +#include "winerror.h" +#define QUIC_TLS_ALERT_HRESULT_PREFIX _HRESULT_TYPEDEF_(0x80410100L) + +typedef enum { + QUIC_STATUS_SUCCESS = 0x0, // S_OK + QUIC_STATUS_PENDING = 0x703e5, // SUCCESS_HRESULT_FROM_WIN32(ERROR_IO_PENDING) + QUIC_STATUS_CONTINUE = 0x704de, // SUCCESS_HRESULT_FROM_WIN32(ERROR_CONTINUE) + QUIC_STATUS_OUT_OF_MEMORY = 0x8007000e, // E_OUTOFMEMORY + QUIC_STATUS_INVALID_PARAMETER = 0x80070057, // E_INVALIDARG + QUIC_STATUS_INVALID_STATE = 0x8007139f, // E_NOT_VALID_STATE + QUIC_STATUS_NOT_SUPPORTED = 0x80004002, // E_NOINTERFACE + QUIC_STATUS_NOT_FOUND = 0x80070490, // HRESULT_FROM_WIN32(ERROR_NOT_FOUND) + QUIC_STATUS_BUFFER_TOO_SMALL = 0x8007007a, // E_NOT_SUFFICIENT_BUFFER + QUIC_STATUS_HANDSHAKE_FAILURE = 0x80410000, // ERROR_QUIC_HANDSHAKE_FAILURE + QUIC_STATUS_ABORTED = 0x80004004, // E_ABORT + QUIC_STATUS_ADDRESS_IN_USE = 0x80072740, // HRESULT_FROM_WIN32(WSAEADDRINUSE) + QUIC_STATUS_INVALID_ADDRESS = 0x80072741, // HRESULT_FROM_WIN32(WSAEADDRNOTAVAIL) + QUIC_STATUS_CONNECTION_TIMEOUT = 0x80410006, // ERROR_QUIC_CONNECTION_TIMEOUT + QUIC_STATUS_CONNECTION_IDLE = 0x80410005, // ERROR_QUIC_CONNECTION_IDLE + QUIC_STATUS_UNREACHABLE = 0x800704d0, // HRESULT_FROM_WIN32(ERROR_HOST_UNREACHABLE) + QUIC_STATUS_INTERNAL_ERROR = 0x80410003, // ERROR_QUIC_INTERNAL_ERROR + QUIC_STATUS_CONNECTION_REFUSED = 0x800704c9, // HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED) + QUIC_STATUS_PROTOCOL_ERROR = 0x80410004, // ERROR_QUIC_PROTOCOL_VIOLATION + QUIC_STATUS_VER_NEG_ERROR = 0x80410001, // ERROR_QUIC_VER_NEG_FAILURE + QUIC_STATUS_TLS_ERROR = 0x80072b18, // HRESULT_FROM_WIN32(WSA_SECURE_HOST_NOT_FOUND) + QUIC_STATUS_USER_CANCELED = 0x80410002, // ERROR_QUIC_USER_CANCELED + QUIC_STATUS_ALPN_NEG_FAILURE = 0x80410007, // ERROR_QUIC_ALPN_NEG_FAILURE + QUIC_STATUS_STREAM_LIMIT_REACHED = 0x80410008, // ERROR_QUIC_STREAM_LIMIT_REACHED + QUIC_STATUS_ALPN_IN_USE = 0x80410009, // ERROR_QUIC_ALPN_IN_USE + + QUIC_STATUS_CLOSE_NOTIFY = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 0), // QUIC_STATUS_TLS_ALERT(0) - Close notify + QUIC_STATUS_BAD_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 42), // QUIC_STATUS_TLS_ALERT(42) - Bad Certificate + QUIC_STATUS_UNSUPPORTED_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 43), // QUIC_STATUS_TLS_ALERT(43) - Unsupported Certificate + QUIC_STATUS_REVOKED_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 44), // QUIC_STATUS_TLS_ALERT(44) - Revoked Certificate + QUIC_STATUS_EXPIRED_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 45), // QUIC_STATUS_TLS_ALERT(45) - Expired Certificate + QUIC_STATUS_UNKNOWN_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 46), // QUIC_STATUS_TLS_ALERT(46) - Unknown Certificate + QUIC_STATUS_REQUIRED_CERTIFICATE = QUIC_TLS_ALERT_HRESULT_PREFIX | (0xff & 116), // QUIC_STATUS_TLS_ALERT(116) - Required Certificate + + QUIC_STATUS_CERT_EXPIRED = 0xBEBC401, // CERT_E_EXPIRED + QUIC_STATUS_CERT_UNTRUSTED_ROOT = 0xBEBC402, // CERT_E_UNTRUSTEDROOT + QUIC_STATUS_CERT_NO_CERT = 0xBEBC403 // SEC_E_NO_CREDENTIALS +} QUIC_STATUS; diff --git a/.metadata/generate.proj b/.metadata/generate.proj index c8896ff..28c8af3 100644 --- a/.metadata/generate.proj +++ b/.metadata/generate.proj @@ -8,13 +8,26 @@ + - ..\build\_deps\msquic_release-src\include\msquic.h;..\build\_deps\msquic_release-src\include\msqiuc_winuser.h + ..\build\_deps\msquic_release-src\include\msquic.h; Microsoft.MsQuic + + MsQuic.Win32.h + Microsoft.MsQuic.Win32 + + + ./linux/MsQuic.Linux.h + Microsoft.MsQuic.Linux + + + ./macos/MsQuic.MacOs.h + Microsoft.MsQuic.MacOs + ) -> core::fmt::Result { + f.debug_tuple("QUIC_STATUS").field(&self.0).finish() + } + } + } + pub mod MacOs { + pub const QUIC_STATUS_ABORTED: QUIC_STATUS = QUIC_STATUS(89i32); + pub const QUIC_STATUS_ADDRESS_IN_USE: QUIC_STATUS = QUIC_STATUS(48i32); + pub const QUIC_STATUS_ADDRESS_NOT_AVAILABLE: QUIC_STATUS = QUIC_STATUS(47i32); + pub const QUIC_STATUS_ALPN_IN_USE: QUIC_STATUS = QUIC_STATUS(41i32); + pub const QUIC_STATUS_ALPN_NEG_FAILURE: QUIC_STATUS = QUIC_STATUS(42i32); + pub const QUIC_STATUS_BAD_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000298i32); + pub const QUIC_STATUS_BUFFER_TOO_SMALL: QUIC_STATUS = QUIC_STATUS(84i32); + pub const QUIC_STATUS_CERT_EXPIRED: QUIC_STATUS = QUIC_STATUS(200000513i32); + pub const QUIC_STATUS_CERT_NO_CERT: QUIC_STATUS = QUIC_STATUS(200000515i32); + pub const QUIC_STATUS_CERT_UNTRUSTED_ROOT: QUIC_STATUS = QUIC_STATUS(200000514i32); + pub const QUIC_STATUS_CLOSE_NOTIFY: QUIC_STATUS = QUIC_STATUS(200000256i32); + pub const QUIC_STATUS_CONNECTION_IDLE: QUIC_STATUS = QUIC_STATUS(101i32); + pub const QUIC_STATUS_CONNECTION_REFUSED: QUIC_STATUS = QUIC_STATUS(61i32); + pub const QUIC_STATUS_CONNECTION_TIMEOUT: QUIC_STATUS = QUIC_STATUS(60i32); + pub const QUIC_STATUS_CONTINUE: QUIC_STATUS = QUIC_STATUS(-1i32); + pub const QUIC_STATUS_EXPIRED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000301i32); + pub const QUIC_STATUS_HANDSHAKE_FAILURE: QUIC_STATUS = QUIC_STATUS(53i32); + pub const QUIC_STATUS_INTERNAL_ERROR: QUIC_STATUS = QUIC_STATUS(5i32); + pub const QUIC_STATUS_INVALID_ADDRESS: QUIC_STATUS = QUIC_STATUS(47i32); + pub const QUIC_STATUS_INVALID_PARAMETER: QUIC_STATUS = QUIC_STATUS(22i32); + pub const QUIC_STATUS_INVALID_STATE: QUIC_STATUS = QUIC_STATUS(1i32); + pub const QUIC_STATUS_NOT_FOUND: QUIC_STATUS = QUIC_STATUS(2i32); + pub const QUIC_STATUS_NOT_SUPPORTED: QUIC_STATUS = QUIC_STATUS(102i32); + pub const QUIC_STATUS_OUT_OF_MEMORY: QUIC_STATUS = QUIC_STATUS(12i32); + pub const QUIC_STATUS_PENDING: QUIC_STATUS = QUIC_STATUS(-2i32); + pub const QUIC_STATUS_PROTOCOL_ERROR: QUIC_STATUS = QUIC_STATUS(100i32); + pub const QUIC_STATUS_REQUIRED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000372i32); + pub const QUIC_STATUS_REVOKED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000300i32); + pub const QUIC_STATUS_STREAM_LIMIT_REACHED: QUIC_STATUS = QUIC_STATUS(86i32); + pub const QUIC_STATUS_SUCCESS: QUIC_STATUS = QUIC_STATUS(0i32); + pub const QUIC_STATUS_TLS_ERROR: QUIC_STATUS = QUIC_STATUS(126i32); + pub const QUIC_STATUS_UNKNOWN_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000302i32); + pub const QUIC_STATUS_UNREACHABLE: QUIC_STATUS = QUIC_STATUS(65i32); + pub const QUIC_STATUS_UNSUPPORTED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(200000299i32); + pub const QUIC_STATUS_USER_CANCELED: QUIC_STATUS = QUIC_STATUS(105i32); + pub const QUIC_STATUS_VER_NEG_ERROR: QUIC_STATUS = QUIC_STATUS(43i32); + #[repr(transparent)] + #[derive(PartialEq, Eq, Copy, Clone, Default)] + pub struct QUIC_STATUS(pub i32); + impl windows_core::TypeKind for QUIC_STATUS { + type TypeKind = windows_core::CopyType; + } + impl core::fmt::Debug for QUIC_STATUS { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_tuple("QUIC_STATUS").field(&self.0).finish() + } + } + } + pub mod Win32 { + pub const QUIC_STATUS_ABORTED: QUIC_STATUS = QUIC_STATUS(-2147467260i32); + pub const QUIC_STATUS_ADDRESS_IN_USE: QUIC_STATUS = QUIC_STATUS(-2147014848i32); + pub const QUIC_STATUS_ALPN_IN_USE: QUIC_STATUS = QUIC_STATUS(-2143223799i32); + pub const QUIC_STATUS_ALPN_NEG_FAILURE: QUIC_STATUS = QUIC_STATUS(-2143223801i32); + pub const QUIC_STATUS_BAD_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223510i32); + pub const QUIC_STATUS_BUFFER_TOO_SMALL: QUIC_STATUS = QUIC_STATUS(-2147024774i32); + pub const QUIC_STATUS_CERT_EXPIRED: QUIC_STATUS = QUIC_STATUS(200000513i32); + pub const QUIC_STATUS_CERT_NO_CERT: QUIC_STATUS = QUIC_STATUS(200000515i32); + pub const QUIC_STATUS_CERT_UNTRUSTED_ROOT: QUIC_STATUS = QUIC_STATUS(200000514i32); + pub const QUIC_STATUS_CLOSE_NOTIFY: QUIC_STATUS = QUIC_STATUS(-2143223552i32); + pub const QUIC_STATUS_CONNECTION_IDLE: QUIC_STATUS = QUIC_STATUS(-2143223803i32); + pub const QUIC_STATUS_CONNECTION_REFUSED: QUIC_STATUS = QUIC_STATUS(-2147023671i32); + pub const QUIC_STATUS_CONNECTION_TIMEOUT: QUIC_STATUS = QUIC_STATUS(-2143223802i32); + pub const QUIC_STATUS_CONTINUE: QUIC_STATUS = QUIC_STATUS(459998i32); + pub const QUIC_STATUS_EXPIRED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223507i32); + pub const QUIC_STATUS_HANDSHAKE_FAILURE: QUIC_STATUS = QUIC_STATUS(-2143223808i32); + pub const QUIC_STATUS_INTERNAL_ERROR: QUIC_STATUS = QUIC_STATUS(-2143223805i32); + pub const QUIC_STATUS_INVALID_ADDRESS: QUIC_STATUS = QUIC_STATUS(-2147014847i32); + pub const QUIC_STATUS_INVALID_PARAMETER: QUIC_STATUS = QUIC_STATUS(-2147024809i32); + pub const QUIC_STATUS_INVALID_STATE: QUIC_STATUS = QUIC_STATUS(-2147019873i32); + pub const QUIC_STATUS_NOT_FOUND: QUIC_STATUS = QUIC_STATUS(-2147023728i32); + pub const QUIC_STATUS_NOT_SUPPORTED: QUIC_STATUS = QUIC_STATUS(-2147467262i32); + pub const QUIC_STATUS_OUT_OF_MEMORY: QUIC_STATUS = QUIC_STATUS(-2147024882i32); + pub const QUIC_STATUS_PENDING: QUIC_STATUS = QUIC_STATUS(459749i32); + pub const QUIC_STATUS_PROTOCOL_ERROR: QUIC_STATUS = QUIC_STATUS(-2143223804i32); + pub const QUIC_STATUS_REQUIRED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223436i32); + pub const QUIC_STATUS_REVOKED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223508i32); + pub const QUIC_STATUS_STREAM_LIMIT_REACHED: QUIC_STATUS = QUIC_STATUS(-2143223800i32); + pub const QUIC_STATUS_SUCCESS: QUIC_STATUS = QUIC_STATUS(0i32); + pub const QUIC_STATUS_TLS_ERROR: QUIC_STATUS = QUIC_STATUS(-2147013864i32); + pub const QUIC_STATUS_UNKNOWN_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223506i32); + pub const QUIC_STATUS_UNREACHABLE: QUIC_STATUS = QUIC_STATUS(-2147023664i32); + pub const QUIC_STATUS_UNSUPPORTED_CERTIFICATE: QUIC_STATUS = QUIC_STATUS(-2143223509i32); + pub const QUIC_STATUS_USER_CANCELED: QUIC_STATUS = QUIC_STATUS(-2143223806i32); + pub const QUIC_STATUS_VER_NEG_ERROR: QUIC_STATUS = QUIC_STATUS(-2143223807i32); + pub const QUIC_TLS_ALERT_HRESULT_PREFIX: windows_core::HRESULT = + windows_core::HRESULT(0x80410100_u32 as _); + #[repr(transparent)] + #[derive(PartialEq, Eq, Copy, Clone, Default)] + pub struct QUIC_STATUS(pub i32); + impl windows_core::TypeKind for QUIC_STATUS { + type TypeKind = windows_core::CopyType; + } + impl core::fmt::Debug for QUIC_STATUS { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.debug_tuple("QUIC_STATUS").field(&self.0).finish() + } + } + } #[inline] pub unsafe fn MsQuicClose(quicapi: *const core::ffi::c_void) { #[link(name = "msquic")]