diff options
Diffstat (limited to 'sockets.h')
-rw-r--r-- | sockets.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -31,8 +31,10 @@ #include <sys/select.h> #include <openssl/ssl.h> #include <openssl/err.h> +#include <fcntl.h> #include "functions.h" +#include "structures.h" #define DEBUG_CRIT 0 #define DEBUG_SOME 1 @@ -71,4 +73,14 @@ int socksend(SSL *fd, char *buf, int bufsize, int tls); // Return character array of latest OpenSSL error char *openssl_error_string(); +// Set a socket "fd" to be blocking ("blocking" = 1) or non-blocking ("blocking" = 0). +// Returns 1 on success or 0 on failure. +int fd_toggle_blocking(int fd, int blocking); + +// Attempt to do SSL_accept() on a client with fd "fd". Expects the socket fd to have just been set +// to non-blocking. Will make the socket blocking again and set the client's pendingsslaccept status +// to 0 if SSL_accept() succeeds. +// Returns 1 on success, 0 on hard failure, or -1 on SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. +int openssl_accept(int fd, struct client *clients, struct ircdstate *ircdstate, struct settings *settings, struct clientcodes *clientcodes); + #endif |