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,
139 ssh_poll_handle
ssh_poll_new(socket_t fd,
short events, ssh_poll_callback cb,
156 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:373
void ssh_poll_set_events(ssh_poll_handle p, short events)
Set the events of a poll object.
Definition: poll.c:333
ssh_poll_ctx ssh_poll_get_ctx(ssh_poll_handle p)
Get the poll context of a poll object.
Definition: poll.c:311
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:267
void ssh_poll_add_events(ssh_poll_handle p, short events)
Add extra events to a poll object.
Definition: poll.c:362
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:576
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:400
int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p)
Add a poll object to a poll context.
Definition: poll.c:485
ssh_poll_ctx ssh_poll_ctx_new(size_t chunk_size)
Create a new poll context.
Definition: poll.c:418
int ssh_poll_ctx_add_socket(ssh_poll_ctx ctx, ssh_socket s)
Add a socket object to a poll context.
Definition: poll.c:517
short ssh_poll_get_events(ssh_poll_handle p)
Get the events of a poll object.
Definition: poll.c:322
void ssh_poll_free(ssh_poll_handle p)
Free a poll object.
Definition: poll.c:296
void ssh_poll_ctx_free(ssh_poll_ctx ctx)
Free a poll context.
Definition: poll.c:441
void ssh_poll_set_fd(ssh_poll_handle p, socket_t fd)
Set the file descriptor of a poll object.
Definition: poll.c:347
socket_t ssh_poll_get_fd(ssh_poll_handle p)
Get the raw socket of a poll object.
Definition: poll.c:385
void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p)
Remove a poll object from a poll context.
Definition: poll.c:539