Skip to content

Conversation

anrossi
Copy link
Contributor

@anrossi anrossi commented Aug 6, 2025

Description

C++ projects with strict validation don't like the C-style casts used for the QUIC_STATUS definitions.

Testing

Existing tests should cover this

Documentation

N/A

@anrossi anrossi requested a review from a team as a code owner August 6, 2025 06:44
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.80%. Comparing base (2861d81) to head (b115913).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5327      +/-   ##
==========================================
- Coverage   85.35%   84.80%   -0.56%     
==========================================
  Files          59       59              
  Lines       18331    18328       -3     
==========================================
- Hits        15647    15543     -104     
- Misses       2684     2785     +101     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mtfriesen
mtfriesen previously approved these changes Aug 6, 2025
@guhetier
Copy link
Contributor

guhetier commented Aug 6, 2025

Should similar changes be made to other headers declaring error codes for consistency?

guhetier
guhetier previously approved these changes Aug 6, 2025
@guhetier
Copy link
Contributor

guhetier commented Aug 6, 2025

Please open bugs for CI failures you do not resolve as part of the PR.

I suggest we go for the following format so they are easy to find in the future:
"[CI-TEST] "

We can then:

  • reference the issue from the bug to "link" them together (and do that on potential CI failure)
  • add the exact testpass name in the bug description

@mtfriesen
Copy link
Contributor

Please open bugs for CI failures you do not resolve as part of the PR.

I suggest we go for the following format so they are easy to find in the future: "[CI-TEST] "

We can then:

  • reference the issue from the bug to "link" them together (and do that on potential CI failure)
  • add the exact testpass name in the bug description

The eBPF team has automated something along these lines, FWIW. More could probably be done to get useful bug titles from individual test cases. Example issue: microsoft/ebpf-for-windows#4470

@mtfriesen
Copy link
Contributor

Should similar changes be made to other headers declaring error codes for consistency?

I'm fine with doing this lazily, both in the compsci and work-prioritization senses.

@anrossi anrossi dismissed stale reviews from guhetier and mtfriesen via bcaa155 August 10, 2025 03:22
Copy link

Cargo - ubuntu-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/linux_bindings.rs b/src/rs/ffi/linux_bindings.rs
index ad16854..2ea5935 100644
--- a/src/rs/ffi/linux_bindings.rs
+++ b/src/rs/ffi/linux_bindings.rs
@@ -492,7 +492,7 @@ pub type QUIC_EXECUTION_CREATE_FN = ::std::option::Option<
         Count: u32,
         Configs: *mut QUIC_EXECUTION_CONFIG,
         Executions: *mut *mut QUIC_EXECUTION,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_EXECUTION_DELETE_FN =
     ::std::option::Option<unsafe extern "C" fn(Count: u32, Executions: *mut *mut QUIC_EXECUTION)>;
@@ -519,7 +519,7 @@ pub type QUIC_CREDENTIAL_LOAD_COMPLETE = ::std::option::Option<
     unsafe extern "C" fn(
         Configuration: HQUIC,
         Context: *mut ::std::os::raw::c_void,
-        Status: ::std::os::raw::c_uint,
+        Status: ::std::os::raw::c_int,
     ),
 >;
 pub type QUIC_CREDENTIAL_LOAD_COMPLETE_HANDLER = QUIC_CREDENTIAL_LOAD_COMPLETE;
@@ -4948,7 +4948,7 @@ pub type QUIC_SET_PARAM_FN = ::std::option::Option<
         Param: u32,
         BufferLength: u32,
         Buffer: *const ::std::os::raw::c_void,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_GET_PARAM_FN = ::std::option::Option<
     unsafe extern "C" fn(
@@ -4956,13 +4956,13 @@ pub type QUIC_GET_PARAM_FN = ::std::option::Option<
         Param: u32,
         BufferLength: *mut u32,
         Buffer: *mut ::std::os::raw::c_void,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_REGISTRATION_OPEN_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Config: *const QUIC_REGISTRATION_CONFIG,
         Registration: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_REGISTRATION_CLOSE_FN =
     ::std::option::Option<unsafe extern "C" fn(Registration: HQUIC)>;
@@ -4982,7 +4982,7 @@ pub type QUIC_CONFIGURATION_OPEN_FN = ::std::option::Option<
         SettingsSize: u32,
         Context: *mut ::std::os::raw::c_void,
         Configuration: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONFIGURATION_CLOSE_FN =
     ::std::option::Option<unsafe extern "C" fn(Configuration: HQUIC)>;
@@ -4990,7 +4990,7 @@ pub type QUIC_CONFIGURATION_LOAD_CREDENTIAL_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Configuration: HQUIC,
         CredConfig: *const QUIC_CREDENTIAL_CONFIG,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub const QUIC_LISTENER_EVENT_TYPE_QUIC_LISTENER_EVENT_NEW_CONNECTION: QUIC_LISTENER_EVENT_TYPE = 0;
 pub const QUIC_LISTENER_EVENT_TYPE_QUIC_LISTENER_EVENT_STOP_COMPLETE: QUIC_LISTENER_EVENT_TYPE = 1;
@@ -5248,7 +5248,7 @@ pub type QUIC_LISTENER_CALLBACK = ::std::option::Option<
         Listener: HQUIC,
         Context: *mut ::std::os::raw::c_void,
         Event: *mut QUIC_LISTENER_EVENT,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_LISTENER_CALLBACK_HANDLER = QUIC_LISTENER_CALLBACK;
 pub type QUIC_LISTENER_OPEN_FN = ::std::option::Option<
@@ -5257,7 +5257,7 @@ pub type QUIC_LISTENER_OPEN_FN = ::std::option::Option<
         Handler: QUIC_LISTENER_CALLBACK_HANDLER,
         Context: *mut ::std::os::raw::c_void,
         Listener: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_LISTENER_CLOSE_FN = ::std::option::Option<unsafe extern "C" fn(Listener: HQUIC)>;
 pub type QUIC_LISTENER_START_FN = ::std::option::Option<
@@ -5266,7 +5266,7 @@ pub type QUIC_LISTENER_START_FN = ::std::option::Option<
         AlpnBuffers: *const QUIC_BUFFER,
         AlpnBufferCount: u32,
         LocalAddress: *const QUIC_ADDR,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_LISTENER_STOP_FN = ::std::option::Option<unsafe extern "C" fn(Listener: HQUIC)>;
 pub const QUIC_CONNECTION_EVENT_TYPE_QUIC_CONNECTION_EVENT_CONNECTED: QUIC_CONNECTION_EVENT_TYPE =
@@ -5368,7 +5368,7 @@ const _: () = {
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct QUIC_CONNECTION_EVENT__bindgen_ty_1__bindgen_ty_2 {
-    pub Status: ::std::os::raw::c_uint,
+    pub Status: ::std::os::raw::c_int,
     pub ErrorCode: QUIC_UINT62,
 }
 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
@@ -5769,7 +5769,7 @@ const _: () = {
 pub struct QUIC_CONNECTION_EVENT__bindgen_ty_1__bindgen_ty_16 {
     pub Certificate: *mut QUIC_CERTIFICATE,
     pub DeferredErrorFlags: u32,
-    pub DeferredStatus: ::std::os::raw::c_uint,
+    pub DeferredStatus: ::std::os::raw::c_int,
     pub Chain: *mut QUIC_CERTIFICATE_CHAIN,
 }
 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
@@ -5922,7 +5922,7 @@ pub type QUIC_CONNECTION_CALLBACK = ::std::option::Option<
         Connection: HQUIC,
         Context: *mut ::std::os::raw::c_void,
         Event: *mut QUIC_CONNECTION_EVENT,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_CALLBACK_HANDLER = QUIC_CONNECTION_CALLBACK;
 pub type QUIC_CONNECTION_OPEN_FN = ::std::option::Option<
@@ -5931,7 +5931,7 @@ pub type QUIC_CONNECTION_OPEN_FN = ::std::option::Option<
         Handler: QUIC_CONNECTION_CALLBACK_HANDLER,
         Context: *mut ::std::os::raw::c_void,
         Connection: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_OPEN_IN_PARTITION_FN = ::std::option::Option<
     unsafe extern "C" fn(
@@ -5940,7 +5940,7 @@ pub type QUIC_CONNECTION_OPEN_IN_PARTITION_FN = ::std::option::Option<
         Handler: QUIC_CONNECTION_CALLBACK_HANDLER,
         Context: *mut ::std::os::raw::c_void,
         Connection: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_CLOSE_FN = ::std::option::Option<unsafe extern "C" fn(Connection: HQUIC)>;
 pub type QUIC_CONNECTION_SHUTDOWN_FN = ::std::option::Option<
@@ -5957,10 +5957,10 @@ pub type QUIC_CONNECTION_START_FN = ::std::option::Option<
         Family: QUIC_ADDRESS_FAMILY,
         ServerName: *const ::std::os::raw::c_char,
         ServerPort: u16,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_SET_CONFIGURATION_FN = ::std::option::Option<
-    unsafe extern "C" fn(Connection: HQUIC, Configuration: HQUIC) -> ::std::os::raw::c_uint,
+    unsafe extern "C" fn(Connection: HQUIC, Configuration: HQUIC) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_SEND_RESUMPTION_FN = ::std::option::Option<
     unsafe extern "C" fn(
@@ -5968,17 +5968,17 @@ pub type QUIC_CONNECTION_SEND_RESUMPTION_FN = ::std::option::Option<
         Flags: QUIC_SEND_RESUMPTION_FLAGS,
         DataLength: u16,
         ResumptionData: *const u8,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_COMP_RESUMPTION_FN = ::std::option::Option<
-    unsafe extern "C" fn(Connection: HQUIC, Result: BOOLEAN) -> ::std::os::raw::c_uint,
+    unsafe extern "C" fn(Connection: HQUIC, Result: BOOLEAN) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_CONNECTION_COMP_CERT_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Connection: HQUIC,
         Result: BOOLEAN,
         TlsAlert: QUIC_TLS_ALERT_CODES,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub const QUIC_STREAM_EVENT_TYPE_QUIC_STREAM_EVENT_START_COMPLETE: QUIC_STREAM_EVENT_TYPE = 0;
 pub const QUIC_STREAM_EVENT_TYPE_QUIC_STREAM_EVENT_RECEIVE: QUIC_STREAM_EVENT_TYPE = 1;
@@ -6019,7 +6019,7 @@ pub union QUIC_STREAM_EVENT__bindgen_ty_1 {
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
 pub struct QUIC_STREAM_EVENT__bindgen_ty_1__bindgen_ty_1 {
-    pub Status: ::std::os::raw::c_uint,
+    pub Status: ::std::os::raw::c_int,
     pub ID: QUIC_UINT62,
     pub _bitfield_align_1: [u8; 0],
     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
@@ -6221,7 +6221,7 @@ pub struct QUIC_STREAM_EVENT__bindgen_ty_1__bindgen_ty_7 {
     pub _bitfield_align_1: [u8; 0],
     pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
     pub ConnectionErrorCode: QUIC_UINT62,
-    pub ConnectionCloseStatus: ::std::os::raw::c_uint,
+    pub ConnectionCloseStatus: ::std::os::raw::c_int,
 }
 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
 const _: () = {
@@ -6491,7 +6491,7 @@ pub type QUIC_STREAM_CALLBACK = ::std::option::Option<
         Stream: HQUIC,
         Context: *mut ::std::os::raw::c_void,
         Event: *mut QUIC_STREAM_EVENT,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_CALLBACK_HANDLER = QUIC_STREAM_CALLBACK;
 pub type QUIC_STREAM_OPEN_FN = ::std::option::Option<
@@ -6501,18 +6501,18 @@ pub type QUIC_STREAM_OPEN_FN = ::std::option::Option<
         Handler: QUIC_STREAM_CALLBACK_HANDLER,
         Context: *mut ::std::os::raw::c_void,
         Stream: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_CLOSE_FN = ::std::option::Option<unsafe extern "C" fn(Stream: HQUIC)>;
 pub type QUIC_STREAM_START_FN = ::std::option::Option<
-    unsafe extern "C" fn(Stream: HQUIC, Flags: QUIC_STREAM_START_FLAGS) -> ::std::os::raw::c_uint,
+    unsafe extern "C" fn(Stream: HQUIC, Flags: QUIC_STREAM_START_FLAGS) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_SHUTDOWN_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Stream: HQUIC,
         Flags: QUIC_STREAM_SHUTDOWN_FLAGS,
         ErrorCode: QUIC_UINT62,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_SEND_FN = ::std::option::Option<
     unsafe extern "C" fn(
@@ -6521,19 +6521,19 @@ pub type QUIC_STREAM_SEND_FN = ::std::option::Option<
         BufferCount: u32,
         Flags: QUIC_SEND_FLAGS,
         ClientSendContext: *mut ::std::os::raw::c_void,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_RECEIVE_COMPLETE_FN =
     ::std::option::Option<unsafe extern "C" fn(Stream: HQUIC, BufferLength: u64)>;
 pub type QUIC_STREAM_RECEIVE_SET_ENABLED_FN = ::std::option::Option<
-    unsafe extern "C" fn(Stream: HQUIC, IsEnabled: BOOLEAN) -> ::std::os::raw::c_uint,
+    unsafe extern "C" fn(Stream: HQUIC, IsEnabled: BOOLEAN) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_STREAM_PROVIDE_RECEIVE_BUFFERS_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Stream: HQUIC,
         BufferCount: u32,
         Buffers: *const QUIC_BUFFER,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub type QUIC_DATAGRAM_SEND_FN = ::std::option::Option<
     unsafe extern "C" fn(
@@ -6542,7 +6542,7 @@ pub type QUIC_DATAGRAM_SEND_FN = ::std::option::Option<
         BufferCount: u32,
         Flags: QUIC_SEND_FLAGS,
         ClientSendContext: *mut ::std::os::raw::c_void,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 pub const QUIC_CONNECTION_POOL_FLAGS_QUIC_CONNECTION_POOL_FLAG_NONE: QUIC_CONNECTION_POOL_FLAGS = 0;
 pub const QUIC_CONNECTION_POOL_FLAGS_QUIC_CONNECTION_POOL_FLAG_CLOSE_ON_FAILURE:
@@ -6598,7 +6598,7 @@ pub type QUIC_CONN_POOL_CREATE_FN = ::std::option::Option<
     unsafe extern "C" fn(
         Config: *mut QUIC_CONNECTION_POOL_CONFIG,
         ConnectionPool: *mut HQUIC,
-    ) -> ::std::os::raw::c_uint,
+    ) -> ::std::os::raw::c_int,
 >;
 #[repr(C)]
 #[derive(Debug, Copy, Clone)]
@@ -6725,8 +6725,8 @@ const _: () = {
         [::std::mem::offset_of!(QUIC_API_TABLE, ExecutionPoll) - 288usize];
 };
 pub const QUIC_STATUS_SUCCESS: QUIC_STATUS = 0;
-pub const QUIC_STATUS_PENDING: QUIC_STATUS = 4294967294;
-pub const QUIC_STATUS_CONTINUE: QUIC_STATUS = 4294967295;
+pub const QUIC_STATUS_PENDING: QUIC_STATUS = -2;
+pub const QUIC_STATUS_CONTINUE: QUIC_STATUS = -1;
 pub const QUIC_STATUS_OUT_OF_MEMORY: QUIC_STATUS = 12;
 pub const QUIC_STATUS_INVALID_PARAMETER: QUIC_STATUS = 22;
 pub const QUIC_STATUS_INVALID_STATE: QUIC_STATUS = 1;
@@ -6759,4 +6759,4 @@ pub const QUIC_STATUS_REQUIRED_CERTIFICATE: QUIC_STATUS = 200000372;
 pub const QUIC_STATUS_CERT_EXPIRED: QUIC_STATUS = 200000513;
 pub const QUIC_STATUS_CERT_UNTRUSTED_ROOT: QUIC_STATUS = 200000514;
 pub const QUIC_STATUS_CERT_NO_CERT: QUIC_STATUS = 200000515;
-pub type QUIC_STATUS = ::std::os::raw::c_uint;
+pub type QUIC_STATUS = ::std::os::raw::c_int;

@anrossi anrossi merged commit 79b6847 into main Aug 12, 2025
462 of 464 checks passed
@anrossi anrossi deleted the mtfriesen/linux_cpp_headers branch August 12, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants