@@ -374,15 +374,15 @@ impl Agent {
374374 }
375375 }
376376
377- pub fn make_connection ( & self , remote_agent : & str ) -> Result < ( ) , NixlError > {
377+ pub fn make_connection ( & self , remote_agent : & str , opt_args : Option < & OptArgs > ) -> Result < ( ) , NixlError > {
378378 let remote_agent = CString :: new ( remote_agent) ?;
379379 let inner_guard = self . inner . write ( ) . unwrap ( ) ;
380380
381381 let status = unsafe {
382382 nixl_capi_agent_make_connection (
383383 inner_guard. handle . as_ptr ( ) ,
384384 remote_agent. as_ptr ( ) ,
385- std:: ptr:: null_mut ( ) ,
385+ opt_args . map_or ( std:: ptr:: null_mut ( ) , |args| args . inner . as_ptr ( ) ) ,
386386 )
387387 } ;
388388
@@ -393,6 +393,64 @@ impl Agent {
393393 }
394394 }
395395
396+ pub fn prepare_xfer_dlist (
397+ & self ,
398+ agent_name : & str ,
399+ descs : & XferDescList ,
400+ opt_args : Option < & OptArgs > ,
401+ ) -> Result < XferDlistHandle , NixlError > {
402+ let c_agent_name = CString :: new ( agent_name) ?;
403+ let mut dlist_hndl = std:: ptr:: null_mut ( ) ;
404+ let inner_guard = self . inner . read ( ) . unwrap ( ) ;
405+
406+ let status = unsafe {
407+ nixl_capi_prep_xfer_dlist (
408+ inner_guard. handle . as_ptr ( ) ,
409+ c_agent_name. as_ptr ( ) ,
410+ descs. handle ( ) ,
411+ & mut dlist_hndl,
412+ opt_args. map_or ( std:: ptr:: null_mut ( ) , |args| args. inner . as_ptr ( ) ) ,
413+ )
414+ } ;
415+
416+ match status {
417+ NIXL_CAPI_SUCCESS => Ok ( XferDlistHandle :: new ( dlist_hndl, inner_guard. handle ) ) ,
418+ _ => Err ( NixlError :: BackendError ) ,
419+ }
420+ }
421+
422+ pub fn make_xfer_req ( & self , operation : XferOp ,
423+ local_descs : & XferDlistHandle , local_indices : & [ i32 ] ,
424+ remote_descs : & XferDlistHandle , remote_indices : & [ i32 ] ,
425+ opt_args : Option < & OptArgs > ) -> Result < XferRequest , NixlError > {
426+ let mut req = std:: ptr:: null_mut ( ) ;
427+ let inner_guard = self . inner . read ( ) . unwrap ( ) ;
428+
429+ let status = unsafe {
430+ nixl_capi_make_xfer_req (
431+ inner_guard. handle . as_ptr ( ) ,
432+ operation as bindings:: nixl_capi_xfer_op_t ,
433+ local_descs. handle ( ) ,
434+ local_indices. as_ptr ( ) ,
435+ local_indices. len ( ) as usize ,
436+ remote_descs. handle ( ) ,
437+ remote_indices. as_ptr ( ) ,
438+ remote_indices. len ( ) as usize ,
439+ & mut req,
440+ opt_args. map_or ( std:: ptr:: null_mut ( ) , |args| args. inner . as_ptr ( ) )
441+ )
442+ } ;
443+
444+ match status {
445+ NIXL_CAPI_SUCCESS => Ok ( XferRequest :: new ( NonNull :: new ( req)
446+ . ok_or ( NixlError :: FailedToCreateXferRequest ) ?,
447+ self . inner . clone ( ) ,
448+ ) ) ,
449+ NIXL_CAPI_ERROR_INVALID_PARAM => Err ( NixlError :: InvalidParam ) ,
450+ _ => Err ( NixlError :: BackendError ) ,
451+ }
452+ }
453+
396454 /// Check if remote metadata for a specific agent is available
397455 ///
398456 /// This function checks if the metadata for the specified remote agent has been
0 commit comments