Skip to content

Commit

Permalink
ffi: expose quiche_conn_retire_dcid(...)
Browse files Browse the repository at this point in the history
Motivation:

At the moment its impossible to call retire_dcid(...) via the C API.

Modifications:

Add quiche_conn_retire_dcid to header file and also add the implementation to ffi.

Result:

Be able to retire destination connection id
  • Loading branch information
normanmaurer authored Nov 27, 2023
1 parent b91019e commit 404f259
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quiche/include/quiche.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ uint64_t quiche_conn_new_scid(quiche_conn *conn,
const uint8_t *scid, size_t scid_len,
const uint8_t *reset_token, bool retire_if_needed);

// Requests the retirement of the destination Connection ID used by the
// host to reach its peer.
int quiche_conn_retire_dcid(quiche_conn *conn, uint64_t dcid_seq);

// Frees the connection object.
void quiche_conn_free(quiche_conn *conn);

Expand Down
10 changes: 10 additions & 0 deletions quiche/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,16 @@ pub extern fn quiche_conn_new_scid(
}
}

#[no_mangle]
pub extern fn quiche_conn_retire_dcid(
conn: &mut Connection, dcid_seq: u64,
) -> c_int {
match conn.retire_dcid(dcid_seq) {
Ok(_) => 0,
Err(e) => e.to_c() as c_int,
}
}

#[no_mangle]
pub extern fn quiche_conn_available_dcids(conn: &Connection) -> size_t {
conn.available_dcids() as size_t
Expand Down

0 comments on commit 404f259

Please sign in to comment.