1 module libssh.c_bindings.legacy;
2 
3 import libssh.c_bindings.libssh;
4 import libssh.c_bindings.ctypes;
5 
6 struct ssh_private_key_struct { }
7 struct ssh_public_key_struct { }
8 alias ssh_private_key = ssh_private_key_struct*;
9 alias ssh_public_key = ssh_public_key_struct*;
10 
11 extern (C) {
12     int ssh_auth_list(ssh_session session);
13     int ssh_userauth_offer_pubkey(ssh_session session, const char *username, int type, 
14         ssh_string publickey);
15     int ssh_userauth_pubkey(ssh_session session, const char *username, ssh_string publickey, 
16         ssh_private_key privatekey);
17 
18     version (Windows) {
19         int ssh_userauth_agent_pubkey(ssh_session session, const char *username,
20             ssh_public_key publickey);
21     }
22 
23     int ssh_userauth_autopubkey(ssh_session session, const char *passphrase);
24     int ssh_userauth_privatekey_file(ssh_session session, const char *username,
25         const char *filename, const char *passphrase);
26 
27     deprecated {
28         void buffer_free(ssh_buffer buffer);
29         void *buffer_get(ssh_buffer buffer);
30         uint buffer_get_len(ssh_buffer buffer);
31         ssh_buffer buffer_new();
32         
33         ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms);
34         int channel_change_pty_size(ssh_channel channel,int cols,int rows);
35         ssh_channel channel_forward_accept(ssh_session session, int timeout_ms);
36         int channel_close(ssh_channel channel);
37         int channel_forward_cancel(ssh_session session, const char *address, int port);
38         int channel_forward_listen(ssh_session session, const char *address, int port, 
39             int *bound_port);
40         void channel_free(ssh_channel channel);
41         int channel_get_exit_status(ssh_channel channel);
42         ssh_session channel_get_session(ssh_channel channel);
43         int channel_is_closed(ssh_channel channel);
44         int channel_is_eof(ssh_channel channel);
45         int channel_is_open(ssh_channel channel);
46         ssh_channel channel_new(ssh_session session);
47         int channel_open_forward(ssh_channel channel, const char *remotehost,
48             int remoteport, const char *sourcehost, int localport);
49         int channel_open_session(ssh_channel channel);
50         int channel_poll(ssh_channel channel, int is_stderr);
51         int channel_read(ssh_channel channel, void *dest, uint count, int is_stderr);
52         
53         int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint count,
54             int is_stderr);
55         
56         int channel_read_nonblocking(ssh_channel channel, void *dest, uint count,
57             int is_stderr);
58         int channel_request_env(ssh_channel channel, const char *name, const char *value);
59         int channel_request_exec(ssh_channel channel, const char *cmd);
60         int channel_request_pty(ssh_channel channel);
61         int channel_request_pty_size(ssh_channel channel, const char *term,
62             int cols, int rows);
63         int channel_request_shell(ssh_channel channel);
64         int channel_request_send_signal(ssh_channel channel, const char *signum);
65         int channel_request_sftp(ssh_channel channel);
66         int channel_request_subsystem(ssh_channel channel, const char *subsystem);
67         int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
68             const char *cookie, int screen_number);
69         int channel_send_eof(ssh_channel channel);
70         int channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, 
71             timeval * timeout);
72         void channel_set_blocking(ssh_channel channel, int blocking);
73         int channel_write(ssh_channel channel, const void *data, uint len);
74     }
75 
76     void privatekey_free(ssh_private_key prv);
77     ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
78         int type, const char *passphrase);
79     void publickey_free(ssh_public_key key);
80     int ssh_publickey_to_file(ssh_session session, const char *file,
81         ssh_string pubkey, int type);
82     ssh_string publickey_from_file(ssh_session session, const char *filename,
83         int *type);
84     ssh_public_key publickey_from_privatekey(ssh_private_key prv);
85     ssh_string publickey_to_string(ssh_public_key key);
86     int ssh_try_publickey_from_file(ssh_session session, const char *keyfile,
87         ssh_string *publickey, int *type);
88     enum ssh_keytypes_e ssh_privatekey_type(ssh_private_key privatekey);
89     
90     ssh_string ssh_get_pubkey(ssh_session session);
91     
92     ssh_message ssh_message_retrieve(ssh_session session, uint packettype);
93     ssh_public_key ssh_message_auth_publickey(ssh_message msg);
94 
95     deprecated {
96         void string_burn(ssh_string str);
97         ssh_string string_copy(ssh_string str);
98         void *string_data(ssh_string str);
99         int string_fill(ssh_string str, const void *data, size_t len);
100         void string_free(ssh_string str);
101         ssh_string string_from_char(const char *what);
102         size_t string_len(ssh_string str);
103         ssh_string string_new(size_t size);
104         char *string_to_char(ssh_string str);
105     }
106 }