29 typedef struct pollfd ssh_pollfd_t;
35 typedef struct ssh_pollfd_struct {
41 typedef unsigned long int nfds_t;
46 #define POLLRDNORM 0x0100
49 #define POLLRDBAND 0x0200
52 #define POLLIN (POLLRDNORM | POLLRDBAND)
55 #define POLLPRI 0x0400
59 #define POLLWRNORM 0x0010
62 #define POLLOUT (POLLWRNORM)
65 #define POLLWRBAND 0x0020
69 #define POLLERR 0x0001
72 #define POLLHUP 0x0002
75 #define POLLNVAL 0x0004
98 #define POLLNVAL 0x020
102 #define POLLRDNORM 0x040
105 #define POLLRDBAND 0x080
108 #define POLLWRNORM 0x100
111 #define POLLWRBAND 0x200
117 void ssh_poll_init(
void);
118 void ssh_poll_cleanup(
void);
119 int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds,
int timeout);
120 typedef struct ssh_poll_ctx_struct *ssh_poll_ctx;
121 typedef struct ssh_poll_handle_struct *ssh_poll_handle;
135 typedef int (*ssh_poll_callback)(ssh_poll_handle p, socket_t fd,
int revents,
138 struct ssh_socket_struct;
140 ssh_poll_handle
ssh_poll_new(socket_t fd,
short events, ssh_poll_callback cb,
157 ssh_poll_ctx ssh_poll_get_default_ctx(ssh_session session);
void ssh_poll_remove_events(ssh_poll_handle p, short events)
Remove events from a poll object.
Definition: poll.c:382
void ssh_poll_set_events(ssh_poll_handle p, short events)
Set the events of a poll object.
Definition: poll.c:342
ssh_poll_ctx ssh_poll_get_ctx(ssh_poll_handle p)
Get the poll context of a poll object.
Definition: poll.c:320
ssh_poll_handle ssh_poll_new(socket_t fd, short events, ssh_poll_callback cb, void *userdata)
Allocate a new poll object, which could be used within a poll context.
Definition: poll.c:280
void ssh_poll_add_events(ssh_poll_handle p, short events)
Add extra events to a poll object.
Definition: poll.c:371
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout)
Poll all the sockets associated through a poll object with a poll context.
Definition: poll.c:594
void ssh_poll_set_callback(ssh_poll_handle p, ssh_poll_callback cb, void *userdata)
Set the callback of a poll object.
Definition: poll.c:409
int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p)
Add a poll object to a poll context.
Definition: poll.c:502
ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size)
Create a new poll context.
Definition: poll.c:427
int ssh_poll_ctx_add_socket(ssh_poll_ctx ctx, ssh_socket s)
Add a socket object to a poll context.
Definition: poll.c:534
short ssh_poll_get_events(ssh_poll_handle p)
Get the events of a poll object.
Definition: poll.c:331
void ssh_poll_free(ssh_poll_handle p)
Free a poll object.
Definition: poll.c:305
void ssh_poll_ctx_free(ssh_poll_ctx ctx)
Free a poll context.
Definition: poll.c:450
void ssh_poll_set_fd(ssh_poll_handle p, socket_t fd)
Set the file descriptor of a poll object.
Definition: poll.c:356
socket_t ssh_poll_get_fd(ssh_poll_handle p)
Get the raw socket of a poll object.
Definition: poll.c:394
void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p)
Remove a poll object from a poll context.
Definition: poll.c:556