public unsafe static SshKeyHandle?ssh_get_server_publickey(SessionHandle session) { IntPtr pkey; int rv = ssh_get_server_publickey(session, &pkey); return(rv == SSH_OK ? new SshKeyHandle(pkey, ownsHandle: true) : null); }
public unsafe static bool ssh_options_set(SessionHandle session, SshOption option, string value) { // TODO: stackalloc fixed(byte *p = Encoding.UTF8.GetBytes(value)) { return(ssh_options_set(session, option, new IntPtr(p)) == 0); } }
public static IntPtr ssh_get_fd(SessionHandle session) { if (Platform.IsWindows) { return(ssh_get_fd_windows(session)); } else { return(new IntPtr(ssh_get_fd_unix(session))); } }
public static extern int ssh_options_set(SessionHandle session, SshOption option, IntPtr value);
public static extern AuthResult ssh_userauth_publickey(SessionHandle session, string?username, SshKeyHandle privkey);
public static extern PollFlags ssh_get_poll_flags(SessionHandle session);
public static bool ssh_get_error_is_fatal(SessionHandle session) => ssh_get_error_code(session) == SSH_FATAL;
public static string ssh_get_error(SessionHandle session) { return(Marshal.PtrToStringAnsi(ssh_get_error_(session)) ?? "Uknown error."); }
public static extern AuthResult ssh_userauth_password(SessionHandle session, string username, string password);
public static extern KnownHostResult ssh_session_is_known_server(SessionHandle session);
public static extern AuthResult ssh_userauth_publickey_auto(SessionHandle session, string?username, string?passphrase);
public static extern int ssh_event_remove_session(EventHandle @event, SessionHandle session);
public static extern int ssh_blocking_flush(SessionHandle session, int timeout);
private static extern int ssh_get_fd_unix(SessionHandle session);
private static extern IntPtr ssh_get_fd_windows(SessionHandle session);
public unsafe static bool ssh_options_set(SessionHandle session, SshOption option, uint value) { return(ssh_options_set(session, option, new IntPtr(&value)) == 0); }
public static extern int ssh_disconnect(SessionHandle session);
private static extern int ssh_is_connected_(SessionHandle session);
public static extern IntPtr ssh_get_error_(SessionHandle session);
public static bool ssh_is_connected(SessionHandle session) { return(ssh_is_connected_(session) == 1); }
public static extern int ssh_get_error_code(SessionHandle session);
private static unsafe extern int ssh_get_server_publickey(SessionHandle session, IntPtr *pkey);
public static extern ChannelHandle ssh_channel_new(SessionHandle session);
public static extern void ssh_set_blocking(SessionHandle session, int blocking);