SSL support functions

SSL support functions — Functions to send and receive encrypted data over a socket.

Synopsis

typedef             MateVFSSSL;
gboolean            mate_vfs_ssl_enabled               (void);
MateVFSResult      mate_vfs_ssl_create                (MateVFSSSL **handle_return,
                                                         const char *host,
                                                         unsigned int port,
                                                         MateVFSCancellation *cancellation);
MateVFSResult      mate_vfs_ssl_create_from_fd        (MateVFSSSL **handle_return,
                                                         gint fd,
                                                         MateVFSCancellation *cancellation);
MateVFSResult      mate_vfs_ssl_read                  (MateVFSSSL *ssl,
                                                         gpointer buffer,
                                                         MateVFSFileSize bytes,
                                                         MateVFSFileSize *bytes_read,
                                                         MateVFSCancellation *cancellation);
MateVFSResult      mate_vfs_ssl_write                 (MateVFSSSL *ssl,
                                                         gconstpointer buffer,
                                                         MateVFSFileSize bytes,
                                                         MateVFSFileSize *bytes_written,
                                                         MateVFSCancellation *cancellation);
void                mate_vfs_ssl_destroy               (MateVFSSSL *ssl,
                                                         MateVFSCancellation *cancellation);
MateVFSSocket *    mate_vfs_ssl_to_socket             (MateVFSSSL *ssl);
MateVFSResult      mate_vfs_ssl_set_timeout           (MateVFSSSL *ssl,
                                                         GTimeVal *timeout,
                                                         MateVFSCancellation *cancellation);

Description

Details

MateVFSSSL

typedef struct MateVFSSSL MateVFSSSL;


mate_vfs_ssl_enabled ()

gboolean            mate_vfs_ssl_enabled               (void);

Checks whether mate-vfs was compiled with SSL support.

Returns :

TRUE if mate-vfs was compiled with SSL support, otherwise FALSE.

mate_vfs_ssl_create ()

MateVFSResult      mate_vfs_ssl_create                (MateVFSSSL **handle_return,
                                                         const char *host,
                                                         unsigned int port,
                                                         MateVFSCancellation *cancellation);

Creates an SSL socket connection at handle_return to host using port port.

handle_return :

pointer to a MateVFSSSL struct, which will contain an allocated MateVFSSSL object on return.

host :

string indicating the hostname to establish an SSL connection with.

port :

port number to connect to.

cancellation :

handle allowing cancellation of the operation.

Returns :

MateVFSResult indicating the success of the operation.

mate_vfs_ssl_create_from_fd ()

MateVFSResult      mate_vfs_ssl_create_from_fd        (MateVFSSSL **handle_return,
                                                         gint fd,
                                                         MateVFSCancellation *cancellation);

Try to establish an SSL connection over the file descriptor fd.

handle_return :

pointer to a MateVFSSSL struct, which will contain an allocated MateVFSSSL object on return.

fd :

file descriptior to try and establish an SSL connection over.

cancellation :

handle allowing cancellation of the operation.

Returns :

a MateVFSResult indicating the success of the operation.

mate_vfs_ssl_read ()

MateVFSResult      mate_vfs_ssl_read                  (MateVFSSSL *ssl,
                                                         gpointer buffer,
                                                         MateVFSFileSize bytes,
                                                         MateVFSFileSize *bytes_read,
                                                         MateVFSCancellation *cancellation);

Read bytes bytes of data from the SSL socket ssl into buffer.

ssl :

SSL socket to read data from.

buffer :

allocated buffer of at least bytes bytes to write into.

bytes :

number of bytes to read from ssl into buffer.

bytes_read :

pointer to a MateVFSFileSize, will contain the number of bytes actually read from the socket ssl on return.

cancellation :

handle allowing cancellation of the operation.

Returns :

MateVFSResult indicating the success of the operation.

mate_vfs_ssl_write ()

MateVFSResult      mate_vfs_ssl_write                 (MateVFSSSL *ssl,
                                                         gconstpointer buffer,
                                                         MateVFSFileSize bytes,
                                                         MateVFSFileSize *bytes_written,
                                                         MateVFSCancellation *cancellation);

Write bytes bytes of data from buffer to ssl.

ssl :

SSL socket to write data to.

buffer :

data to write to the socket.

bytes :

number of bytes to write from buffer to ssl.

bytes_written :

pointer to a MateVFSFileSize, will contain the number of bytes actually written to the socket on return.

cancellation :

handle allowing cancellation of the operation.

Returns :

MateVFSResult indicating the success of the operation.

mate_vfs_ssl_destroy ()

void                mate_vfs_ssl_destroy               (MateVFSSSL *ssl,
                                                         MateVFSCancellation *cancellation);

Free resources used by ssl and close the connection.

ssl :

SSL socket to be closed and destroyed.

cancellation :

handle allowing cancellation of the operation.

mate_vfs_ssl_to_socket ()

MateVFSSocket *    mate_vfs_ssl_to_socket             (MateVFSSSL *ssl);

Wrap an SSL socket inside a standard MateVFSSocket.

ssl :

SSL socket to convert into a standard socket.

Returns :

a newly allocated MateVFSSocket corresponding to ssl.

mate_vfs_ssl_set_timeout ()

MateVFSResult      mate_vfs_ssl_set_timeout           (MateVFSSSL *ssl,
                                                         GTimeVal *timeout,
                                                         MateVFSCancellation *cancellation);

Set a timeout of timeout. If timeout is NULL following operations will block indefinitely).

Note if you set timeout to 0 (means tv_sec and tv_usec are both 0) every following operation will return immediately. (This can be used for polling.)

ssl :

SSL socket to set the timeout of.

timeout :

the timeout.

cancellation :

optional cancellation object.

Returns :

MateVFSResult indicating the success of the operation.

Since 2.8