Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to convert errors to wire_error_code via C API #1762

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

normanmaurer
Copy link
Contributor

Motivation:

1d00ee1 added the ability to retrieve the wire error code for a given error but did not add the same functionallity to the C API.

Modifications:

Expose functions to convert errors to wire_error_code via C

Result:

More complete C API

@@ -132,6 +132,10 @@ enum quiche_error {
// Returns a human readable string with the quiche version number.
const char *quiche_version(void);

// Returns the wire error code for the given error as defined in RFC9000 Section 20. Error Codes.
// The given error must be a valid quiche_error.
uint64_t quiche_error_to_wire_error_code(ssize_t error);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghedo @LPardue I only added the code for the quic errors for now but if you agree with the approach let me know and I will add the same for h3.

One thing I was not sure about was if using a ssize_t is good or if we should use quiche_error and expose it via FFI as enum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH it's not really clear why an application would want this? The 1d00ee1 change simply added public enums for the wire error codes defined in RFCs, the conversion from Error is not actually public, so this FFI change would add an API that is not actually available in Rust.

Motivation:

cloudflare@1d00ee1 added the ability to retrieve the wire error code for a given error but did not add the same functionallity to the C API.

Modifications:

Expose functions to convert errors to wire_error_code via C

Result:

More complete C API
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.

None yet

2 participants