@@ -87,12 +87,13 @@ fn dial_without_cred(
8787
8888fn dial_with_cred (
8989 uri : String ,
90+ entity : Option < String > ,
9091 r#type : & str ,
9192 payload : & str ,
9293 allow_insec : bool ,
9394 disable_webrtc : bool ,
9495) -> Result < DialBuilder < WithCredentials > > {
95- let creds = RPCCredentials :: new ( None , String :: from ( r#type) , String :: from ( payload) ) ;
96+ let creds = RPCCredentials :: new ( entity , String :: from ( r#type) , String :: from ( payload) ) ;
9697 let c = DialOptions :: builder ( ) . uri ( & uri) . with_credentials ( creds) ;
9798 let c = if disable_webrtc {
9899 c. disable_webrtc ( )
@@ -117,6 +118,7 @@ fn dial_with_cred(
117118#[ no_mangle]
118119pub unsafe extern "C" fn dial (
119120 c_uri : * const c_char ,
121+ c_entity : * const c_char ,
120122 c_type : * const c_char ,
121123 c_payload : * const c_char ,
122124 c_allow_insec : bool ,
@@ -184,11 +186,25 @@ pub unsafe extern "C" fn dial(
184186 false => Some ( CStr :: from_ptr ( c_payload) ) ,
185187 }
186188 } ;
189+ let entity_opt = {
190+ match c_entity. is_null ( ) {
191+ true => None ,
192+ false => match CStr :: from_ptr ( c_entity) . to_str ( ) {
193+ Ok ( ent) => Some ( ent. to_string ( ) ) ,
194+ Err ( e) => {
195+ log:: error!( "Error unexpectedly received an invalid entity string {:?}" , e) ;
196+ return ptr:: null_mut ( ) ;
197+ }
198+ }
199+ }
200+ } ;
201+
187202 let ( server, channel) = match runtime. block_on ( async move {
188203 let channel = match ( r#type, payload) {
189204 ( Some ( t) , Some ( p) ) => {
190205 dial_with_cred (
191206 uri_str,
207+ entity_opt,
192208 t. to_str ( ) ?,
193209 p. to_str ( ) ?,
194210 allow_insec,
0 commit comments