aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-08-12 00:04:30 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-08-12 00:04:30 +0200
commit86418bfbbe2d6afcd630f93d5858f2d3353e12f9 (patch)
treef7e06b71df755e454cf8b5a8a20795288733867c /include
parent1e1c13f756287e14ff37b6410ef29c67494c830b (diff)
parentdb284d60b97bbee864d88737b4f8c6ae5b03c8ff (diff)
downloadlibssh-86418bfbbe2d6afcd630f93d5858f2d3353e12f9.tar.gz
libssh-86418bfbbe2d6afcd630f93d5858f2d3353e12f9.tar.xz
libssh-86418bfbbe2d6afcd630f93d5858f2d3353e12f9.zip
Merge branch 'master' of git://git.libssh.org/projects/libssh/libssh
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h310
-rw-r--r--include/libssh/priv.h14
-rw-r--r--include/libssh/server.h70
-rw-r--r--include/libssh/sftp.h90
4 files changed, 262 insertions, 222 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index bf98444..cf2ab16 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -22,22 +22,48 @@
#ifndef _LIBSSH_H
#define _LIBSSH_H
-#ifndef _MSC_VER
-#include <unistd.h>
-#include <inttypes.h>
+#ifdef LIBSSH_STATIC
+ #define LIBSSH_API
+#else
+ #if defined _WIN32 || defined __CYGWIN__
+ #ifdef LIBSSH_EXPORTS
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllexport))
+ #else
+ #define LIBSSH_API __declspec(dllexport)
+ #endif
+ #else
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllimport))
+ #else
+ #define LIBSSH_API __declspec(dllimport)
+ #endif
+ #endif
+ #else
+ #if __GNUC__ >= 4
+ #define LIBSSH_API __attribute__((visibility("default")))
+ #else
+ #define LIBSSH_API
+ #endif
+ #endif
+#endif
+
+#ifdef _MSC_VER
+ /* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */
+ typedef unsigned int uint32_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned long long uint64_t;
#else /* _MSC_VER */
-//visual studio hasn't inttypes.h so it doesn't know uint32_t
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;
-typedef unsigned long long uint64_t;
+ #include <unistd.h>
+ #include <inttypes.h>
#endif /* _MSC_VER */
#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <sys/select.h> /* for fd_set * */
-#include <netdb.h>
+ #include <winsock2.h>
+#else /* _WIN32 */
+ #include <sys/select.h> /* for fd_set * */
+ #include <netdb.h>
#endif /* _WIN32 */
#define SSH_STRINGIFY(s) SSH_TOSTRING(s)
@@ -182,11 +208,11 @@ typedef int socket_t;
#define SSH_AGAIN -2 /* The nonblocking call must be repeated */
#define SSH_EOF -127 /* We have already a eof */
-const char *ssh_get_error(void *error);
-int ssh_get_error_code(void *error);
+LIBSSH_API const char *ssh_get_error(void *error);
+LIBSSH_API int ssh_get_error_code(void *error);
/* version checks */
-const char *ssh_version(int req_version);
+LIBSSH_API const char *ssh_version(int req_version);
/** \addtogroup ssh_log
* @{
@@ -220,113 +246,113 @@ enum {
#define SSH_LOG_FUNCTIONS 4 // every function in and return
*/
/* log.c */
-void ssh_log(SSH_SESSION *session, int prioriry, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
+LIBSSH_API void ssh_log(SSH_SESSION *session, int prioriry, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
/* session.c */
-SSH_SESSION *ssh_new(void);
-socket_t ssh_get_fd(SSH_SESSION *session);
-int ssh_get_version(SSH_SESSION *session);
-int ssh_get_status(SSH_SESSION *session);
-const char *ssh_get_disconnect_message(SSH_SESSION *session);
-void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options);
-void ssh_set_fd_toread(SSH_SESSION *session);
-void ssh_set_fd_towrite(SSH_SESSION *session);
-void ssh_set_fd_except(SSH_SESSION *session);
-void ssh_set_blocking(SSH_SESSION *session, int blocking);
-void ssh_silent_disconnect(SSH_SESSION *session);
+LIBSSH_API SSH_SESSION *ssh_new(void);
+LIBSSH_API socket_t ssh_get_fd(SSH_SESSION *session);
+LIBSSH_API int ssh_get_version(SSH_SESSION *session);
+LIBSSH_API int ssh_get_status(SSH_SESSION *session);
+LIBSSH_API const char *ssh_get_disconnect_message(SSH_SESSION *session);
+LIBSSH_API void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options);
+LIBSSH_API void ssh_set_fd_toread(SSH_SESSION *session);
+LIBSSH_API void ssh_set_fd_towrite(SSH_SESSION *session);
+LIBSSH_API void ssh_set_fd_except(SSH_SESSION *session);
+LIBSSH_API void ssh_set_blocking(SSH_SESSION *session, int blocking);
+LIBSSH_API void ssh_silent_disconnect(SSH_SESSION *session);
/* client.c */
-int ssh_connect(SSH_SESSION *session);
-void ssh_disconnect(SSH_SESSION *session);
-int ssh_service_request(SSH_SESSION *session, const char *service);
-char *ssh_get_issue_banner(SSH_SESSION *session);
-int ssh_get_openssh_version(ssh_session session);
+LIBSSH_API int ssh_connect(SSH_SESSION *session);
+LIBSSH_API void ssh_disconnect(SSH_SESSION *session);
+LIBSSH_API int ssh_service_request(SSH_SESSION *session, const char *service);
+LIBSSH_API char *ssh_get_issue_banner(SSH_SESSION *session);
+LIBSSH_API int ssh_get_openssh_version(ssh_session session);
/* get copyright informations */
-const char *ssh_copyright(void);
+LIBSSH_API const char *ssh_copyright(void);
/* string.h */
/* You can use these functions, they won't change */
/* string_from_char returns a newly allocated string from a char *ptr */
-ssh_string string_from_char(const char *what);
+LIBSSH_API ssh_string string_from_char(const char *what);
/* it returns the string len in host byte orders. str->size is big endian warning ! */
-size_t string_len(ssh_string str);
-ssh_string string_new(size_t size);
+LIBSSH_API size_t string_len(ssh_string str);
+LIBSSH_API ssh_string string_new(size_t size);
/* string_fill copies the data in the string. */
-int string_fill(ssh_string str, const void *data, size_t len);
+LIBSSH_API int string_fill(ssh_string str, const void *data, size_t len);
/* returns a newly allocated char array with the str string and a final nul caracter */
-char *string_to_char(ssh_string str);
-ssh_string string_copy(ssh_string str);
+LIBSSH_API char *string_to_char(ssh_string str);
+LIBSSH_API ssh_string string_copy(ssh_string str);
/* burns the data inside a string */
-void string_burn(ssh_string str);
-void *string_data(ssh_string str);
-void string_free(ssh_string str);
+LIBSSH_API void string_burn(ssh_string str);
+LIBSSH_API void *string_data(ssh_string str);
+LIBSSH_API void string_free(ssh_string str);
/* useful for debug */
-char *ssh_get_hexa(const unsigned char *what, size_t len);
-void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
-int ssh_get_random(void *where,int len,int strong);
+LIBSSH_API char *ssh_get_hexa(const unsigned char *what, size_t len);
+LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
+LIBSSH_API int ssh_get_random(void *where,int len,int strong);
/* this one can be called by the client to see the hash of the public key before accepting it */
-int ssh_get_pubkey_hash(SSH_SESSION *session, unsigned char **hash);
-void ssh_clean_pubkey_hash(unsigned char **hash);
-ssh_string ssh_get_pubkey(SSH_SESSION *session);
+LIBSSH_API int ssh_get_pubkey_hash(SSH_SESSION *session, unsigned char **hash);
+LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
+LIBSSH_API ssh_string ssh_get_pubkey(SSH_SESSION *session);
/* in connect.c */
-int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
+LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
fd_set *readfds, struct timeval *timeout);
-void publickey_free(ssh_public_key key);
+LIBSSH_API void publickey_free(ssh_public_key key);
/* in keyfiles.c */
-ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
+LIBSSH_API ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
int type, const char *passphrase);
-ssh_string publickey_to_string(ssh_public_key key);
-ssh_public_key publickey_from_privatekey(ssh_private_key prv);
-void privatekey_free(ssh_private_key prv);
-ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
+LIBSSH_API ssh_string publickey_to_string(ssh_public_key key);
+LIBSSH_API ssh_public_key publickey_from_privatekey(ssh_private_key prv);
+LIBSSH_API void privatekey_free(ssh_private_key prv);
+LIBSSH_API ssh_string publickey_from_file(SSH_SESSION *session, const char *filename,
int *type);
-int ssh_is_server_known(SSH_SESSION *session);
-int ssh_write_knownhost(SSH_SESSION *session);
+LIBSSH_API int ssh_is_server_known(SSH_SESSION *session);
+LIBSSH_API int ssh_write_knownhost(SSH_SESSION *session);
/* in channels.c */
-ssh_channel channel_new(SSH_SESSION *session);
-int channel_open_forward(ssh_channel channel, const char *remotehost,
+LIBSSH_API ssh_channel channel_new(SSH_SESSION *session);
+LIBSSH_API int channel_open_forward(ssh_channel channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport);
-int channel_open_session(ssh_channel channel);
-void channel_free(ssh_channel channel);
-int channel_request_pty(ssh_channel channel);
-int channel_request_pty_size(ssh_channel channel, const char *term,
+LIBSSH_API int channel_open_session(ssh_channel channel);
+LIBSSH_API void channel_free(ssh_channel channel);
+LIBSSH_API int channel_request_pty(ssh_channel channel);
+LIBSSH_API int channel_request_pty_size(ssh_channel channel, const char *term,
int cols, int rows);
-int channel_change_pty_size(ssh_channel channel,int cols,int rows);
-int channel_request_shell(ssh_channel channel);
-int channel_request_subsystem(ssh_channel channel, const char *system);
-int channel_request_env(ssh_channel channel, const char *name, const char *value);
-int channel_request_exec(ssh_channel channel, const char *cmd);
-int channel_request_sftp(ssh_channel channel);
-int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
+LIBSSH_API int channel_change_pty_size(ssh_channel channel,int cols,int rows);
+LIBSSH_API int channel_request_shell(ssh_channel channel);
+LIBSSH_API int channel_request_subsystem(ssh_channel channel, const char *system);
+LIBSSH_API int channel_request_env(ssh_channel channel, const char *name, const char *value);
+LIBSSH_API int channel_request_exec(ssh_channel channel, const char *cmd);
+LIBSSH_API int channel_request_sftp(ssh_channel channel);
+LIBSSH_API int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
const char *cookie, int screen_number);
-ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms);
-int channel_write(ssh_channel channel, const void *data, uint32_t len);
-int channel_send_eof(ssh_channel channel);
-int channel_is_eof(ssh_channel channel);
-int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
-int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
+LIBSSH_API ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms);
+LIBSSH_API int channel_write(ssh_channel channel, const void *data, uint32_t len);
+LIBSSH_API int channel_send_eof(ssh_channel channel);
+LIBSSH_API int channel_is_eof(ssh_channel channel);
+LIBSSH_API int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
+LIBSSH_API int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
int is_stderr);
-int channel_poll(ssh_channel channel, int is_stderr);
-int channel_close(ssh_channel channel);
-void channel_set_blocking(ssh_channel channel, int blocking);
-int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
+LIBSSH_API int channel_poll(ssh_channel channel, int is_stderr);
+LIBSSH_API int channel_close(ssh_channel channel);
+LIBSSH_API void channel_set_blocking(ssh_channel channel, int blocking);
+LIBSSH_API int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
int is_stderr);
-int channel_is_open(ssh_channel channel);
-int channel_is_closed(ssh_channel channel);
-int channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
+LIBSSH_API int channel_is_open(ssh_channel channel);
+LIBSSH_API int channel_is_closed(ssh_channel channel);
+LIBSSH_API int channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
timeval * timeout);
-SSH_SESSION *channel_get_session(ssh_channel channel);
-int channel_get_exit_status(ssh_channel channel);
+LIBSSH_API SSH_SESSION *channel_get_session(ssh_channel channel);
+LIBSSH_API int channel_get_exit_status(ssh_channel channel);
/* in options.c */
/**
@@ -345,31 +371,31 @@ int channel_get_exit_status(ssh_channel channel);
typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
int echo, int verify, void *userdata);
-SSH_OPTIONS *ssh_options_new(void);
-SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt);
-void ssh_options_free(SSH_OPTIONS *opt);
-int ssh_options_set_wanted_algos(SSH_OPTIONS *opt, int algo, const char *list);
-int ssh_options_set_username(SSH_OPTIONS *opt, const char *username);
-int ssh_options_set_port(SSH_OPTIONS *opt, unsigned int port);
-int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv);
-int ssh_options_set_host(SSH_OPTIONS *opt, const char *host);
-int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd);
-int ssh_options_set_bind(SSH_OPTIONS *opt, const char *bindaddr, int port);
-int ssh_options_set_ssh_dir(SSH_OPTIONS *opt, const char *dir);
-int ssh_options_set_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
-int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
-int ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
-int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
+LIBSSH_API SSH_OPTIONS *ssh_options_new(void);
+LIBSSH_API SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt);
+LIBSSH_API void ssh_options_free(SSH_OPTIONS *opt);
+LIBSSH_API int ssh_options_set_wanted_algos(SSH_OPTIONS *opt, int algo, const char *list);
+LIBSSH_API int ssh_options_set_username(SSH_OPTIONS *opt, const char *username);
+LIBSSH_API int ssh_options_set_port(SSH_OPTIONS *opt, unsigned int port);
+LIBSSH_API int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv);
+LIBSSH_API int ssh_options_set_host(SSH_OPTIONS *opt, const char *host);
+LIBSSH_API int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd);
+LIBSSH_API int ssh_options_set_bind(SSH_OPTIONS *opt, const char *bindaddr, int port);
+LIBSSH_API int ssh_options_set_ssh_dir(SSH_OPTIONS *opt, const char *dir);
+LIBSSH_API int ssh_options_set_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
+LIBSSH_API int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
+LIBSSH_API int ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
+LIBSSH_API int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
(void *arg, float status), void *arg);
-int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
-int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
-int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
-int ssh_options_set_log_function(SSH_OPTIONS *opt,
+LIBSSH_API int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
+LIBSSH_API int ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
+LIBSSH_API int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
+LIBSSH_API int ssh_options_set_log_function(SSH_OPTIONS *opt,
void (*callback)(const char *message, SSH_SESSION *session, int verbosity));
-int ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity);
-int ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
-int ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey);
-int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
+LIBSSH_API int ssh_options_set_log_verbosity(SSH_OPTIONS *opt, int verbosity);
+LIBSSH_API int ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
+LIBSSH_API int ssh_options_set_rsa_server_key(SSH_OPTIONS *opt, const char *rsakey);
+LIBSSH_API int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
void *userdata);
@@ -377,52 +403,54 @@ int ssh_options_set_auth_callback(SSH_OPTIONS *opt, ssh_auth_callback cb,
/** creates a new buffer
*/
-ssh_buffer buffer_new(void);
-void buffer_free(ssh_buffer buffer);
+LIBSSH_API ssh_buffer buffer_new(void);
+LIBSSH_API void buffer_free(ssh_buffer buffer);
/* buffer_get returns a pointer to the begining of the buffer. no position is taken into account */
-void *buffer_get(ssh_buffer buffer);
+LIBSSH_API void *buffer_get(ssh_buffer buffer);
/* same here */
/* FIXME should be size_t */
-uint32_t buffer_get_len(ssh_buffer buffer);
+LIBSSH_API uint32_t buffer_get_len(ssh_buffer buffer);
/* in auth.c */
-int ssh_auth_list(SSH_SESSION *session);
+LIBSSH_API int ssh_auth_list(SSH_SESSION *session);
/* these functions returns AUTH_ERROR is some serious error has happened,
AUTH_SUCCESS if success,
AUTH_PARTIAL if partial success,
AUTH_DENIED if refused */
-int ssh_userauth_list(SSH_SESSION *session, const char *username);
-int ssh_userauth_none(SSH_SESSION *session, const char *username);
-int ssh_userauth_password(SSH_SESSION *session, const char *username, const char *password);
-int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey);
-int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, ssh_private_key privatekey);
-int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
+LIBSSH_API int ssh_userauth_list(SSH_SESSION *session, const char *username);
+LIBSSH_API int ssh_userauth_none(SSH_SESSION *session, const char *username);
+LIBSSH_API int ssh_userauth_password(SSH_SESSION *session, const char *username, const char *password);
+LIBSSH_API int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username, int type, ssh_string publickey);
+LIBSSH_API int ssh_userauth_pubkey(SSH_SESSION *session, const char *username, ssh_string publickey, ssh_private_key privatekey);
+#ifndef _WIN32
+LIBSSH_API int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
ssh_public_key publickey);
-int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
-int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods);
-int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session);
-const char *ssh_userauth_kbdint_getname(SSH_SESSION *session);
-const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session);
-const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, char *echo);
-int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i,
+#endif
+LIBSSH_API int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase);
+LIBSSH_API int ssh_userauth_kbdint(SSH_SESSION *session, const char *user, const char *submethods);
+LIBSSH_API int ssh_userauth_kbdint_getnprompts(SSH_SESSION *session);
+LIBSSH_API const char *ssh_userauth_kbdint_getname(SSH_SESSION *session);
+LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(SSH_SESSION *session);
+LIBSSH_API const char *ssh_userauth_kbdint_getprompt(SSH_SESSION *session, unsigned int i, char *echo);
+LIBSSH_API int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int i,
const char *answer);
/* init.c */
-int ssh_init(void);
-int ssh_finalize(void);
+LIBSSH_API int ssh_init(void);
+LIBSSH_API int ssh_finalize(void);
/* messages.c */
typedef struct ssh_message SSH_MESSAGE;
-SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, uint32_t packettype);
-SSH_MESSAGE *ssh_message_get(SSH_SESSION *session);
-int ssh_message_type(SSH_MESSAGE *msg);
-int ssh_message_subtype(SSH_MESSAGE *msg);
-void ssh_message_free(SSH_MESSAGE *msg);
+LIBSSH_API SSH_MESSAGE *ssh_message_retrieve(SSH_SESSION *session, uint32_t packettype);
+LIBSSH_API SSH_MESSAGE *ssh_message_get(SSH_SESSION *session);
+LIBSSH_API int ssh_message_type(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_subtype(SSH_MESSAGE *msg);
+LIBSSH_API void ssh_message_free(SSH_MESSAGE *msg);
-ssh_channel ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg);
-int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg);
+LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_reply_success(SSH_MESSAGE *msg);
/* scp.c */
enum {
@@ -432,12 +460,12 @@ enum {
SSH_SCP_READ
};
-ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
-int ssh_scp_init(ssh_scp scp);
-int ssh_scp_close(ssh_scp scp);
-void ssh_scp_free(ssh_scp scp);
-int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, const char *perms);
-int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
+LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
+LIBSSH_API int ssh_scp_init(ssh_scp scp);
+LIBSSH_API int ssh_scp_close(ssh_scp scp);
+LIBSSH_API void ssh_scp_free(ssh_scp scp);
+LIBSSH_API int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, const char *perms);
+LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
#ifdef __cplusplus
}
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index af3dc0b..152753a 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -152,13 +152,25 @@ typedef struct pollfd_s {
} pollfd_t;
/* poll.c */
-#define POLLIN 0x001 /* There is data to read. */
+#ifndef POLLIN
+# define POLLIN 0x001 /* There is data to read. */
+#endif
+#ifndef POLLPRI
#define POLLPRI 0x002 /* There is urgent data to read. */
+#endif
+#ifndef POLLOUT
#define POLLOUT 0x004 /* Writing now will not block. */
+#endif
+#ifndef POLLERR
#define POLLERR 0x008 /* Error condition. */
+#endif
+#ifndef POLLHUP
#define POLLHUP 0x010 /* Hung up. */
+#endif
+#ifndef POLLNVAL
#define POLLNVAL 0x020 /* Invalid polling request. */
+#endif
typedef unsigned long int nfds_t;
#endif /* HAVE_POLL */
diff --git a/include/libssh/server.h b/include/libssh/server.h
index c72c0e7..e71e285 100644
--- a/include/libssh/server.h
+++ b/include/libssh/server.h
@@ -42,7 +42,7 @@ typedef struct ssh_bind_struct SSH_BIND;
*
* @return A newly allocated ssh_bind session pointer.
*/
-SSH_BIND *ssh_bind_new(void);
+LIBSSH_API SSH_BIND *ssh_bind_new(void);
/**
* @brief Set the opitons for the current SSH server bind.
@@ -51,7 +51,7 @@ SSH_BIND *ssh_bind_new(void);
*
* @param options The option structure to set.
*/
-void ssh_bind_set_options(SSH_BIND *ssh_bind, SSH_OPTIONS *options);
+LIBSSH_API void ssh_bind_set_options(SSH_BIND *ssh_bind, SSH_OPTIONS *options);
/**
* @brief Start listening to the socket.
@@ -60,7 +60,7 @@ void ssh_bind_set_options(SSH_BIND *ssh_bind, SSH_OPTIONS *options);
*
* @return 0 on success, < 0 on error.
*/
-int ssh_bind_listen(SSH_BIND *ssh_bind);
+LIBSSH_API int ssh_bind_listen(SSH_BIND *ssh_bind);
/**
* @brief Set the session to blocking/nonblocking mode.
@@ -69,7 +69,7 @@ int ssh_bind_listen(SSH_BIND *ssh_bind);
*
* @param blocking Zero for nonblocking mode.
*/
-void ssh_bind_set_blocking(SSH_BIND *ssh_bind, int blocking);
+LIBSSH_API void ssh_bind_set_blocking(SSH_BIND *ssh_bind, int blocking);
/**
* @brief Recover the file descriptor from the session.
@@ -78,7 +78,7 @@ void ssh_bind_set_blocking(SSH_BIND *ssh_bind, int blocking);
*
* @return The file descriptor.
*/
-socket_t ssh_bind_get_fd(SSH_BIND *ssh_bind);
+LIBSSH_API socket_t ssh_bind_get_fd(SSH_BIND *ssh_bind);
/**
* @brief Set the file descriptor for a session.
@@ -87,14 +87,14 @@ socket_t ssh_bind_get_fd(SSH_BIND *ssh_bind);
*
* @param fd The file descriptor.
*/
-void ssh_bind_set_fd(SSH_BIND *ssh_bind, socket_t fd);
+LIBSSH_API void ssh_bind_set_fd(SSH_BIND *ssh_bind, socket_t fd);
/**
* @brief Allow the file descriptor to accept new sessions.
*
* @param ssh_bind The ssh server bind to use.
*/
-void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind);
+LIBSSH_API void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind);
/**
* @brief Accept an incoming ssh connection and initialize the session.
@@ -103,14 +103,14 @@ void ssh_bind_fd_toaccept(SSH_BIND *ssh_bind);
*
* @return A newly allocated ssh session, NULL on error.
*/
-SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind);
+LIBSSH_API SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind);
/**
* @brief Free a ssh servers bind.
*
* @param ssh_bind The ssh server bind to free.
*/
-void ssh_bind_free(SSH_BIND *ssh_bind);
+LIBSSH_API void ssh_bind_free(SSH_BIND *ssh_bind);
/**
* @brief Exchange the banner and cryptographic keys.
@@ -119,45 +119,45 @@ void ssh_bind_free(SSH_BIND *ssh_bind);
*
* @return 0 on success, < 0 on error.
*/
-int ssh_accept(SSH_SESSION *session);
+LIBSSH_API int ssh_accept(SSH_SESSION *session);
-int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len);
+LIBSSH_API int channel_write_stderr(ssh_channel channel, const void *data, uint32_t len);
/* messages.c */
-int ssh_message_reply_default(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_reply_default(SSH_MESSAGE *msg);
-char *ssh_message_auth_user(SSH_MESSAGE *msg);
-char *ssh_message_auth_password(SSH_MESSAGE *msg);
-ssh_public_key ssh_message_auth_publickey(SSH_MESSAGE *msg);
-int ssh_message_auth_reply_success(SSH_MESSAGE *msg,int partial);
-int ssh_message_auth_reply_pk_ok(SSH_MESSAGE *msg, ssh_string algo, ssh_string pubkey);
-int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods);
+LIBSSH_API char *ssh_message_auth_user(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_auth_password(SSH_MESSAGE *msg);
+LIBSSH_API ssh_public_key ssh_message_auth_publickey(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_auth_reply_success(SSH_MESSAGE *msg,int partial);
+LIBSSH_API int ssh_message_auth_reply_pk_ok(SSH_MESSAGE *msg, ssh_string algo, ssh_string pubkey);
+LIBSSH_API int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods);
-int ssh_message_service_reply_success(SSH_MESSAGE *msg);
-char *ssh_message_service_service(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_service_reply_success(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_service_service(SSH_MESSAGE *msg);
-void ssh_set_message_callback(SSH_SESSION *session,
+LIBSSH_API void ssh_set_message_callback(SSH_SESSION *session,
int(*ssh_message_callback)(ssh_session session, struct ssh_message *msg));
-char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg);
-int ssh_message_channel_request_open_originator_port(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_open_destination(SSH_MESSAGE *msg);
-int ssh_message_channel_request_open_destination_port(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_open_originator(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_open_originator_port(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_open_destination(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_open_destination_port(SSH_MESSAGE *msg);
-ssh_channel ssh_message_channel_request_channel(SSH_MESSAGE *msg);
+LIBSSH_API ssh_channel ssh_message_channel_request_channel(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_pty_term(SSH_MESSAGE *msg);
-int ssh_message_channel_request_pty_width(SSH_MESSAGE *msg);
-int ssh_message_channel_request_pty_height(SSH_MESSAGE *msg);
-int ssh_message_channel_request_pty_pxwidth(SSH_MESSAGE *msg);
-int ssh_message_channel_request_pty_pxheight(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_pty_term(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_pty_width(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_pty_height(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_pty_pxwidth(SSH_MESSAGE *msg);
+LIBSSH_API int ssh_message_channel_request_pty_pxheight(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_env_name(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_env_value(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_env_name(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_env_value(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_command(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_command(SSH_MESSAGE *msg);
-char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg);
+LIBSSH_API char *ssh_message_channel_request_subsystem(SSH_MESSAGE *msg);
#ifdef __cplusplus
}
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 8f75816..bcdf9d8 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -183,14 +183,14 @@ typedef struct sftp_attributes{
*
* @return A new sftp session or NULL on error.
*/
-SFTP_SESSION *sftp_new(SSH_SESSION *session);
+LIBSSH_API SFTP_SESSION *sftp_new(SSH_SESSION *session);
/**
* @brief Close and deallocate a sftp session.
*
* @param sftp The sftp session handle to free.
*/
-void sftp_free(SFTP_SESSION *sftp);
+LIBSSH_API void sftp_free(SFTP_SESSION *sftp);
/**
* @brief Initialize the sftp session with the server.
@@ -199,7 +199,7 @@ void sftp_free(SFTP_SESSION *sftp);
*
* @return 0 on success, < 0 on error with ssh error set.
*/
-int sftp_init(SFTP_SESSION *sftp);
+LIBSSH_API int sftp_init(SFTP_SESSION *sftp);
/**
* @brief Get the last sftp error.
@@ -211,7 +211,7 @@ int sftp_init(SFTP_SESSION *sftp);
* @return The saved error (see server responses), < 0 if an error
* in the function occured.
*/
-int sftp_get_error(SFTP_SESSION *sftp);
+LIBSSH_API int sftp_get_error(SFTP_SESSION *sftp);
/**
* @brief Get the count of extensions provided by the server.
@@ -221,7 +221,7 @@ int sftp_get_error(SFTP_SESSION *sftp);
* @return The count of extensions provided by the server, 0 on error or
* not available.
*/
-unsigned int sftp_extensions_get_count(SFTP_SESSION *sftp);
+LIBSSH_API unsigned int sftp_extensions_get_count(SFTP_SESSION *sftp);
/**
* @brief Get the name of the extension provided by the server.
@@ -232,7 +232,7 @@ unsigned int sftp_extensions_get_count(SFTP_SESSION *sftp);
*
* @return The name of the extension.
*/
-const char *sftp_extensions_get_name(SFTP_SESSION *sftp, unsigned int index);
+LIBSSH_API const char *sftp_extensions_get_name(SFTP_SESSION *sftp, unsigned int index);
/**
* @brief Get the data of the extension provided by the server.
@@ -245,7 +245,7 @@ const char *sftp_extensions_get_name(SFTP_SESSION *sftp, unsigned int index);
*
* @return The data of the extension.
*/
-const char *sftp_extensions_get_data(SFTP_SESSION *sftp, unsigned int index);
+LIBSSH_API const char *sftp_extensions_get_data(SFTP_SESSION *sftp, unsigned int index);
/**
* @brief Open a directory used to obtain directory entries.
@@ -259,7 +259,7 @@ const char *sftp_extensions_get_data(SFTP_SESSION *sftp, unsigned int index);
* @see sftp_readdir
* @see sftp_closedir
*/
-SFTP_DIR *sftp_opendir(SFTP_SESSION *session, const char *path);
+LIBSSH_API SFTP_DIR *sftp_opendir(SFTP_SESSION *session, const char *path);
/**
* @brief Get a single file attributes structure of a directory.
@@ -274,7 +274,7 @@ SFTP_DIR *sftp_opendir(SFTP_SESSION *session, const char *path);
* @see sftp_attribute_free()
* @see sftp_closedir()
*/
-SFTP_ATTRIBUTES *sftp_readdir(SFTP_SESSION *session, SFTP_DIR *dir);
+LIBSSH_API SFTP_ATTRIBUTES *sftp_readdir(SFTP_SESSION *session, SFTP_DIR *dir);
/**
* @brief Tell if the directory has reached EOF (End Of File).
@@ -285,7 +285,7 @@ SFTP_ATTRIBUTES *sftp_readdir(SFTP_SESSION *session, SFTP_DIR *dir);
*
* @see sftp_readdir()
*/
-int sftp_dir_eof(SFTP_DIR *dir);
+LIBSSH_API int sftp_dir_eof(SFTP_DIR *dir);
/**
* @brief Get information about a file or directory.
@@ -297,7 +297,7 @@ int sftp_dir_eof(SFTP_DIR *dir);
* @return The sftp attributes structure of the file or directory,
* NULL on error with ssh and sftp error set.
*/
-SFTP_ATTRIBUTES *sftp_stat(SFTP_SESSION *session, const char *path);
+LIBSSH_API SFTP_ATTRIBUTES *sftp_stat(SFTP_SESSION *session, const char *path);
/**
* @brief Get information about a file or directory.
@@ -312,7 +312,7 @@ SFTP_ATTRIBUTES *sftp_stat(SFTP_SESSION *session, const char *path);
* @return The sftp attributes structure of the file or directory,
* NULL on error with ssh and sftp error set.
*/
-SFTP_ATTRIBUTES *sftp_lstat(SFTP_SESSION *session, const char *path);
+LIBSSH_API SFTP_ATTRIBUTES *sftp_lstat(SFTP_SESSION *session, const char *path);
/**
* @brief Get information about a file or directory from a file handle.
@@ -322,14 +322,14 @@ SFTP_ATTRIBUTES *sftp_lstat(SFTP_SESSION *session, const char *path);
* @return The sftp attributes structure of the file or directory,
* NULL on error with ssh and sftp error set.
*/
-SFTP_ATTRIBUTES *sftp_fstat(SFTP_FILE *file);
+LIBSSH_API SFTP_ATTRIBUTES *sftp_fstat(SFTP_FILE *file);
/**
* @brief Free a sftp attribute structure.
*
* @param file The sftp attribute structure to free.
*/
-void sftp_attributes_free(SFTP_ATTRIBUTES *file);
+LIBSSH_API void sftp_attributes_free(SFTP_ATTRIBUTES *file);
/**
* @brief Close a directory handle opened by sftp_opendir().
@@ -338,12 +338,12 @@ void sftp_attributes_free(SFTP_ATTRIBUTES *file);
*
* @return Returns SSH_NO_ERROR or SSH_ERROR if an error occured.
*/
-int sftp_closedir(SFTP_DIR *dir);
+LIBSSH_API int sftp_closedir(SFTP_DIR *dir);
/**
* @deprecated Use sftp_closedir() instead.
*/
-int sftp_dir_close(SFTP_DIR *dir) SFTP_DEPRECATED;
+LIBSSH_API int sftp_dir_close(SFTP_DIR *dir) SFTP_DEPRECATED;
/**
* @brief Close an open file handle.
@@ -354,12 +354,12 @@ int sftp_dir_close(SFTP_DIR *dir) SFTP_DEPRECATED;
*
* @see sftp_open()
*/
-int sftp_close(SFTP_FILE *file);
+LIBSSH_API int sftp_close(SFTP_FILE *file);
/**
* @deprecated Use sftp_close() instead.
*/
-int sftp_file_close(SFTP_FILE *file) SFTP_DEPRECATED;
+LIBSSH_API int sftp_file_close(SFTP_FILE *file) SFTP_DEPRECATED;
/**
* @brief Open a file on the server.
@@ -387,12 +387,12 @@ int sftp_file_close(SFTP_FILE *file) SFTP_DEPRECATED;
* @return A sftp file handle, NULL on error with ssh and sftp
* error set.
*/
-SFTP_FILE *sftp_open(SFTP_SESSION *session, const char *file, int flags,
+LIBSSH_API SFTP_FILE *sftp_open(SFTP_SESSION *session, const char *file, int flags,
mode_t mode);
-void sftp_file_set_nonblocking(SFTP_FILE *handle);
+LIBSSH_API void sftp_file_set_nonblocking(SFTP_FILE *handle);
-void sftp_file_set_blocking(SFTP_FILE *handle);
+LIBSSH_API void sftp_file_set_blocking(SFTP_FILE *handle);
/**
* @brief Read from a file using an opened sftp file handle.
@@ -406,7 +406,7 @@ void sftp_file_set_blocking(SFTP_FILE *handle);
* @return Number of bytes written, < 0 on error with ssh and sftp
* error set.
*/
-ssize_t sftp_read(SFTP_FILE *file, void *buf, size_t count);
+LIBSSH_API ssize_t sftp_read(SFTP_FILE *file, void *buf, size_t count);
/**
* @brief Start an asynchronous read from a file using an opened sftp file handle.
@@ -439,7 +439,7 @@ ssize_t sftp_read(SFTP_FILE *file, void *buf, size_t count);
* @see sftp_async_read()
* @see sftp_open()
*/
-int sftp_async_read_begin(SFTP_FILE *file, uint32_t len);
+LIBSSH_API int sftp_async_read_begin(SFTP_FILE *file, uint32_t len);
/**
* @brief Wait for an asynchronous read to complete and save the data.
@@ -464,7 +464,7 @@ int sftp_async_read_begin(SFTP_FILE *file, uint32_t len);
*
* @see sftp_async_read_begin()
*/
-int sftp_async_read(SFTP_FILE *file, void *data, uint32_t len, uint32_t id);
+LIBSSH_API int sftp_async_read(SFTP_FILE *file, void *data, uint32_t len, uint32_t id);
/**
* @brief Write to a file using an opened sftp file handle.
@@ -482,7 +482,7 @@ int sftp_async_read(SFTP_FILE *file, void *data, uint32_t len, uint32_t id);
* @see sftp_read()
* @see sftp_close()
*/
-ssize_t sftp_write(SFTP_FILE *file, const void *buf, size_t count);
+LIBSSH_API ssize_t sftp_write(SFTP_FILE *file, const void *buf, size_t count);
/**
* @brief Seek to a specific location in a file.
@@ -493,7 +493,7 @@ ssize_t sftp_write(SFTP_FILE *file, const void *buf, size_t count);
*
* @return 0 on success, < 0 on error.
*/
-int sftp_seek(SFTP_FILE *file, uint32_t new_offset);
+LIBSSH_API int sftp_seek(SFTP_FILE *file, uint32_t new_offset);
/**
* @brief Seek to a specific location in a file. This is the
@@ -505,7 +505,7 @@ int sftp_seek(SFTP_FILE *file, uint32_t new_offset);
*
* @return 0 on success, < 0 on error.
*/
-int sftp_seek64(SFTP_FILE *file, uint64_t new_offset);
+LIBSSH_API int sftp_seek64(SFTP_FILE *file, uint64_t new_offset);
/**
* @brief Report current byte position in file.
@@ -516,7 +516,7 @@ int sftp_seek64(SFTP_FILE *file, uint64_t new_offset);
* of the file associated with the file descriptor. < 0 on
* error.
*/
-unsigned long sftp_tell(SFTP_FILE *file);
+LIBSSH_API unsigned long sftp_tell(SFTP_FILE *file);
/**
* @brief Report current byte position in file.
@@ -527,7 +527,7 @@ unsigned long sftp_tell(SFTP_FILE *file);
* of the file associated with the file descriptor. < 0 on
* error.
*/
-uint64_t sftp_tell64(SFTP_FILE *file);
+LIBSSH_API uint64_t sftp_tell64(SFTP_FILE *file);
/**
* @brief Rewinds the position of the file pointer to the beginning of the
@@ -535,12 +535,12 @@ uint64_t sftp_tell64(SFTP_FILE *file);
*
* @param file Open sftp file handle.
*/
-void sftp_rewind(SFTP_FILE *file);
+LIBSSH_API void sftp_rewind(SFTP_FILE *file);
/**
* @deprecated Use sftp_unlink() instead.
*/
-int sftp_rm(SFTP_SESSION *sftp, const char *file) SFTP_DEPRECATED;
+LIBSSH_API int sftp_rm(SFTP_SESSION *sftp, const char *file) SFTP_DEPRECATED;
/**
* @brief Unlink (delete) a file.
@@ -551,7 +551,7 @@ int sftp_rm(SFTP_SESSION *sftp, const char *file) SFTP_DEPRECATED;
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_unlink(SFTP_SESSION *sftp, const char *file);
+LIBSSH_API int sftp_unlink(SFTP_SESSION *sftp, const char *file);
/**
* @brief Remove a directoy.
@@ -562,7 +562,7 @@ int sftp_unlink(SFTP_SESSION *sftp, const char *file);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_rmdir(SFTP_SESSION *sftp, const char *directory);
+LIBSSH_API int sftp_rmdir(SFTP_SESSION *sftp, const char *directory);
/**
* @brief Create a directory.
@@ -577,7 +577,7 @@ int sftp_rmdir(SFTP_SESSION *sftp, const char *directory);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_mkdir(SFTP_SESSION *sftp, const char *directory, mode_t mode);
+LIBSSH_API int sftp_mkdir(SFTP_SESSION *sftp, const char *directory, mode_t mode);
/**
* @brief Rename or move a file or directory.
@@ -592,7 +592,7 @@ int sftp_mkdir(SFTP_SESSION *sftp, const char *directory, mode_t mode);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname);
+LIBSSH_API int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname);
/**
* @brief Set file attributes on a file, directory or symbolic link.
@@ -606,7 +606,7 @@ int sftp_rename(SFTP_SESSION *sftp, const char *original, const char *newname);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_setstat(SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr);
+LIBSSH_API int sftp_setstat(SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr);
/**
* @brief Change the file owner and group
@@ -621,7 +621,7 @@ int sftp_setstat(SFTP_SESSION *sftp, const char *file, SFTP_ATTRIBUTES *attr);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_chown(SFTP_SESSION *sftp, const char *file, uid_t owner, gid_t group);
+LIBSSH_API int sftp_chown(SFTP_SESSION *sftp, const char *file, uid_t owner, gid_t group);
/**
* @brief Change permissions of a file
@@ -636,7 +636,7 @@ int sftp_chown(SFTP_SESSION *sftp, const char *file, uid_t owner, gid_t group);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_chmod(SFTP_SESSION *sftp, const char *file, mode_t mode);
+LIBSSH_API int sftp_chmod(SFTP_SESSION *sftp, const char *file, mode_t mode);
/**
* @brief Change the last modification and access time of a file.
@@ -650,7 +650,7 @@ int sftp_chmod(SFTP_SESSION *sftp, const char *file, mode_t mode);
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_utimes(SFTP_SESSION *sftp, const char *file, const struct timeval *times);
+LIBSSH_API int sftp_utimes(SFTP_SESSION *sftp, const char *file, const struct timeval *times);
/**
* @brief Create a symbolic link.
@@ -663,7 +663,7 @@ int sftp_utimes(SFTP_SESSION *sftp, const char *file, const struct timeval *time
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*/
-int sftp_symlink(SFTP_SESSION *sftp, const char *target, const char *dest);
+LIBSSH_API int sftp_symlink(SFTP_SESSION *sftp, const char *target, const char *dest);
/**
* @brief Read the value of a symbolic link.
@@ -674,7 +674,7 @@ int sftp_symlink(SFTP_SESSION *sftp, const char *target, const char *dest);
*
* @return The target of the link, NULL on error.
*/
-char *sftp_readlink(SFTP_SESSION *sftp, const char *path);
+LIBSSH_API char *sftp_readlink(SFTP_SESSION *sftp, const char *path);
/**
* @brief Canonicalize a sftp path.
@@ -685,7 +685,7 @@ char *sftp_readlink(SFTP_SESSION *sftp, const char *path);
*
* @return The canonicalize path, NULL on error.
*/
-char *sftp_canonicalize_path(SFTP_SESSION *sftp, const char *path);
+LIBSSH_API char *sftp_canonicalize_path(SFTP_SESSION *sftp, const char *path);
/**
* @brief Get the version of the SFTP protocol supported by the server
@@ -694,7 +694,7 @@ char *sftp_canonicalize_path(SFTP_SESSION *sftp, const char *path);
*
* @return The server version.
*/
-int sftp_server_version(SFTP_SESSION *sftp);
+LIBSSH_API int sftp_server_version(SFTP_SESSION *sftp);
#ifdef WITH_SERVER
/**
@@ -706,7 +706,7 @@ int sftp_server_version(SFTP_SESSION *sftp);
*
* @return A new sftp server session.
*/
-SFTP_SESSION *sftp_server_new(SSH_SESSION *session, ssh_channel chan);
+LIBSSH_API SFTP_SESSION *sftp_server_new(SSH_SESSION *session, ssh_channel chan);
/**
* @brief Intialize the sftp server.
@@ -715,7 +715,7 @@ SFTP_SESSION *sftp_server_new(SSH_SESSION *session, ssh_channel chan);
*
* @return 0 on success, < 0 on error.
*/
-int sftp_server_init(SFTP_SESSION *sftp);
+LIBSSH_API int sftp_server_init(SFTP_SESSION *sftp);
#endif /* WITH_SERVER */
/* this is not a public interface */