Changeset 0aaca60 for lib/ssl_client.h


Ignore:
Timestamp:
2006-07-19T16:52:38Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d3a672c
Parents:
04026d4
Message:

Added some (more) comments to .h files in lib/ and some minor fixes/cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/ssl_client.h

    r04026d4 r0aaca60  
    2424*/
    2525
     26/* ssl_client makes it easier to open SSL connections to servers. (It
     27   doesn't offer SSL server functionality yet, but it could be useful
     28   to add it later.) Different ssl_client modules are available, and
     29   ssl_client tries to make them all behave the same. It's very simple
     30   and basic, it just imitates the proxy_connect() function from the
     31   Gaim libs and passes the socket to the program once the handshake
     32   is completed. */
     33
    2634#include <glib.h>
    2735#include "proxy.h"
    2836
     37/* Some generic error codes. Especially SSL_AGAIN is important if you
     38   want to do asynchronous I/O. */
    2939#define SSL_OK            0
    3040#define SSL_NOHANDSHAKE   1
     
    3343extern int ssl_errno;
    3444
     45/* This is what your callback function should look like. */
    3546typedef gboolean (*ssl_input_function)(gpointer, void*, b_input_condition);
    3647
     48
     49/* Connect to host:port, call the given function when the connection is
     50   ready to be used for SSL traffic. This is all done asynchronously, no
     51   blocking I/O! (Except for the DNS lookups, for now...) */
    3752G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data );
     53
     54/* Obviously you need special read/write functions to read data. */
    3855G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len );
    3956G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len );
     57
     58/* Abort the SSL connection and disconnect the socket. Do not use close()
     59   directly, both the SSL library and the peer will be unhappy! */
    4060G_MODULE_EXPORT void ssl_disconnect( void *conn_ );
     61
     62/* Get the fd for this connection, you will usually need it for event
     63   handling. */
    4164G_MODULE_EXPORT int ssl_getfd( void *conn );
     65
     66/* This function returns GAIM_INPUT_READ/WRITE. With SSL connections it's
     67   possible that something has to be read while actually were trying to
     68   write something (think about key exchange/refresh/etc). So when an
     69   SSL operation returned SSL_AGAIN, *always* use this function when
     70   adding an event handler to the queue. (And it should perform exactly
     71   the same action as the handler that just received the SSL_AGAIN.) */
    4272G_MODULE_EXPORT b_input_condition ssl_getdirection( void *conn );
Note: See TracChangeset for help on using the changeset viewer.