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 quic_conn_index for C binding #42

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/tquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ struct quic_conn_t *quic_endpoint_get_connection(struct quic_endpoint_t *endpoin
*/
void quic_endpoint_close(struct quic_endpoint_t *endpoint);

/**
* Get index of the connection
*/
uint64_t quic_conn_index(struct quic_conn_t *conn);

/**
* Check whether the connection is a server connection.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ pub extern "C" fn quic_endpoint_close(endpoint: &mut Endpoint) {
endpoint.close()
}

/// Get index of the connection
#[no_mangle]
pub extern "C" fn quic_conn_index(conn: &mut Connection) -> u64 {
conn.index().unwrap_or(u64::MAX)
}

/// Check whether the connection is a server connection.
#[no_mangle]
pub extern "C" fn quic_conn_is_server(conn: &mut Connection) -> bool {
Expand Down