Skip to content

Commit

Permalink
Add quic_conn_index for C binding
Browse files Browse the repository at this point in the history
  • Loading branch information
NewbieOrange committed Nov 21, 2023
1 parent 58ff7c7 commit f5c32a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit f5c32a8

Please sign in to comment.