Changeset 5ebff60 for lib/ssl_client.h
- Timestamp:
- 2015-02-20T22:50:54Z (9 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/ssl_client.h
raf359b4 r5ebff60 1 1 /********************************************************************\ 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * … … 57 57 58 58 /* Perform any global initialization the SSL library might need. */ 59 G_MODULE_EXPORT void ssl_init( void);59 G_MODULE_EXPORT void ssl_init(void); 60 60 61 61 /* Connect to host:port, call the given function when the connection is 62 62 ready to be used for SSL traffic. This is all done asynchronously, no 63 63 blocking I/O! (Except for the DNS lookups, for now...) */ 64 G_MODULE_EXPORT void *ssl_connect( char *host, int port, gboolean verify, ssl_input_function func, gpointer data);64 G_MODULE_EXPORT void *ssl_connect(char *host, int port, gboolean verify, ssl_input_function func, gpointer data); 65 65 66 66 /* Start an SSL session on an existing fd. Useful for STARTTLS functionality, 67 67 for example in Jabber. */ 68 G_MODULE_EXPORT void *ssl_starttls( int fd, char *hostname, gboolean verify, ssl_input_function func, gpointer data);68 G_MODULE_EXPORT void *ssl_starttls(int fd, char *hostname, gboolean verify, ssl_input_function func, gpointer data); 69 69 70 70 /* Obviously you need special read/write functions to read data. */ 71 G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len);72 G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len);71 G_MODULE_EXPORT int ssl_read(void *conn, char *buf, int len); 72 G_MODULE_EXPORT int ssl_write(void *conn, const char *buf, int len); 73 73 74 74 /* Now needed by most SSL libs. See for more info: 75 75 http://www.gnu.org/software/gnutls/manual/gnutls.html#index-gnutls_005frecord_005fcheck_005fpending-209 76 76 http://www.openssl.org/docs/ssl/SSL_pending.html 77 77 78 78 Required because OpenSSL empties the TCP buffer completely but doesn't 79 79 necessarily give us all the unencrypted data. Or maybe you didn't ask 80 80 for all of it because your buffer is too small. 81 81 82 82 Returns 0 if there's nothing left, 1 if there's more data. */ 83 G_MODULE_EXPORT int ssl_pending( void *conn);83 G_MODULE_EXPORT int ssl_pending(void *conn); 84 84 85 85 /* Abort the SSL connection and disconnect the socket. Do not use close() 86 86 directly, both the SSL library and the peer will be unhappy! */ 87 G_MODULE_EXPORT void ssl_disconnect( void *conn_);87 G_MODULE_EXPORT void ssl_disconnect(void *conn_); 88 88 89 89 /* Get the fd for this connection, you will usually need it for event 90 90 handling. */ 91 G_MODULE_EXPORT int ssl_getfd( void *conn);91 G_MODULE_EXPORT int ssl_getfd(void *conn); 92 92 93 93 /* This function returns B_EV_IO_READ/WRITE. With SSL connections it's … … 97 97 adding an event handler to the queue. (And it should perform exactly 98 98 the same action as the handler that just received the SSL_AGAIN.) */ 99 G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn);99 G_MODULE_EXPORT b_input_condition ssl_getdirection(void *conn); 100 100 101 101 /* Converts a verification bitfield passed to ssl_input_function into 102 102 a more useful string. Or NULL if it had no useful bits set. */ 103 G_MODULE_EXPORT char *ssl_verify_strerror( int code);103 G_MODULE_EXPORT char *ssl_verify_strerror(int code); 104 104 105 G_MODULE_EXPORT size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, const unsigned char *input, size_t input_len, const unsigned char *iv, unsigned char **res); 105 G_MODULE_EXPORT size_t ssl_des3_encrypt(const unsigned char *key, size_t key_len, const unsigned char *input, 106 size_t input_len, const unsigned char *iv, unsigned char **res);
Note: See TracChangeset
for help on using the changeset viewer.