diff options
author | 2021-01-15 16:06:37 +0100 | |
---|---|---|
committer | 2021-01-15 15:06:37 +0000 | |
commit | 9d0c677ef1411b24d720b5c8b73bcc94b5535c29 (patch) | |
tree | 0b18e1e8aef12ad2cd1e7de02f7f42542e9a23cc /src | |
parent | 6a4c2888caaf210674ecc448bb8f357e899f87f5 (diff) | |
download | quiche-9d0c677ef1411b24d720b5c8b73bcc94b5535c29.tar.gz quiche-9d0c677ef1411b24d720b5c8b73bcc94b5535c29.tar.zst quiche-9d0c677ef1411b24d720b5c8b73bcc94b5535c29.zip |
ffi: add quiche_conn_dgram_recv_front_len()
Motivation:
It is useful to know the len of the datagram in the recv queue so we can allocate a buffer with the correct size. This is already possible in rust but wasn't exposed in the c layer.
Modifications:
Add quiche_conn_dgram_recv_front_len which expose this functionality in the c layer.
Result:
Be able to obtain the len of the first datagram in the recv queue.
Diffstat (limited to 'src')
-rw-r--r-- | src/ffi.rs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -790,6 +790,15 @@ pub extern fn quiche_conn_dgram_max_writable_len(conn: &Connection) -> ssize_t { } #[no_mangle] +pub extern fn quiche_conn_dgram_recv_front_len(conn: &Connection) -> ssize_t { + match conn.dgram_recv_front_len() { + None => Error::Done.to_c(), + + Some(v) => v as ssize_t, + } +} + +#[no_mangle] pub extern fn quiche_conn_dgram_send( conn: &mut Connection, buf: *const u8, buf_len: size_t, ) -> ssize_t { |