Ecore URL Connection Functions

Utility functions that set up, use and shut down the Ecore URL Connection library. More...

Functions

EAPI int ecore_con_url_init (void)
 Initialises the Ecore_Con_Url library.
EAPI int ecore_con_url_shutdown (void)
 Shuts down the Ecore_Con_Url library.
EAPI Ecore_Con_Url * ecore_con_url_new (const char *url)
 Creates and initializes a new Ecore_Con_Url connection object.
EAPI Ecore_Con_Url * ecore_con_url_custom_new (const char *url, const char *custom_request)
 Creates a custom connection object.
EAPI void ecore_con_url_destroy (Ecore_Con_Url *url_con)
 Destroys a Ecore_Con_Url connection object.
EAPI int ecore_con_url_url_set (Ecore_Con_Url *url_con, const char *url)
 Sets the URL to send the request to.
EAPI void ecore_con_url_data_set (Ecore_Con_Url *url_con, void *data)
 Associates data with a connection object.
EAPI void ecore_con_url_additional_header_add (Ecore_Con_Url *url_con, const char *key, const char *value)
 Adds an additional header to the request connection object.
EAPI void * ecore_con_url_data_get (Ecore_Con_Url *url_con)
 Retrieves data associated with a Ecore_Con_Url connection object.
EAPI void ecore_con_url_time (Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t tm)
 FIXME: To be documented.
EAPI void ecore_con_url_fd_set (Ecore_Con_Url *url_con, int fd)
 Setup a file for receiving request data.
EAPI int ecore_con_url_received_bytes_get (Ecore_Con_Url *url_con)
 Retrieves the number of bytes received.
EAPI const Eina_List * ecore_con_url_response_headers_get (Ecore_Con_Url *url_con)
 Retrieves headers from last request sent.
EAPI int ecore_con_url_httpauth_set (Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
 Sets url_con to use http auth, with given username and password, "safely" or not.
EAPI int ecore_con_url_send (Ecore_Con_Url *url_con, const void *data, size_t length, const char *content_type)
 Sends a request.
EAPI int ecore_con_url_ftp_upload (Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
 Makes a FTP upload.
EAPI int ecore_con_url_http_post_send (Ecore_Con_Url *url_con, void *httppost)
 Send a Curl httppost.
EAPI void ecore_con_url_verbose_set (Ecore_Con_Url *url_con, int verbose)
 Enable or disable libcurl verbose output, useful for debug.
EAPI void ecore_con_url_ftp_use_epsv_set (Ecore_Con_Url *url_con, int use_epsv)
 Enable or disable EPSV extension.

Detailed Description

Utility functions that set up, use and shut down the Ecore URL Connection library.

FIXME: write detailed description


Function Documentation

EAPI void ecore_con_url_additional_header_add ( Ecore_Con_Url *  url_con,
const char *  key,
const char *  value 
)

Adds an additional header to the request connection object.

Adds an additional header to the request connection object. This addition will be valid for only one ecore_con_url_send() call.

Parameters:
url_conConnection object
keyHeader key
valueHeader value
See also:
ecore_con_url_send()
ecore_con_url_additional_headers_clear()
EAPI Ecore_Con_Url* ecore_con_url_custom_new ( const char *  url,
const char *  custom_request 
)

Creates a custom connection object.

Creates and initializes a new Ecore_Con_Url for a custom request (e.g. HEAD, SUBSCRIBE and other obscure HTTP requests). This object should be used like one created with ecore_con_url_new().

Parameters:
urlURL that will receive requests
custom_requestCustom request (e.g. GET, POST, HEAD, PUT, etc)
Returns:
NULL on error, a new Ecore_Con_Url on success.
See also:
ecore_con_url_new()
ecore_con_url_url_set()

References ecore_con_url_new().

EAPI void* ecore_con_url_data_get ( Ecore_Con_Url *  url_con)

Retrieves data associated with a Ecore_Con_Url connection object.

Retrieves data associated with a Ecore_Con_Url connection object (previously set with ecore_con_url_data_set()).

Parameters:
Connectionobject to retrieve data from.
Returns:
Data associated with the given object.
See also:
ecore_con_url_data_set()

Referenced by ecore_file_download_abort().

EAPI void ecore_con_url_data_set ( Ecore_Con_Url *  url_con,
void *  data 
)

Associates data with a connection object.

Associates data with a connection object, which can be retrieved later with ecore_con_url_data_get()).

Parameters:
url_conConnection object to associate data.
dataData to be set.
See also:
ecore_con_url_data_get()
EAPI void ecore_con_url_destroy ( Ecore_Con_Url *  url_con)

Destroys a Ecore_Con_Url connection object.

See also:
ecore_con_url_new()

References ecore_main_fd_handler_del().

Referenced by ecore_con_url_init(), ecore_con_url_shutdown(), and ecore_file_download_abort().

EAPI void ecore_con_url_fd_set ( Ecore_Con_Url *  url_con,
int  fd 
)

Setup a file for receiving request data.

Setups a file to have response data written into. Note that ECORE_CON_EVENT_URL_DATA events will not be emitted if a file has been set to receive the response data.

Parameters:
url_conConnection object to set file
fdFile descriptor associated with the file
EAPI int ecore_con_url_ftp_upload ( Ecore_Con_Url *  url_con,
const char *  filename,
const char *  user,
const char *  pass,
const char *  upload_dir 
)

Makes a FTP upload.

Returns:
FIXME: To be more documented.

References ecore_con_url_url_set().

EAPI void ecore_con_url_ftp_use_epsv_set ( Ecore_Con_Url *  url_con,
int  use_epsv 
)

Enable or disable EPSV extension.

Returns:
FIXME: To be more documented.
EAPI int ecore_con_url_http_post_send ( Ecore_Con_Url *  url_con,
void *  httppost 
)

Send a Curl httppost.

Returns:
1 on success, 0 on error.

References ecore_con_url_send().

EAPI int ecore_con_url_httpauth_set ( Ecore_Con_Url *  url_con,
const char *  username,
const char *  password,
Eina_Bool  safe 
)

Sets url_con to use http auth, with given username and password, "safely" or not.

Parameters:
url_conConnection object to perform a request on, previously created with ecore_con_url_new() or ecore_con_url_custom_new().
usernameUsername to use in authentication
passwordPassword to use in authentication
safeWhether to use "safer" methods (eg, NOT http basic auth)
Returns:
1 on success, 0 on error.
EAPI int ecore_con_url_init ( void  )

Initialises the Ecore_Con_Url library.

Returns:
Number of times the library has been initialised without being shut down.

References ecore_con_url_destroy(), ecore_event_type_new(), and ecore_timer_add().

EAPI Ecore_Con_Url* ecore_con_url_new ( const char *  url)

Creates and initializes a new Ecore_Con_Url connection object.

Creates and initializes a new Ecore_Con_Url connection object that can be uesd for sending requests.

Parameters:
urlURL that will receive requests. Can be changed using ecore_con_url_url_set.
Returns:
NULL on error, a new Ecore_Con_Url on success.
See also:
ecore_con_url_custom_new()
ecore_con_url_url_set()

References ecore_con_url_url_set().

Referenced by ecore_con_url_custom_new().

EAPI int ecore_con_url_received_bytes_get ( Ecore_Con_Url *  url_con)

Retrieves the number of bytes received.

Retrieves the number of bytes received on the last request of the given connection object.

Parameters:
url_conConnection object which the request was sent on.
Returns:
Number of bytes received on request.
See also:
ecore_con_url_send()
EAPI const Eina_List* ecore_con_url_response_headers_get ( Ecore_Con_Url *  url_con)

Retrieves headers from last request sent.

Retrieves a list containing the response headers. This function should be used after an ECORE_CON_EVENT_URL_COMPLETE event (headers should normally be ready at that time).

Parameters:
url_conConnection object to retrieve response headers from.
Returns:
List of response headers. This list must not be modified by the user.
EAPI int ecore_con_url_send ( Ecore_Con_Url *  url_con,
const void *  data,
size_t  length,
const char *  content_type 
)

Sends a request.

Parameters:
url_conConnection object to perform a request on, previously created with ecore_con_url_new() or ecore_con_url_custom_new().
dataPayload (data sent on the request)
lengthPayload length
content_typeContent type of the payload (e.g. text/xml)
Returns:
1 on success, 0 on error.
See also:
ecore_con_url_custom_new()
ecore_con_url_additional_headers_clear()
ecore_con_url_additional_header_add()
ecore_con_url_data_set()
ecore_con_url_data_get()
ecore_con_url_response_headers_get()

Referenced by ecore_con_url_http_post_send().

EAPI int ecore_con_url_shutdown ( void  )

Shuts down the Ecore_Con_Url library.

Returns:
Number of calls that still uses Ecore_Con_Url

References ecore_con_url_destroy(), ecore_idler_del(), and ecore_timer_del().

EAPI void ecore_con_url_time ( Ecore_Con_Url *  url_con,
Ecore_Con_Url_Time  condition,
time_t  tm 
)

FIXME: To be documented.

Returns:
FIXME: To be documented.
EAPI int ecore_con_url_url_set ( Ecore_Con_Url *  url_con,
const char *  url 
)

Sets the URL to send the request to.

Parameters:
url_conConnection object through which the request will be sent.
urlURL that will receive the request
Returns:
1 on success, 0 on error.

Referenced by ecore_con_url_ftp_upload(), and ecore_con_url_new().

EAPI void ecore_con_url_verbose_set ( Ecore_Con_Url *  url_con,
int  verbose 
)

Enable or disable libcurl verbose output, useful for debug.

Returns:
FIXME: To be more documented.