libssh  0.10.90
The SSH library
All Data Structures Functions Variables Typedefs Enumerator Modules Pages
socket.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2009 by Aris Adamantiadis
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef SOCKET_H_
22#define SOCKET_H_
23
24#include "libssh/callbacks.h"
25struct ssh_poll_handle_struct;
26/* socket.c */
27
28struct ssh_socket_struct;
29typedef struct ssh_socket_struct* ssh_socket;
30
31int ssh_socket_init(void);
32void ssh_socket_cleanup(void);
33ssh_socket ssh_socket_new(ssh_session session);
34void ssh_socket_reset(ssh_socket s);
35void ssh_socket_free(ssh_socket s);
36void ssh_socket_set_fd(ssh_socket s, socket_t fd);
37socket_t ssh_socket_get_fd(ssh_socket s);
38void ssh_socket_set_connected(ssh_socket s, struct ssh_poll_handle_struct *p);
39int ssh_socket_unix(ssh_socket s, const char *path);
40void ssh_execute_command(const char *command, socket_t in, socket_t out);
41#ifndef _WIN32
42int ssh_socket_connect_proxycommand(ssh_socket s, const char *command);
43#endif
44void ssh_socket_close(ssh_socket s);
45int ssh_socket_write(ssh_socket s,const void *buffer, uint32_t len);
46int ssh_socket_is_open(ssh_socket s);
47int ssh_socket_fd_isset(ssh_socket s, fd_set *set);
48void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd);
49void ssh_socket_set_fd_in(ssh_socket s, socket_t fd);
50void ssh_socket_set_fd_out(ssh_socket s, socket_t fd);
51int ssh_socket_nonblocking_flush(ssh_socket s);
52void ssh_socket_set_write_wontblock(ssh_socket s);
53void ssh_socket_set_read_wontblock(ssh_socket s);
54void ssh_socket_set_except(ssh_socket s);
55int ssh_socket_get_status(ssh_socket s);
56int ssh_socket_get_poll_flags(ssh_socket s);
57int ssh_socket_buffered_write_bytes(ssh_socket s);
58int ssh_socket_data_available(ssh_socket s);
59int ssh_socket_data_writable(ssh_socket s);
60int ssh_socket_set_nonblocking(socket_t fd);
61int ssh_socket_set_blocking(socket_t fd);
62
63void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks);
64int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s);
65struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(ssh_socket s);
66
67int ssh_socket_connect(ssh_socket s,
68 const char *host,
69 uint16_t port,
70 const char *bind_addr);
71
72#endif /* SOCKET_H_ */
int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s)
SSH poll callback. This callback will be used when an event caught on the socket.
Definition socket.c:235
void ssh_socket_cleanup(void)
Cleanup the socket system.
Definition socket.c:128
Definition callbacks.h:409