1
1

struct socket -> struct ssh_socket_struct +typedef

Этот коммит содержится в:
Aris Adamantiadis 2009-12-06 22:48:56 +01:00
родитель 076e884873
Коммит a1e05c62ae
10 изменённых файлов: 81 добавлений и 79 удалений

Просмотреть файл

@ -48,7 +48,7 @@
#define SSH_AGENT_OLD_SIGNATURE 0x01 #define SSH_AGENT_OLD_SIGNATURE 0x01
struct ssh_agent_struct { struct ssh_agent_struct {
struct socket *sock; struct ssh_socket_struct *sock;
ssh_buffer ident; ssh_buffer ident;
unsigned int count; unsigned int count;
}; };

Просмотреть файл

@ -95,7 +95,7 @@ void ssh_poll_set_callback(ssh_poll_handle p, ssh_poll_callback cb, void *userda
ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size); ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size);
void ssh_poll_ctx_free(ssh_poll_ctx ctx); void ssh_poll_ctx_free(ssh_poll_ctx ctx);
int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p); int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p);
int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct socket *s); int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct ssh_socket_struct *s);
void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p); void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p);
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout); int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout);

Просмотреть файл

@ -136,10 +136,10 @@ unsigned char *packet_encrypt(ssh_session session,void *packet,unsigned int len)
/* it returns the hmac buffer if exists*/ /* it returns the hmac buffer if exists*/
int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac); int packet_hmac_verify(ssh_session session,ssh_buffer buffer,unsigned char *mac);
struct socket; struct ssh_socket_struct;
int ssh_packet_socket_callback(const void *data, size_t len, void *user); int ssh_packet_socket_callback(const void *data, size_t len, void *user);
void ssh_packet_register_socket_callback(ssh_session session, struct socket *s); void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s);
void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks); void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
void ssh_packet_set_default_callbacks(ssh_session session); void ssh_packet_set_default_callbacks(ssh_session session);
void ssh_packet_process(ssh_session session, uint8_t type); void ssh_packet_process(ssh_session session, uint8_t type);

Просмотреть файл

@ -41,7 +41,7 @@ enum ssh_session_state_e {
struct ssh_session_struct { struct ssh_session_struct {
struct error_struct error; struct error_struct error;
struct socket *socket; struct ssh_socket_struct *socket;
char *serverbanner; char *serverbanner;
char *clientbanner; char *clientbanner;
int protoversion; int protoversion;

Просмотреть файл

@ -26,38 +26,40 @@
struct ssh_poll_handle_struct; struct ssh_poll_handle_struct;
/* socket.c */ /* socket.c */
struct socket; struct ssh_socket_struct;
int ssh_socket_init(void); typedef struct ssh_socket_struct* ssh_socket;
struct socket *ssh_socket_new(ssh_session session);
void ssh_socket_free(struct socket *s);
void ssh_socket_set_fd(struct socket *s, socket_t fd);
socket_t ssh_socket_get_fd(struct socket *s);
#ifndef _WIN32
int ssh_socket_unix(struct socket *s, const char *path);
#endif
void ssh_socket_close(struct socket *s);
int ssh_socket_read(struct socket *s, void *buffer, int len);
int ssh_socket_write(struct socket *s,const void *buffer, int len);
int ssh_socket_is_open(struct socket *s);
int ssh_socket_fd_isset(struct socket *s, fd_set *set);
void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max);
int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len);
int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len);
int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len);
int ssh_socket_nonblocking_flush(struct socket *s);
int ssh_socket_blocking_flush(struct socket *s);
int ssh_socket_poll(struct socket *s, int *writeable, int *except);
void ssh_socket_set_towrite(struct socket *s);
void ssh_socket_set_toread(struct socket *s);
void ssh_socket_set_except(struct socket *s);
int ssh_socket_get_status(struct socket *s);
int ssh_socket_data_available(struct socket *s);
int ssh_socket_data_writable(struct socket *s);
void ssh_socket_set_callbacks(struct socket *s, ssh_socket_callbacks callbacks); int ssh_socket_init(void);
ssh_socket ssh_socket_new(ssh_session session);
void ssh_socket_free(ssh_socket s);
void ssh_socket_set_fd(ssh_socket s, socket_t fd);
socket_t ssh_socket_get_fd(ssh_socket s);
#ifndef _WIN32
int ssh_socket_unix(ssh_socket s, const char *path);
#endif
void ssh_socket_close(ssh_socket s);
int ssh_socket_read(ssh_socket s, void *buffer, int len);
int ssh_socket_write(ssh_socket s,const void *buffer, int len);
int ssh_socket_is_open(ssh_socket s);
int ssh_socket_fd_isset(ssh_socket s, fd_set *set);
void ssh_socket_fd_set(ssh_socket s, fd_set *set, int *fd_max);
int ssh_socket_completeread(ssh_socket s, void *buffer, uint32_t len);
int ssh_socket_completewrite(ssh_socket s, const void *buffer, uint32_t len);
int ssh_socket_wait_for_data(ssh_socket s, ssh_session session, uint32_t len);
int ssh_socket_nonblocking_flush(ssh_socket s);
int ssh_socket_blocking_flush(ssh_socket s);
int ssh_socket_poll(ssh_socket s, int *writeable, int *except);
void ssh_socket_set_towrite(ssh_socket s);
void ssh_socket_set_toread(ssh_socket s);
void ssh_socket_set_except(ssh_socket s);
int ssh_socket_get_status(ssh_socket s);
int ssh_socket_data_available(ssh_socket s);
int ssh_socket_data_writable(ssh_socket s);
void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks);
int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, int fd, int revents, void *s); int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, int fd, int revents, void *s);
void ssh_socket_register_pollcallback(struct socket *s, struct ssh_poll_handle_struct *p); void ssh_socket_register_pollcallback(ssh_socket s, struct ssh_poll_handle_struct *p);
struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(struct socket *s); struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(ssh_socket s);
int ssh_socket_connect(struct socket *s, const char *host, int port, const char *bind_addr); int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr);
#endif /* SOCKET_H_ */ #endif /* SOCKET_H_ */

Просмотреть файл

@ -81,7 +81,7 @@ static void agent_put_u32(void *vp, uint32_t v) {
p[3] = (uint8_t)v & 0xff; p[3] = (uint8_t)v & 0xff;
} }
static size_t atomicio(struct socket *s, void *buf, size_t n, int do_read) { static size_t atomicio(ssh_socket s, void *buf, size_t n, int do_read) {
char *b = buf; char *b = buf;
size_t pos = 0; size_t pos = 0;
ssize_t res; ssize_t res;

Просмотреть файл

@ -275,7 +275,7 @@ error:
return processed; return processed;
} }
void ssh_packet_register_socket_callback(ssh_session session, struct socket *s){ void ssh_packet_register_socket_callback(ssh_session session, ssh_socket s){
session->socket_callbacks.data=ssh_packet_socket_callback; session->socket_callbacks.data=ssh_packet_socket_callback;
session->socket_callbacks.connected=NULL; session->socket_callbacks.connected=NULL;
session->socket_callbacks.controlflow=NULL; session->socket_callbacks.controlflow=NULL;
@ -555,7 +555,7 @@ static int packet_read1(ssh_session session) {
} }
} }
rc = ssh_socket_read(session->socket, &len, sizeof(uint32_t)); rc = ssh_socket_read(session->ssh_socket_struct, &len, sizeof(uint32_t));
if (rc != SSH_OK) { if (rc != SSH_OK) {
goto error; goto error;
} }
@ -587,7 +587,7 @@ static int packet_read1(ssh_session session) {
goto error; goto error;
} }
rc = ssh_socket_read(session->socket, packet, to_be_read); rc = ssh_socket_read(session->ssh_socket_struct, packet, to_be_read);
if(rc != SSH_OK) { if(rc != SSH_OK) {
SAFE_FREE(packet); SAFE_FREE(packet);
goto error; goto error;
@ -880,7 +880,7 @@ static int packet_send1(ssh_session session) {
ssh_print_hexa("encrypted packet",buffer_get(session->out_buffer), ssh_print_hexa("encrypted packet",buffer_get(session->out_buffer),
buffer_get_len(session->out_buffer)); buffer_get_len(session->out_buffer));
#endif #endif
if (ssh_socket_write(session->socket, buffer_get(session->out_buffer), if (ssh_socket_write(session->ssh_socket_struct, buffer_get(session->out_buffer),
buffer_get_len(session->out_buffer)) == SSH_ERROR) { buffer_get_len(session->out_buffer)) == SSH_ERROR) {
goto error; goto error;
} }
@ -918,7 +918,7 @@ void packet_parse(ssh_session session) {
ssh_log(session, SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT"); ssh_log(session, SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT");
ssh_set_error(session, SSH_FATAL, "Received SSH_MSG_DISCONNECT"); ssh_set_error(session, SSH_FATAL, "Received SSH_MSG_DISCONNECT");
ssh_socket_close(session->socket); ssh_socket_close(session->ssh_socket_struct);
session->alive = 0; session->alive = 0;
return; return;
case SSH_SMSG_STDOUT_DATA: case SSH_SMSG_STDOUT_DATA:

Просмотреть файл

@ -498,7 +498,7 @@ int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p) {
* *
* @return 0 on success, < 0 on error * @return 0 on success, < 0 on error
*/ */
int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct socket *s) { int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, ssh_socket s) {
ssh_poll_handle p=ssh_socket_get_poll_handle(s); ssh_poll_handle p=ssh_socket_get_poll_handle(s);
if(p==NULL) if(p==NULL)
return -1; return -1;

Просмотреть файл

@ -53,7 +53,7 @@ enum ssh_socket_states_e {
SSH_SOCKET_CLOSED SSH_SOCKET_CLOSED
}; };
struct socket { struct ssh_socket_struct {
socket_t fd; socket_t fd;
int last_errno; int last_errno;
int data_to_read; /* reading now on socket will int data_to_read; /* reading now on socket will
@ -68,8 +68,8 @@ struct socket {
ssh_poll_handle poll; ssh_poll_handle poll;
}; };
static int ssh_socket_unbuffered_read(struct socket *s, void *buffer, uint32_t len); static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len);
static int ssh_socket_unbuffered_write(struct socket *s, const void *buffer, static int ssh_socket_unbuffered_write(ssh_socket s, const void *buffer,
uint32_t len); uint32_t len);
/* /*
@ -91,10 +91,10 @@ int ssh_socket_init(void) {
* \internal * \internal
* \brief creates a new Socket object * \brief creates a new Socket object
*/ */
struct socket *ssh_socket_new(ssh_session session) { ssh_socket ssh_socket_new(ssh_session session) {
struct socket *s; ssh_socket s;
s = malloc(sizeof(struct socket)); s = malloc(sizeof(struct ssh_socket_struct));
if (s == NULL) { if (s == NULL) {
return NULL; return NULL;
} }
@ -127,12 +127,12 @@ struct socket *ssh_socket_new(ssh_session session) {
* @param callbacks a ssh_socket_callback object reference * @param callbacks a ssh_socket_callback object reference
*/ */
void ssh_socket_set_callbacks(struct socket *s, ssh_socket_callbacks callbacks){ void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks){
s->callbacks=callbacks; s->callbacks=callbacks;
} }
int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){ int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){
struct socket *s=(struct socket *)v_s; ssh_socket s=(ssh_socket )v_s;
char buffer[4096]; char buffer[4096];
int r,w; int r,w;
int err=0; int err=0;
@ -215,7 +215,7 @@ int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){
return 0; return 0;
} }
void ssh_socket_register_pollcallback(struct socket *s, ssh_poll_handle p){ void ssh_socket_register_pollcallback(ssh_socket s, ssh_poll_handle p){
ssh_poll_set_callback(p,ssh_socket_pollcallback,s); ssh_poll_set_callback(p,ssh_socket_pollcallback,s);
s->poll=p; s->poll=p;
} }
@ -225,7 +225,7 @@ void ssh_socket_register_pollcallback(struct socket *s, ssh_poll_handle p){
* creates it if it does not exist. * creates it if it does not exist.
* @returns allocated and initialized ssh_poll_handle object * @returns allocated and initialized ssh_poll_handle object
*/ */
ssh_poll_handle ssh_socket_get_poll_handle(struct socket *s){ ssh_poll_handle ssh_socket_get_poll_handle(ssh_socket s){
if(s->poll) if(s->poll)
return s->poll; return s->poll;
s->poll=ssh_poll_new(s->fd,0,ssh_socket_pollcallback,s); s->poll=ssh_poll_new(s->fd,0,ssh_socket_pollcallback,s);
@ -235,7 +235,7 @@ ssh_poll_handle ssh_socket_get_poll_handle(struct socket *s){
/** \internal /** \internal
* \brief Deletes a socket object * \brief Deletes a socket object
*/ */
void ssh_socket_free(struct socket *s){ void ssh_socket_free(ssh_socket s){
if (s == NULL) { if (s == NULL) {
return; return;
} }
@ -248,7 +248,7 @@ void ssh_socket_free(struct socket *s){
} }
#ifndef _WIN32 #ifndef _WIN32
int ssh_socket_unix(struct socket *s, const char *path) { int ssh_socket_unix(ssh_socket s, const char *path) {
struct sockaddr_un sunaddr; struct sockaddr_un sunaddr;
sunaddr.sun_family = AF_UNIX; sunaddr.sun_family = AF_UNIX;
@ -279,7 +279,7 @@ int ssh_socket_unix(struct socket *s, const char *path) {
/* \internal /* \internal
* \brief closes a socket * \brief closes a socket
*/ */
void ssh_socket_close(struct socket *s){ void ssh_socket_close(ssh_socket s){
if (ssh_socket_is_open(s)) { if (ssh_socket_is_open(s)) {
#ifdef _WIN32 #ifdef _WIN32
closesocket(s->fd); closesocket(s->fd);
@ -295,7 +295,7 @@ void ssh_socket_close(struct socket *s){
/* \internal /* \internal
* \brief sets the file descriptor of the socket * \brief sets the file descriptor of the socket
*/ */
void ssh_socket_set_fd(struct socket *s, socket_t fd) { void ssh_socket_set_fd(ssh_socket s, socket_t fd) {
s->fd = fd; s->fd = fd;
if(s->poll) if(s->poll)
ssh_poll_set_fd(s->poll,fd); ssh_poll_set_fd(s->poll,fd);
@ -304,21 +304,21 @@ void ssh_socket_set_fd(struct socket *s, socket_t fd) {
/* \internal /* \internal
* \brief returns the file descriptor of the socket * \brief returns the file descriptor of the socket
*/ */
socket_t ssh_socket_get_fd(struct socket *s) { socket_t ssh_socket_get_fd(ssh_socket s) {
return s->fd; return s->fd;
} }
/* \internal /* \internal
* \brief returns nonzero if the socket is open * \brief returns nonzero if the socket is open
*/ */
int ssh_socket_is_open(struct socket *s) { int ssh_socket_is_open(ssh_socket s) {
return s->fd != -1; return s->fd != -1;
} }
/* \internal /* \internal
* \brief read len bytes from socket into buffer * \brief read len bytes from socket into buffer
*/ */
static int ssh_socket_unbuffered_read(struct socket *s, void *buffer, uint32_t len) { static int ssh_socket_unbuffered_read(ssh_socket s, void *buffer, uint32_t len) {
int rc = -1; int rc = -1;
if (s->data_except) { if (s->data_except) {
@ -343,7 +343,7 @@ static int ssh_socket_unbuffered_read(struct socket *s, void *buffer, uint32_t l
/* \internal /* \internal
* \brief writes len bytes from buffer to socket * \brief writes len bytes from buffer to socket
*/ */
static int ssh_socket_unbuffered_write(struct socket *s, const void *buffer, static int ssh_socket_unbuffered_write(ssh_socket s, const void *buffer,
uint32_t len) { uint32_t len) {
int w = -1; int w = -1;
@ -372,7 +372,7 @@ static int ssh_socket_unbuffered_write(struct socket *s, const void *buffer,
/* \internal /* \internal
* \brief returns nonzero if the current socket is in the fd_set * \brief returns nonzero if the current socket is in the fd_set
*/ */
int ssh_socket_fd_isset(struct socket *s, fd_set *set) { int ssh_socket_fd_isset(ssh_socket s, fd_set *set) {
if(s->fd == -1) { if(s->fd == -1) {
return 0; return 0;
} }
@ -383,7 +383,7 @@ int ssh_socket_fd_isset(struct socket *s, fd_set *set) {
* \brief sets the current fd in a fd_set and updates the fd_max * \brief sets the current fd in a fd_set and updates the fd_max
*/ */
void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max) { void ssh_socket_fd_set(ssh_socket s, fd_set *set, int *fd_max) {
if (s->fd == -1) if (s->fd == -1)
return; return;
FD_SET(s->fd,set); FD_SET(s->fd,set);
@ -395,7 +395,7 @@ void ssh_socket_fd_set(struct socket *s, fd_set *set, int *fd_max) {
/** \internal /** \internal
* \brief reads blocking until len bytes have been read * \brief reads blocking until len bytes have been read
*/ */
int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len) { int ssh_socket_completeread(ssh_socket s, void *buffer, uint32_t len) {
int r = -1; int r = -1;
uint32_t total = 0; uint32_t total = 0;
uint32_t toread = len; uint32_t toread = len;
@ -424,7 +424,7 @@ int ssh_socket_completeread(struct socket *s, void *buffer, uint32_t len) {
/** \internal /** \internal
* \brief Blocking write of len bytes * \brief Blocking write of len bytes
*/ */
int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len) { int ssh_socket_completewrite(ssh_socket s, const void *buffer, uint32_t len) {
ssh_session session = s->session; ssh_session session = s->session;
int written = -1; int written = -1;
@ -454,7 +454,7 @@ int ssh_socket_completewrite(struct socket *s, const void *buffer, uint32_t len)
* \returns SSH_OK or SSH_ERROR. * \returns SSH_OK or SSH_ERROR.
* \returns SSH_AGAIN in nonblocking mode * \returns SSH_AGAIN in nonblocking mode
*/ */
int ssh_socket_read(struct socket *s, void *buffer, int len){ int ssh_socket_read(ssh_socket s, void *buffer, int len){
ssh_session session = s->session; ssh_session session = s->session;
int rc = SSH_ERROR; int rc = SSH_ERROR;
@ -478,7 +478,7 @@ int ssh_socket_read(struct socket *s, void *buffer, int len){
* \returns SSH_OK, or SSH_ERROR * \returns SSH_OK, or SSH_ERROR
* \warning has no effect on socket before a flush * \warning has no effect on socket before a flush
*/ */
int ssh_socket_write(struct socket *s, const void *buffer, int len) { int ssh_socket_write(ssh_socket s, const void *buffer, int len) {
ssh_session session = s->session; ssh_session session = s->session;
enter_function(); enter_function();
if (buffer_add_data(s->out_buffer, buffer, len) < 0) { if (buffer_add_data(s->out_buffer, buffer, len) < 0) {
@ -498,7 +498,7 @@ int ssh_socket_write(struct socket *s, const void *buffer, int len) {
* \returns SSH_AGAIN need to call later for data * \returns SSH_AGAIN need to call later for data
* \returns SSH_ERROR error happened * \returns SSH_ERROR error happened
*/ */
int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len) { int ssh_socket_wait_for_data(ssh_socket s, ssh_session session, uint32_t len) {
char buffer[4096] = {0}; char buffer[4096] = {0};
char *buf = NULL; char *buf = NULL;
int except; int except;
@ -585,7 +585,7 @@ int ssh_socket_wait_for_data(struct socket *s, ssh_session session, uint32_t len
} }
/* ssh_socket_poll */ /* ssh_socket_poll */
int ssh_socket_poll(struct socket *s, int *writeable, int *except) { int ssh_socket_poll(ssh_socket s, int *writeable, int *except) {
ssh_session session = s->session; ssh_session session = s->session;
ssh_pollfd_t fd[1]; ssh_pollfd_t fd[1];
int rc = -1; int rc = -1;
@ -637,7 +637,7 @@ int ssh_socket_poll(struct socket *s, int *writeable, int *except) {
* \brief starts a nonblocking flush of the output buffer * \brief starts a nonblocking flush of the output buffer
* *
*/ */
int ssh_socket_nonblocking_flush(struct socket *s) { int ssh_socket_nonblocking_flush(ssh_socket s) {
ssh_session session = s->session; ssh_session session = s->session;
int w; int w;
@ -688,7 +688,7 @@ int ssh_socket_nonblocking_flush(struct socket *s) {
/** \internal /** \internal
* \brief locking flush of the output packet buffer * \brief locking flush of the output packet buffer
*/ */
int ssh_socket_blocking_flush(struct socket *s) { int ssh_socket_blocking_flush(ssh_socket s) {
ssh_session session = s->session; ssh_session session = s->session;
enter_function(); enter_function();
@ -732,27 +732,27 @@ int ssh_socket_blocking_flush(struct socket *s) {
return SSH_OK; // no data pending return SSH_OK; // no data pending
} }
void ssh_socket_set_towrite(struct socket *s) { void ssh_socket_set_towrite(ssh_socket s) {
s->data_to_write = 1; s->data_to_write = 1;
} }
void ssh_socket_set_toread(struct socket *s) { void ssh_socket_set_toread(ssh_socket s) {
s->data_to_read = 1; s->data_to_read = 1;
} }
void ssh_socket_set_except(struct socket *s) { void ssh_socket_set_except(ssh_socket s) {
s->data_except = 1; s->data_except = 1;
} }
int ssh_socket_data_available(struct socket *s) { int ssh_socket_data_available(ssh_socket s) {
return s->data_to_read; return s->data_to_read;
} }
int ssh_socket_data_writable(struct socket *s) { int ssh_socket_data_writable(ssh_socket s) {
return s->data_to_write; return s->data_to_write;
} }
int ssh_socket_get_status(struct socket *s) { int ssh_socket_get_status(ssh_socket s) {
int r = 0; int r = 0;
if (s->data_to_read) { if (s->data_to_read) {
@ -780,7 +780,7 @@ int ssh_socket_get_status(struct socket *s) {
* which is problematic for hosts having DNS fail-over * which is problematic for hosts having DNS fail-over
*/ */
int ssh_socket_connect(struct socket *s, const char *host, int port, const char *bind_addr){ int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr){
socket_t fd; socket_t fd;
ssh_session session=s->session; ssh_session session=s->session;
ssh_poll_ctx ctx; ssh_poll_ctx ctx;

Просмотреть файл

@ -31,7 +31,7 @@
#include <libssh/poll.h> #include <libssh/poll.h>
int stop=0; int stop=0;
struct socket *s; ssh_socket s;
static int data_rcv(const void *data, size_t len, void *user){ static int data_rcv(const void *data, size_t len, void *user){
printf("Received data: '"); printf("Received data: '");