diff --git a/include/tquic.h b/include/tquic.h index bb3175f9..db41649b 100644 --- a/include/tquic.h +++ b/include/tquic.h @@ -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. */ diff --git a/src/ffi.rs b/src/ffi.rs index aec20bea..e66a168e 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -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 {