connection

Name

connection -- Manage connections work.

Synopsis



            UCConn;
void        uc_conn_init                    (void);
GArray*     uc_server_get_response          (const gchar *proto,
                                             gchar *host,
                                             const guint port,
                                             gchar *buffer);

Description

Details

UCConn

typedef struct {
  gint socket;
  pthread_t thread_id;
  gboolean thread_end;
  gboolean thread_ftp_end;
  gboolean timeout;
  UCTcpState tcp_state;
  UCTcpStatus tcp_status;
  gchar *hostname;
  guint port;
  GArray *array;
  gchar *request;
#ifdef ENABLE_GNUTLS
  gnutls_session session_gnutls;
  gboolean use_gnutls;
#endif
  gboolean use_ftp;
  gboolean ftp_passive;
  gint ftp_passive_socket;
  guint ftp_passive_port;
} UCConn;

Here we store connection informations.

gint socket;

The socket descriptor.

pthread_t thread_id;

current thread.

gboolean thread_end;

TRUE when the main thread is not yet running.

gboolean thread_ftp_end;

TRUE when the FTP thread is not yet running.

gboolean timeout;

TRUE if a timeout occured while retreiving/sending data.

UCTcpState tcp_state;

A UCTcpState value to describe the connection state.

UCTcpStatus tcp_status;

A UCTcpState value to describe the connection status.

gchar *hostname;

Name of the host.

guint port;

Port of the host.

GArray *array;

This array is used for saving server response.

gchar *request;

The request to send to the server.

gboolean use_gnutls;

TRUE if the protocol require GNU TLS (HTTPS).

gboolean ftp_passive;

TRUE if we are reading a FTP response.

gint ftp_passive_socket;

Socket to use if we are managing FTP response.

guint ftp_passive_port;

Port to use to read FTP response.


uc_conn_init ()

void        uc_conn_init                    (void);

Initialize connections


uc_server_get_response ()

GArray*     uc_server_get_response          (const gchar *proto,
                                             gchar *host,
                                             const guint port,
                                             gchar *buffer);

Connect to a host:port, send a HTTP request and return the content of the HTTP response.

proto :

The protocol.

host :

The host.

port :

The port.

buffer :

The HTTP request to send.

Returns :

Content of the HTTP response.