Skip to content

Commit 1a2f98e

Browse files
committed
Add the missing libssh2_publickey_* and libssh2_sftp_* functions.
These weren't mapped in the first pass. Fixes: #2
1 parent 5a5e897 commit 1a2f98e

File tree

3 files changed

+590
-1
lines changed

3 files changed

+590
-1
lines changed

doc/libssh2.md

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,36 @@ libssh2 | clj-libssh2
7878
`LIBSSH2_ERROR_ZLIB` | `clj-libssh2.libssh2/ERROR_ZLIB`
7979
`LIBSSH2_FLAG_COMPRESS` | `clj-libssh2.libssh2/FLAG_COMPRESS`
8080
`LIBSSH2_FLAG_SIGPIPE` | `clj-libssh2.libssh2/FLAG_SIGPIPE`
81+
`LIBSSH2_FXF_APPEND` | `clj-libssh2.libssh2.sftp/FXF_APPEND`
82+
`LIBSSH2_FXF_CREAT` | `clj-libssh2.libssh2.sftp/FXF_CREAT`
83+
`LIBSSH2_FXF_EXCL` | `clj-libssh2.libssh2.sftp/FXF_EXCL`
84+
`LIBSSH2_FXF_READ` | `clj-libssh2.libssh2.sftp/FXF_READ`
85+
`LIBSSH2_FXF_TRUNC` | `clj-libssh2.libssh2.sftp/FXF_TRUNC`
86+
`LIBSSH2_FXF_WRITE` | `clj-libssh2.libssh2.sftp/FXF_WRITE`
87+
`LIBSSH2_FX_BAD_MESSAGE` | `clj-libssh2.libssh2.sftp/FX_BAD_MESSAGE`
88+
`LIBSSH2_FX_CONNECTION_LOST` | `clj-libssh2.libssh2.sftp/FX_CONNECTION_LOST`
89+
`LIBSSH2_FX_DIR_NOT_EMPTY` | `clj-libssh2.libssh2.sftp/FX_DIR_NOT_EMPTY`
90+
`LIBSSH2_FX_EOF` | `clj-libssh2.libssh2.sftp/FX_EOF`
91+
`LIBSSH2_FX_FAILURE` | `clj-libssh2.libssh2.sftp/FX_FAILURE`
92+
`LIBSSH2_FX_FILE_ALREADY_EXISTS` | `clj-libssh2.libssh2.sftp/FX_FILE_ALREADY_EXISTS`
93+
`LIBSSH2_FX_INVALID_FILENAME` | `clj-libssh2.libssh2.sftp/FX_INVALID_FILENAME`
94+
`LIBSSH2_FX_INVALID_HANDLE` | `clj-libssh2.libssh2.sftp/FX_INVALID_HANDLE`
95+
`LIBSSH2_FX_LINK_LOOP` | `clj-libssh2.libssh2.sftp/FX_LINK_LOOP`
96+
`LIBSSH2_FX_LOCK_CONFLICT` | `clj-libssh2.libssh2.sftp/FX_LOCK_CONFLICT`
97+
`LIBSSH2_FX_LOCK_CONFlICT` | `clj-libssh2.libssh2.sftp/FX_LOCK_CONFlICT`
98+
`LIBSSH2_FX_NOT_A_DIRECTORY` | `clj-libssh2.libssh2.sftp/FX_NOT_A_DIRECTORY`
99+
`LIBSSH2_FX_NO_CONNECTION` | `clj-libssh2.libssh2.sftp/FX_NO_CONNECTION`
100+
`LIBSSH2_FX_NO_MEDIA` | `clj-libssh2.libssh2.sftp/FX_NO_MEDIA`
101+
`LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM` | `clj-libssh2.libssh2.sftp/FX_NO_SPACE_ON_FILESYSTEM`
102+
`LIBSSH2_FX_NO_SUCH_FILE` | `clj-libssh2.libssh2.sftp/FX_NO_SUCH_FILE`
103+
`LIBSSH2_FX_NO_SUCH_PATH` | `clj-libssh2.libssh2.sftp/FX_NO_SUCH_PATH`
104+
`LIBSSH2_FX_OK` | `clj-libssh2.libssh2.sftp/FX_OK`
105+
`LIBSSH2_FX_OP_UNSUPPORTED` | `clj-libssh2.libssh2.sftp/FX_OP_UNSUPPORTED`
106+
`LIBSSH2_FX_PERMISSION_DENIED` | `clj-libssh2.libssh2.sftp/FX_PERMISSION_DENIED`
107+
`LIBSSH2_FX_QUOTA_EXCEEDED` | `clj-libssh2.libssh2.sftp/FX_QUOTA_EXCEEDED`
108+
`LIBSSH2_FX_UNKNOWN_PRINCIPAL` | `clj-libssh2.libssh2.sftp/FX_UNKNOWN_PRINCIPAL`
109+
`LIBSSH2_FX_UNKNOWN_PRINCIPLE` | `clj-libssh2.libssh2.sftp/FX_UNKNOWN_PRINCIPLE`
110+
`LIBSSH2_FX_WRITE_PROTECT` | `clj-libssh2.libssh2.sftp/FX_WRITE_PROTECT`
81111
`LIBSSH2_HOSTKEY_HASH_MD5` | `clj-libssh2.libssh2/HOSTKEY_HASH_MD5`
82112
`LIBSSH2_HOSTKEY_HASH_SHA1` | `clj-libssh2.libssh2/HOSTKEY_HASH_SHA1`
83113
`LIBSSH2_HOSTKEY_TYPE_DSS` | `clj-libssh2.libssh2/HOSTKEY_TYPE_DSS`
@@ -131,6 +161,53 @@ libssh2 | clj-libssh2
131161
`LIBSSH2_POLLFD_SOCKET` | `clj-libssh2.libssh2/POLLFD_SOCKET`
132162
`LIBSSH2_SESSION_BLOCK_INBOUND` | `clj-libssh2.libssh2/SESSION_BLOCK_INBOUND`
133163
`LIBSSH2_SESSION_BLOCK_OUTBOUND` | `clj-libssh2.libssh2/SESSION_BLOCK_OUTBOUND`
164+
`LIBSSH2_SFTP_ATTR_ACMODTIME` | `clj-libssh2.libssh2.sftp/ATTR_ACMODTIME`
165+
`LIBSSH2_SFTP_ATTR_EXTENDED` | `clj-libssh2.libssh2.sftp/ATTR_EXTENDED`
166+
`LIBSSH2_SFTP_ATTR_PERMISSIONS` | `clj-libssh2.libssh2.sftp/ATTR_PERMISSIONS`
167+
`LIBSSH2_SFTP_ATTR_SIZE` | `clj-libssh2.libssh2.sftp/ATTR_SIZE`
168+
`LIBSSH2_SFTP_ATTR_UIDGID` | `clj-libssh2.libssh2.sftp/ATTR_UIDGID`
169+
`LIBSSH2_SFTP_LSTAT` | `clj-libssh2.libssh2.sftp/LSTAT`
170+
`LIBSSH2_SFTP_OPENDIR` | `clj-libssh2.libssh2.sftp/OPENDIR`
171+
`LIBSSH2_SFTP_OPENFILE` | `clj-libssh2.libssh2.sftp/OPENFILE`
172+
`LIBSSH2_SFTP_READLINK` | `clj-libssh2.libssh2.sftp/READLINK`
173+
`LIBSSH2_SFTP_REALPATH` | `clj-libssh2.libssh2.sftp/REALPATH`
174+
`LIBSSH2_SFTP_RENAME_ATOMIC` | `clj-libssh2.libssh2.sftp/RENAME_ATOMIC`
175+
`LIBSSH2_SFTP_RENAME_NATIVE` | `clj-libssh2.libssh2.sftp/RENAME_NATIVE`
176+
`LIBSSH2_SFTP_RENAME_OVERWRITE` | `clj-libssh2.libssh2.sftp/RENAME_OVERWRITE`
177+
`LIBSSH2_SFTP_SETSTAT` | `clj-libssh2.libssh2.sftp/SETSTAT`
178+
`LIBSSH2_SFTP_STAT` | `clj-libssh2.libssh2.sftp/STAT`
179+
`LIBSSH2_SFTP_ST_NOSUID` | `clj-libssh2.libssh2.sftp/ST_NOSUID`
180+
`LIBSSH2_SFTP_ST_RDONLY` | `clj-libssh2.libssh2.sftp/ST_RDONLY`
181+
`LIBSSH2_SFTP_SYMLINK` | `clj-libssh2.libssh2.sftp/SYMLINK`
182+
`LIBSSH2_SFTP_S_IFBLK` | `clj-libssh2.libssh2.sftp/S_IFBLK`
183+
`LIBSSH2_SFTP_S_IFCHR` | `clj-libssh2.libssh2.sftp/S_IFCHR`
184+
`LIBSSH2_SFTP_S_IFDIR` | `clj-libssh2.libssh2.sftp/S_IFDIR`
185+
`LIBSSH2_SFTP_S_IFIFO` | `clj-libssh2.libssh2.sftp/S_IFIFO`
186+
`LIBSSH2_SFTP_S_IFLNK` | `clj-libssh2.libssh2.sftp/S_IFLNK`
187+
`LIBSSH2_SFTP_S_IFMT` | `clj-libssh2.libssh2.sftp/S_IFMT`
188+
`LIBSSH2_SFTP_S_IFREG` | `clj-libssh2.libssh2.sftp/S_IFREG`
189+
`LIBSSH2_SFTP_S_IFSOCK` | `clj-libssh2.libssh2.sftp/S_IFSOCK`
190+
`LIBSSH2_SFTP_S_IRGRP` | `clj-libssh2.libssh2.sftp/S_IRGRP`
191+
`LIBSSH2_SFTP_S_IROTH` | `clj-libssh2.libssh2.sftp/S_IROTH`
192+
`LIBSSH2_SFTP_S_IRUSR` | `clj-libssh2.libssh2.sftp/S_IRUSR`
193+
`LIBSSH2_SFTP_S_IRWXG` | `clj-libssh2.libssh2.sftp/S_IRWXG`
194+
`LIBSSH2_SFTP_S_IRWXO` | `clj-libssh2.libssh2.sftp/S_IRWXO`
195+
`LIBSSH2_SFTP_S_IRWXU` | `clj-libssh2.libssh2.sftp/S_IRWXU`
196+
`LIBSSH2_SFTP_S_IWGRP` | `clj-libssh2.libssh2.sftp/S_IWGRP`
197+
`LIBSSH2_SFTP_S_IWOTH` | `clj-libssh2.libssh2.sftp/S_IWOTH`
198+
`LIBSSH2_SFTP_S_IWUSR` | `clj-libssh2.libssh2.sftp/S_IWUSR`
199+
`LIBSSH2_SFTP_S_IXGRP` | `clj-libssh2.libssh2.sftp/S_IXGRP`
200+
`LIBSSH2_SFTP_S_IXOTH` | `clj-libssh2.libssh2.sftp/S_IXOTH`
201+
`LIBSSH2_SFTP_S_IXUSR` | `clj-libssh2.libssh2.sftp/S_IXUSR`
202+
`LIBSSH2_SFTP_TYPE_BLOCK_DEVICE` | `clj-libssh2.libssh2.sftp/TYPE_BLOCK_DEVICE`
203+
`LIBSSH2_SFTP_TYPE_CHAR_DEVICE` | `clj-libssh2.libssh2.sftp/TYPE_CHAR_DEVICE`
204+
`LIBSSH2_SFTP_TYPE_DIRECTORY` | `clj-libssh2.libssh2.sftp/TYPE_DIRECTORY`
205+
`LIBSSH2_SFTP_TYPE_FIFO` | `clj-libssh2.libssh2.sftp/TYPE_FIFO`
206+
`LIBSSH2_SFTP_TYPE_REGULAR` | `clj-libssh2.libssh2.sftp/TYPE_REGULAR`
207+
`LIBSSH2_SFTP_TYPE_SOCKET` | `clj-libssh2.libssh2.sftp/TYPE_SOCKET`
208+
`LIBSSH2_SFTP_TYPE_SPECIAL` | `clj-libssh2.libssh2.sftp/TYPE_SPECIAL`
209+
`LIBSSH2_SFTP_TYPE_SYMLINK` | `clj-libssh2.libssh2.sftp/TYPE_SYMLINK`
210+
`LIBSSH2_SFTP_TYPE_UNKNOWN` | `clj-libssh2.libssh2.sftp/TYPE_UNKNOWN`
134211
`LIBSSH2_SOCKET_POLL_MAXLOOPS` | `clj-libssh2.libssh2/SOCKET_POLL_MAXLOOPS`
135212
`LIBSSH2_SOCKET_POLL_UDELAY` | `clj-libssh2.libssh2/SOCKET_POLL_UDELAY`
136213
`LIBSSH2_SSH_BANNER` | `clj-libssh2.libssh2/SSH_BANNER`
@@ -246,6 +323,14 @@ libssh2 | clj-libssh2
246323
`libssh2_knownhost_readline` | `clj-libssh2.libssh2.knownhost/readline`
247324
`libssh2_knownhost_writefile` | `clj-libssh2.libssh2.knownhost/writefile`
248325
`libssh2_knownhost_writeline` | `clj-libssh2.libssh2.knownhost/writeline`
326+
`libssh2_publickey_add` | `clj-libssh2.libssh2.publickey/add`
327+
`libssh2_publickey_add_ex` | `clj-libssh2.libssh2.publickey/add-ex`
328+
`libssh2_publickey_init` | `clj-libssh2.libssh2.publickey/init`
329+
`libssh2_publickey_list_fetch` | `clj-libssh2.libssh2.publickey/list-fetch`
330+
`libssh2_publickey_list_free` | `clj-libssh2.libssh2.publickey/list-free`
331+
`libssh2_publickey_remove` | `clj-libssh2.libssh2.publickey/remove`
332+
`libssh2_publickey_remove_ex` | `clj-libssh2.libssh2.publickey/remove-ex`
333+
`libssh2_publickey_shutdown` | `clj-libssh2.libssh2.publickey/shutdown`
249334
`libssh2_scp_recv` | `clj-libssh2.libssh2.scp/recv`
250335
`libssh2_scp_send64` | `clj-libssh2.libssh2.scp/send64`
251336
`libssh2_session_abstract` | `clj-libssh2.libssh2.session/abstract`
@@ -270,6 +355,45 @@ libssh2 | clj-libssh2
270355
`libssh2_session_set_blocking` | `clj-libssh2.libssh2.session/set-blocking`
271356
`libssh2_session_set_timeout` | `clj-libssh2.libssh2.session/set-timeout`
272357
`libssh2_session_supported_algs` | `clj-libssh2.libssh2.session/supported-algs`
358+
`libssh2_sftp_close` | `clj-libssh2.libssh2.sftp/close`
359+
`libssh2_sftp_close_handle` | `clj-libssh2.libssh2.sftp/close-handle`
360+
`libssh2_sftp_closedir` | `clj-libssh2.libssh2.sftp/closedir`
361+
`libssh2_sftp_fsetstat` | `clj-libssh2.libssh2.sftp/fsetstat`
362+
`libssh2_sftp_fstat` | `clj-libssh2.libssh2.sftp/fstat`
363+
`libssh2_sftp_fstat_ex` | `clj-libssh2.libssh2.sftp/fstat-ex`
364+
`libssh2_sftp_fstatvfs` | `clj-libssh2.libssh2.sftp/fstatvfs`
365+
`libssh2_sftp_fsync` | `clj-libssh2.libssh2.sftp/fsync`
366+
`libssh2_sftp_get_channel` | `clj-libssh2.libssh2.sftp/get-channel`
367+
`libssh2_sftp_init` | `clj-libssh2.libssh2.sftp/init`
368+
`libssh2_sftp_last_error` | `clj-libssh2.libssh2.sftp/last-error`
369+
`libssh2_sftp_lstat` | `clj-libssh2.libssh2.sftp/lstat`
370+
`libssh2_sftp_mkdir` | `clj-libssh2.libssh2.sftp/mkdir`
371+
`libssh2_sftp_mkdir_ex` | `clj-libssh2.libssh2.sftp/mkdir-ex`
372+
`libssh2_sftp_open` | `clj-libssh2.libssh2.sftp/open`
373+
`libssh2_sftp_open_ex` | `clj-libssh2.libssh2.sftp/open-ex`
374+
`libssh2_sftp_opendir` | `clj-libssh2.libssh2.sftp/opendir`
375+
`libssh2_sftp_read` | `clj-libssh2.libssh2.sftp/read`
376+
`libssh2_sftp_readdir` | `clj-libssh2.libssh2.sftp/readdir`
377+
`libssh2_sftp_readdir_ex` | `clj-libssh2.libssh2.sftp/readdir-ex`
378+
`libssh2_sftp_readlink` | `clj-libssh2.libssh2.sftp/readlink`
379+
`libssh2_sftp_realpath` | `clj-libssh2.libssh2.sftp/realpath`
380+
`libssh2_sftp_rename` | `clj-libssh2.libssh2.sftp/rename`
381+
`libssh2_sftp_rename_ex` | `clj-libssh2.libssh2.sftp/rename-ex`
382+
`libssh2_sftp_rewind` | `clj-libssh2.libssh2.sftp/rewind`
383+
`libssh2_sftp_rmdir` | `clj-libssh2.libssh2.sftp/rmdir`
384+
`libssh2_sftp_rmdir_ex` | `clj-libssh2.libssh2.sftp/rmdir-ex`
385+
`libssh2_sftp_seek64` | `clj-libssh2.libssh2.sftp/seek64`
386+
`libssh2_sftp_setstat` | `clj-libssh2.libssh2.sftp/setstat`
387+
`libssh2_sftp_shutdown` | `clj-libssh2.libssh2.sftp/shutdown`
388+
`libssh2_sftp_stat` | `clj-libssh2.libssh2.sftp/stat`
389+
`libssh2_sftp_stat_ex` | `clj-libssh2.libssh2.sftp/stat-ex`
390+
`libssh2_sftp_statvfs` | `clj-libssh2.libssh2.sftp/statvfs`
391+
`libssh2_sftp_symlink` | `clj-libssh2.libssh2.sftp/symlink`
392+
`libssh2_sftp_symlink_ex` | `clj-libssh2.libssh2.sftp/symlink-ex`
393+
`libssh2_sftp_tell64` | `clj-libssh2.libssh2.sftp/tell64`
394+
`libssh2_sftp_unlink` | `clj-libssh2.libssh2.sftp/unlink`
395+
`libssh2_sftp_unlink_ex` | `clj-libssh2.libssh2.sftp/unlink-ex`
396+
`libssh2_sftp_write` | `clj-libssh2.libssh2.sftp/write`
273397
`libssh2_trace` | `clj-libssh2.libssh2/trace`
274398
`libssh2_trace_sethandler` | `clj-libssh2.libssh2/trace-sethandler`
275399
`libssh2_userauth_authenticated` | `clj-libssh2.libssh2.userauth/authenticated`
@@ -301,6 +425,8 @@ libssh2 | clj-libssh2
301425
`libssh2_knownhost_add` | `clj-libssh2.libssh2.knownhost/add`
302426
`libssh2_poll` | `clj-libssh2.libssh2/poll`
303427
`libssh2_poll_channel_read` | `clj-libssh2.libssh2/poll-channel-read`
304-
`libssh2_scp_send_ex` | `clj-libssh2.libssh2.scp/send-ex`
305428
`libssh2_scp_send` | `clj-libssh2.libssh2.scp/send`
429+
`libssh2_scp_send_ex` | `clj-libssh2.libssh2.scp/send-ex`
306430
`libssh2_session_startup` | `clj-libssh2.libssh2.session/startup`
431+
`libssh2_sftp_seek` | `clj-libssh2.libssh2.sftp/seek`
432+
`libssh2_sftp_tell` | `clj-libssh2.libssh2.sftp/tell`

src/clj_libssh2/libssh2/publickey.clj

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
(ns clj-libssh2.libssh2.publickey
2+
"Functions for using the publickey subsystem. (RFC 4819)"
3+
(:refer-clojure :exclude [remove])
4+
(:require [net.n01se.clojure-jna :as jna])
5+
(:import [com.sun.jna Pointer]))
6+
7+
(def ^{:arglists '([pkey name name-len blob blob-len overwrite num-attrs attrs])} add-ex
8+
"
9+
int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey,
10+
const unsigned char *name,
11+
unsigned long name_len,
12+
const unsigned char *blob,
13+
unsigned long blob_len,
14+
char overwrite,
15+
unsigned long num_attrs,
16+
const libssh2_publickey_attribute attrs[]);"
17+
(jna/to-fn Integer ssh2/libssh2_publickey_add_ex))
18+
19+
(defn add
20+
"
21+
int libssh2_publickey_add(LIBSSH2_PUBLICKEY *pkey,
22+
const unsigned char *name,
23+
const unsigned char *blob,
24+
unsigned long blob_len,
25+
char overwrite,
26+
unsigned long num_attrs,
27+
const libssh2_publickey_attribute attrs[]);"
28+
[pkey name blob blob-len overwrite num-attrs attrs]
29+
(add-ex pkey name (count name) blob blob-len overwrite num-attrs attrs))
30+
31+
(def ^{:arglists '([session])} init
32+
"LIBSSH2_PUBLICKEY *libssh2_publickey_init(LIBSSH2_SESSION *session);"
33+
(jna/to-fn Pointer ssh2/libssh2_publickey_init))
34+
35+
(def ^{:arglists '([pkey num-keys pkey-list])} list-fetch
36+
"
37+
int libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey,
38+
unsigned long *num_keys,
39+
libssh2_publickey_list **pkey_list);"
40+
(jna/to-fn Integer ssh2/libssh2_publickey_list_fetch))
41+
42+
(def ^{:arglists '([pkey pkey-list])} list-free
43+
"
44+
void libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey,
45+
libssh2_publickey_list *pkey_list);"
46+
(jna/to-fn Void ssh2/libssh2_publickey_list_free))
47+
48+
(def ^{:arglists '([pkey name name-len blob blob-len])} remove-ex
49+
"
50+
int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey,
51+
const unsigned char *name,
52+
unsigned long name_len,
53+
const unsigned char *blob,
54+
unsigned long blob_len);"
55+
(jna/to-fn Integer ssh2/libssh2_publickey_remove_ex))
56+
57+
(defn remove
58+
"
59+
int libssh2_publickey_remove(LIBSSH2_PUBLICKEY *pkey,
60+
const unsigned char *name,
61+
const unsigned char *blob,
62+
unsigned long blob_len);"
63+
[pkey name blob blob-len]
64+
(remove-ex pkey name (count name) blob blob-len))
65+
66+
(def ^{:arglists '([pkey])} shutdown
67+
"int libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey);"
68+
(jna/to-fn Integer ssh2/libssh2_publickey_shutdown))

0 commit comments

Comments
 (0)