pidgin 2.14.14dev
|
SSL API. More...
Go to the source code of this file.
Data Structures | |
struct | _PurpleSslConnection |
struct | PurpleSslOps |
SSL implementation operations structure. More... | |
Macros | |
#define | PURPLE_SSL_DEFAULT_PORT 443 |
Typedefs | |
typedef struct _PurpleSslConnection | PurpleSslConnection |
typedef void(* | PurpleSslInputFunction) (gpointer, PurpleSslConnection *, PurpleInputCondition) |
typedef void(* | PurpleSslErrorFunction) (PurpleSslConnection *, PurpleSslErrorType, gpointer) |
Enumerations | |
enum | PurpleSslErrorType { PURPLE_SSL_HANDSHAKE_FAILED = 1 , PURPLE_SSL_CONNECT_FAILED = 2 , PURPLE_SSL_CERTIFICATE_INVALID = 3 } |
Possible SSL errors. More... | |
Functions | |
SSL API <br> | |
gboolean | purple_ssl_is_supported (void) |
Returns whether or not SSL is currently supported. | |
const gchar * | purple_ssl_strerror (PurpleSslErrorType error) |
Returns a human-readable string for an SSL error. | |
PurpleSslConnection * | purple_ssl_connect (PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, void *data) |
Makes a SSL connection to the specified host and port. | |
PurpleSslConnection * | purple_ssl_connect_with_ssl_cn (PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, const char *ssl_host, void *data) |
Makes a SSL connection to the specified host and port, using the separate name to verify with the certificate. | |
PurpleSslConnection * | purple_ssl_connect_fd (PurpleAccount *account, int fd, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, void *data) |
Makes a SSL connection using an already open file descriptor. | |
PurpleSslConnection * | purple_ssl_connect_with_host_fd (PurpleAccount *account, int fd, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, const char *host, void *data) |
Makes a SSL connection using an already open file descriptor. | |
void | purple_ssl_input_add (PurpleSslConnection *gsc, PurpleSslInputFunction func, void *data) |
Adds an input watcher for the specified SSL connection. | |
void | purple_ssl_close (PurpleSslConnection *gsc) |
Closes a SSL connection. | |
size_t | purple_ssl_read (PurpleSslConnection *gsc, void *buffer, size_t len) |
Reads data from an SSL connection. | |
size_t | purple_ssl_write (PurpleSslConnection *gsc, const void *buffer, size_t len) |
Writes data to an SSL connection. | |
GList * | purple_ssl_get_peer_certificates (PurpleSslConnection *gsc) |
Obtains the peer's presented certificates. | |
Subsystem API <br> | |
void | purple_ssl_set_ops (PurpleSslOps *ops) |
Sets the current SSL operations structure. | |
PurpleSslOps * | purple_ssl_get_ops (void) |
Returns the current SSL operations structure. | |
void | purple_ssl_init (void) |
Initializes the SSL subsystem. | |
void | purple_ssl_uninit (void) |
Uninitializes the SSL subsystem. | |
SSL API.
Definition in file sslconn.h.
typedef struct _PurpleSslConnection PurpleSslConnection |
typedef void(* PurpleSslErrorFunction) (PurpleSslConnection *, PurpleSslErrorType, gpointer) |
typedef void(* PurpleSslInputFunction) (gpointer, PurpleSslConnection *, PurpleInputCondition) |
enum PurpleSslErrorType |
void purple_ssl_close | ( | PurpleSslConnection * | gsc | ) |
Closes a SSL connection.
gsc | The SSL connection to close. |
PurpleSslConnection * purple_ssl_connect | ( | PurpleAccount * | account, |
const char * | host, | ||
int | port, | ||
PurpleSslInputFunction | func, | ||
PurpleSslErrorFunction | error_func, | ||
void * | data | ||
) |
Makes a SSL connection to the specified host and port.
The caller should keep track of the returned value and use it to cancel the connection, if needed.
account | The account making the connection. |
host | The destination host. |
port | The destination port. |
func | The SSL input handler function. |
error_func | The SSL error handler function. This function should NOT call purple_ssl_close(). In the event of an error the PurpleSslConnection will be destroyed for you. |
data | User-defined data. |
PurpleSslConnection * purple_ssl_connect_fd | ( | PurpleAccount * | account, |
int | fd, | ||
PurpleSslInputFunction | func, | ||
PurpleSslErrorFunction | error_func, | ||
void * | data | ||
) |
Makes a SSL connection using an already open file descriptor.
account | The account making the connection. |
fd | The file descriptor. |
func | The SSL input handler function. |
error_func | The SSL error handler function. |
data | User-defined data. |
PurpleSslConnection * purple_ssl_connect_with_host_fd | ( | PurpleAccount * | account, |
int | fd, | ||
PurpleSslInputFunction | func, | ||
PurpleSslErrorFunction | error_func, | ||
const char * | host, | ||
void * | data | ||
) |
Makes a SSL connection using an already open file descriptor.
account | The account making the connection. |
fd | The file descriptor. |
func | The SSL input handler function. |
error_func | The SSL error handler function. |
host | The hostname of the other peer (to verify the CN) |
data | User-defined data. |
PurpleSslConnection * purple_ssl_connect_with_ssl_cn | ( | PurpleAccount * | account, |
const char * | host, | ||
int | port, | ||
PurpleSslInputFunction | func, | ||
PurpleSslErrorFunction | error_func, | ||
const char * | ssl_host, | ||
void * | data | ||
) |
Makes a SSL connection to the specified host and port, using the separate name to verify with the certificate.
The caller should keep track of the returned value and use it to cancel the connection, if needed.
account | The account making the connection. |
host | The destination host. |
port | The destination port. |
func | The SSL input handler function. |
error_func | The SSL error handler function. This function should NOT call purple_ssl_close(). In the event of an error the PurpleSslConnection will be destroyed for you. |
ssl_host | The hostname of the other peer (to verify the CN) |
data | User-defined data. |
PurpleSslOps * purple_ssl_get_ops | ( | void | ) |
Returns the current SSL operations structure.
GList * purple_ssl_get_peer_certificates | ( | PurpleSslConnection * | gsc | ) |
Obtains the peer's presented certificates.
gsc | The SSL connection handle |
void purple_ssl_input_add | ( | PurpleSslConnection * | gsc, |
PurpleSslInputFunction | func, | ||
void * | data | ||
) |
Adds an input watcher for the specified SSL connection.
Once the SSL handshake is complete, use this to watch for actual data across it.
gsc | The SSL connection handle. |
func | The callback function. |
data | User-defined data. |
gboolean purple_ssl_is_supported | ( | void | ) |
Returns whether or not SSL is currently supported.
size_t purple_ssl_read | ( | PurpleSslConnection * | gsc, |
void * | buffer, | ||
size_t | len | ||
) |
Reads data from an SSL connection.
gsc | The SSL connection handle. |
buffer | The destination buffer. |
len | The maximum number of bytes to read. |
void purple_ssl_set_ops | ( | PurpleSslOps * | ops | ) |
Sets the current SSL operations structure.
ops | The SSL operations structure to assign. |
const gchar * purple_ssl_strerror | ( | PurpleSslErrorType | error | ) |
Returns a human-readable string for an SSL error.
error | Error code |
size_t purple_ssl_write | ( | PurpleSslConnection * | gsc, |
const void * | buffer, | ||
size_t | len | ||
) |
Writes data to an SSL connection.
gsc | The SSL connection handle. |
buffer | The buffer to write. |
len | The length of the data to write. |