Skip to content

Commit

Permalink
Add FFI set_anti_amplification_factor (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofei0800 committed Aug 23, 2024
1 parent 71f42ef commit 9678772
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/tquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@ void quic_config_enable_stateless_reset(struct quic_config_t *config, bool enabl
*/
void quic_config_set_cid_len(struct quic_config_t *config, uint8_t v);

/**
* Set the anti-amplification factor.
*
* The server limits the data sent to an unvalidated address to
* `anti_amplification_factor` times the received data.
*/
void quic_config_set_anti_amplification_factor(struct quic_config_t *config, uint8_t v);

/**
* Set the batch size for sending packets.
* Applicable to Endpoint only.
Expand Down
9 changes: 9 additions & 0 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@ pub extern "C" fn quic_config_set_cid_len(config: &mut Config, v: u8) {
config.set_cid_len(v as usize);
}

/// Set the anti-amplification factor.
///
/// The server limits the data sent to an unvalidated address to
/// `anti_amplification_factor` times the received data.
#[no_mangle]
pub extern "C" fn quic_config_set_anti_amplification_factor(config: &mut Config, v: u8) {
config.set_anti_amplification_factor(v as usize);
}

/// Set the batch size for sending packets.
/// Applicable to Endpoint only.
#[no_mangle]
Expand Down

0 comments on commit 9678772

Please sign in to comment.