Skip to content

Commit 49f51da

Browse files
committed
ffi: fix compilation errors
1 parent 8765937 commit 49f51da

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

quiche/include/quiche.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -763,17 +763,19 @@ int quiche_conn_new_scid(quiche_conn *conn,
763763
// Requests the stack to perform path validation of the proposed 4-tuple.
764764
int quiche_conn_probe_path(quiche_conn *conn,
765765
const struct sockaddr *local, socklen_t local_len,
766-
const struct sockaddr *peer, socklen_t peer_len, uint64_t *seq);
766+
const struct sockaddr *peer, socklen_t peer_len, uint64_t *path_id,
767+
uint64_t *cid_seq);
767768

768769
// Migrates the connection to a new local address.
769-
int quiche_conn_migrate_source(quiche_conn *conn, const struct sockaddr *local, socklen_t local_len, uint64_t *seq);
770+
int quiche_conn_migrate_source(quiche_conn *conn, const struct sockaddr *local, socklen_t local_len,
771+
uint64_t *path_id, uint64_t *cid_seq);
770772

771773
// Migrates the connection over the given network path between "local"
772774
// and "peer".
773775
int quiche_conn_migrate(quiche_conn *conn,
774776
const struct sockaddr *local, socklen_t local_len,
775777
const struct sockaddr *peer, socklen_t peer_len,
776-
uint64_t *seq);
778+
uint64_t *path_id, uint64_t *cid_seq);
777779

778780
enum quiche_path_event_type {
779781
QUICHE_PATH_EVENT_NEW,
@@ -787,7 +789,7 @@ enum quiche_path_event_type {
787789
typedef struct quiche_path_event quiche_path_event;
788790

789791
// Retrieves the next event. Returns NULL if there is no event to process.
790-
const quiche_path_event *quiche_conn_path_event_next(quiche_conn *conn);
792+
const quiche_path_event *quiche_conn_path_event_next(quiche_conn *conn, uint64_t *path_id);
791793

792794
// Returns the type of the event.
793795
enum quiche_path_event_type quiche_path_event_type(quiche_path_event *ev);

quiche/src/ffi.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -1609,13 +1609,13 @@ pub extern fn quiche_conn_is_path_validated(
16091609
#[no_mangle]
16101610
pub extern fn quiche_conn_probe_path(
16111611
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
1612-
peer: &sockaddr, peer_len: socklen_t, seq: *mut u64,
1612+
peer: &sockaddr, peer_len: socklen_t, path_id: *mut u64, cid_seq: *mut u64,
16131613
) -> c_int {
16141614
let local = std_addr_from_c(local, local_len);
16151615
let peer = std_addr_from_c(peer, peer_len);
16161616
match conn.probe_path(local, peer) {
16171617
Ok(v) => {
1618-
unsafe { *seq = v }
1618+
unsafe { (*path_id, *cid_seq) = v }
16191619
0
16201620
},
16211621
Err(e) => e.to_c() as c_int,
@@ -1624,12 +1624,13 @@ pub extern fn quiche_conn_probe_path(
16241624

16251625
#[no_mangle]
16261626
pub extern fn quiche_conn_migrate_source(
1627-
conn: &mut Connection, local: &sockaddr, local_len: socklen_t, seq: *mut u64,
1627+
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
1628+
path_id: *mut u64, cid_seq: *mut u64,
16281629
) -> c_int {
16291630
let local = std_addr_from_c(local, local_len);
16301631
match conn.migrate_source(local) {
16311632
Ok(v) => {
1632-
unsafe { *seq = v }
1633+
unsafe { (*path_id, *cid_seq) = v }
16331634
0
16341635
},
16351636
Err(e) => e.to_c() as c_int,
@@ -1639,13 +1640,13 @@ pub extern fn quiche_conn_migrate_source(
16391640
#[no_mangle]
16401641
pub extern fn quiche_conn_migrate(
16411642
conn: &mut Connection, local: &sockaddr, local_len: socklen_t,
1642-
peer: &sockaddr, peer_len: socklen_t, seq: *mut u64,
1643+
peer: &sockaddr, peer_len: socklen_t, path_id: *mut u64, cid_seq: *mut u64,
16431644
) -> c_int {
16441645
let local = std_addr_from_c(local, local_len);
16451646
let peer = std_addr_from_c(peer, peer_len);
16461647
match conn.migrate(local, peer) {
16471648
Ok(v) => {
1648-
unsafe { *seq = v }
1649+
unsafe { (*path_id, *cid_seq) = v }
16491650
0
16501651
},
16511652
Err(e) => e.to_c() as c_int,
@@ -1654,10 +1655,13 @@ pub extern fn quiche_conn_migrate(
16541655

16551656
#[no_mangle]
16561657
pub extern fn quiche_conn_path_event_next(
1657-
conn: &mut Connection,
1658+
conn: &mut Connection, path_id: *mut u64,
16581659
) -> *const PathEvent {
16591660
match conn.path_event_next() {
1660-
Some(v) => Box::into_raw(Box::new(v)),
1661+
Some((pid, e)) => {
1662+
unsafe { *path_id = pid }
1663+
Box::into_raw(Box::new(e))
1664+
},
16611665
None => ptr::null(),
16621666
}
16631667
}
@@ -1676,6 +1680,8 @@ pub extern fn quiche_path_event_type(ev: &PathEvent) -> u32 {
16761680
PathEvent::ReusedSourceConnectionId { .. } => 4,
16771681

16781682
PathEvent::PeerMigrated { .. } => 5,
1683+
1684+
PathEvent::PeerPathStatus { .. } => 6,
16791685
}
16801686
}
16811687

@@ -1734,7 +1740,7 @@ pub extern fn quiche_path_event_closed(
17341740
peer_addr_len: &mut socklen_t,
17351741
) {
17361742
match ev {
1737-
PathEvent::Closed(local, peer) => {
1743+
PathEvent::Closed(local, peer, ..) => {
17381744
*local_addr_len = std_addr_to_c(local, local_addr);
17391745
*peer_addr_len = std_addr_to_c(peer, peer_addr)
17401746
},

quiche/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ impl Error {
707707
Error::CryptoBufferExceeded => -20,
708708
Error::UnavailablePath => -21,
709709
Error::MultiPathViolation => -22,
710+
Error::OutOfPathId => -23,
710711
}
711712
}
712713
}

0 commit comments

Comments
 (0)