ecore_con_url_destroy -> ecore_con_url_free
also some small function rearranging SVN revision: 52534
This commit is contained in:
parent
6121edec86
commit
ad3ecd489a
|
@ -33,8 +33,7 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* @file Ecore_Con.h
|
||||
* @brief Sockets functions.
|
||||
* @defgroup Ecore_Con_Group Ecore_Con - Connection functions
|
||||
*
|
||||
* The Ecore Connection Library ( @c Ecore_Con ) provides simple mechanisms
|
||||
* for communications between programs using reliable sockets. It saves
|
||||
|
@ -53,7 +52,7 @@
|
|||
*
|
||||
* To connect to a server, call @c ecore_con_server_connect(). Data can
|
||||
* then be sent to the server using the @c ecore_con_server_send().
|
||||
*
|
||||
*
|
||||
* Functions are described in the following groupings:
|
||||
* @li @ref Ecore_Con_Lib_Group
|
||||
* @li @ref Ecore_Con_Server_Group
|
||||
|
@ -65,7 +64,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Con_Events_Group Events
|
||||
* @defgroup Ecore_Con_Events_Group Events
|
||||
*
|
||||
* @li ECORE_CON_CLIENT_ADD: Whenever a client connection is made to an
|
||||
* @c Ecore_Con_Server, an event of this type is emitted, allowing the
|
||||
|
@ -105,81 +104,31 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @typedef Ecore_Con_Server
|
||||
* A connection handle to a server
|
||||
*/
|
||||
typedef struct _Ecore_Con_Server Ecore_Con_Server;
|
||||
/** @typedef Ecore_Con_Client
|
||||
* A connection handle to a client
|
||||
*/
|
||||
typedef struct _Ecore_Con_Client Ecore_Con_Client;
|
||||
/** @typedef Ecore_Con_Url
|
||||
* A handle to an http upload/download object
|
||||
*/
|
||||
typedef struct _Ecore_Con_Url Ecore_Con_Url;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Dns_Cb
|
||||
* A callback type for use with @ref ecore_con_lookup.
|
||||
*/
|
||||
typedef void (*Ecore_Con_Dns_Cb)(const char *canonname,
|
||||
const char *ip,
|
||||
struct sockaddr *addr,
|
||||
int addrlen,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Type
|
||||
* @enum _Ecore_Con_Type
|
||||
* Types for an ecore_con client/server object. A correct way to set this type is
|
||||
* with an ECORE_CON_$TYPE, optionally OR'ed with an ECORE_CON_$USE if encryption is desired,
|
||||
* and LOAD_CERT if the previously loaded certificate should be used.
|
||||
* @code
|
||||
* ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT
|
||||
* @endcode
|
||||
*/
|
||||
typedef enum _Ecore_Con_Type
|
||||
{
|
||||
/** Socket in ~/.ecore */
|
||||
ECORE_CON_LOCAL_USER = 0,
|
||||
/** Socket in /tmp */
|
||||
ECORE_CON_LOCAL_SYSTEM = 1,
|
||||
/** Abstract socket */
|
||||
ECORE_CON_LOCAL_ABSTRACT = 2,
|
||||
/** Remote server using TCP */
|
||||
ECORE_CON_REMOTE_TCP = 3,
|
||||
/** Remote multicast server */
|
||||
ECORE_CON_REMOTE_MCAST = 4,
|
||||
/** Remote server using UDP */
|
||||
ECORE_CON_REMOTE_UDP = 5,
|
||||
/** Remote broadcast using UDP */
|
||||
ECORE_CON_REMOTE_BROADCAST = 6,
|
||||
ECORE_CON_REMOTE_NODELAY = 7,
|
||||
/** Use SSL2: UNSUPPORTED. **/
|
||||
ECORE_CON_USE_SSL2 = (1 << 4),
|
||||
/** Use SSL3 */
|
||||
ECORE_CON_USE_SSL3 = (1 << 5),
|
||||
/** Use TLS */
|
||||
ECORE_CON_USE_TLS = (1 << 6),
|
||||
/** Attempt to use the previously loaded certificate */
|
||||
ECORE_CON_LOAD_CERT = (1 << 7)
|
||||
} Ecore_Con_Type;
|
||||
#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2
|
||||
#define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Url_Time
|
||||
* @enum _Ecore_Con_Url_Time
|
||||
* The type of time in the object
|
||||
* @typedef Ecore_Con_Server
|
||||
* A connection handle to a server
|
||||
* @ingroup Ecore_Con_Server_Group
|
||||
*/
|
||||
typedef enum _Ecore_Con_Url_Time
|
||||
{
|
||||
ECORE_CON_URL_TIME_NONE = 0,
|
||||
ECORE_CON_URL_TIME_IFMODSINCE,
|
||||
ECORE_CON_URL_TIME_IFUNMODSINCE,
|
||||
ECORE_CON_URL_TIME_LASTMOD
|
||||
} Ecore_Con_Url_Time;
|
||||
typedef struct _Ecore_Con_Server Ecore_Con_Server;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Client
|
||||
* A connection handle to a client
|
||||
* @ingroup Ecore_Con_Client_Group
|
||||
*/
|
||||
typedef struct _Ecore_Con_Client Ecore_Con_Client;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Url
|
||||
* A handle to an http upload/download object
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
typedef struct _Ecore_Con_Url Ecore_Con_Url;
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Con_Events_Group Events
|
||||
|
@ -345,15 +294,82 @@ EAPI extern int ECORE_CON_EVENT_URL_DATA;
|
|||
EAPI extern int ECORE_CON_EVENT_URL_COMPLETE;
|
||||
/** A URL object has made progress in its transfer */
|
||||
EAPI extern int ECORE_CON_EVENT_URL_PROGRESS;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Con_Lib_Group Ecore Connection Library Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Dns_Cb
|
||||
* A callback type for use with @ref ecore_con_lookup.
|
||||
*/
|
||||
typedef void (*Ecore_Con_Dns_Cb)(const char *canonname,
|
||||
const char *ip,
|
||||
struct sockaddr *addr,
|
||||
int addrlen,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Type
|
||||
* @enum _Ecore_Con_Type
|
||||
* Types for an ecore_con client/server object. A correct way to set this type is
|
||||
* with an ECORE_CON_$TYPE, optionally OR'ed with an ECORE_CON_$USE if encryption is desired,
|
||||
* and LOAD_CERT if the previously loaded certificate should be used.
|
||||
* @code
|
||||
* ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT
|
||||
* @endcode
|
||||
*/
|
||||
typedef enum _Ecore_Con_Type
|
||||
{
|
||||
/** Socket in ~/.ecore */
|
||||
ECORE_CON_LOCAL_USER = 0,
|
||||
/** Socket in /tmp */
|
||||
ECORE_CON_LOCAL_SYSTEM = 1,
|
||||
/** Abstract socket */
|
||||
ECORE_CON_LOCAL_ABSTRACT = 2,
|
||||
/** Remote server using TCP */
|
||||
ECORE_CON_REMOTE_TCP = 3,
|
||||
/** Remote multicast server */
|
||||
ECORE_CON_REMOTE_MCAST = 4,
|
||||
/** Remote server using UDP */
|
||||
ECORE_CON_REMOTE_UDP = 5,
|
||||
/** Remote broadcast using UDP */
|
||||
ECORE_CON_REMOTE_BROADCAST = 6,
|
||||
ECORE_CON_REMOTE_NODELAY = 7,
|
||||
/** Use SSL2: UNSUPPORTED. **/
|
||||
ECORE_CON_USE_SSL2 = (1 << 4),
|
||||
/** Use SSL3 */
|
||||
ECORE_CON_USE_SSL3 = (1 << 5),
|
||||
/** Use TLS */
|
||||
ECORE_CON_USE_TLS = (1 << 6),
|
||||
/** Attempt to use the previously loaded certificate */
|
||||
ECORE_CON_LOAD_CERT = (1 << 7)
|
||||
} Ecore_Con_Type;
|
||||
|
||||
EAPI int ecore_con_init(void);
|
||||
EAPI int ecore_con_shutdown(void);
|
||||
EAPI Eina_Bool ecore_con_server_ssl_cert_add(const char *cert);
|
||||
EAPI Eina_Bool ecore_con_client_ssl_cert_add(const char *cert_file,
|
||||
const char *crl_file,
|
||||
const char *key_file);
|
||||
|
||||
EAPI int ecore_con_ssl_available_get(void);
|
||||
|
||||
EAPI Eina_Bool ecore_con_lookup(const char *name,
|
||||
Ecore_Con_Dns_Cb done_cb,
|
||||
const void *data);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type,
|
||||
const char *name, int port,
|
||||
|
@ -373,14 +389,24 @@ EAPI int ecore_con_server_port_get(Ecore_Con_Server *svr);
|
|||
EAPI int ecore_con_server_send(Ecore_Con_Server *svr,
|
||||
const void *data,
|
||||
int size);
|
||||
EAPI void ecore_con_server_client_limit_set(
|
||||
Ecore_Con_Server *svr,
|
||||
int client_limit,
|
||||
char
|
||||
reject_excess_clients);
|
||||
EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr,
|
||||
int client_limit,
|
||||
char reject_excess_clients);
|
||||
EAPI const char * ecore_con_server_ip_get(Ecore_Con_Server *svr);
|
||||
EAPI void ecore_con_server_flush(Ecore_Con_Server *svr);
|
||||
|
||||
EAPI Eina_Bool ecore_con_server_ssl_cert_add(const char *cert);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
EAPI int ecore_con_client_send(Ecore_Con_Client *cl,
|
||||
const void *data,
|
||||
int size);
|
||||
|
@ -391,15 +417,40 @@ EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl,
|
|||
EAPI void * ecore_con_client_data_get(Ecore_Con_Client *cl);
|
||||
EAPI const char * ecore_con_client_ip_get(Ecore_Con_Client *cl);
|
||||
EAPI void ecore_con_client_flush(Ecore_Con_Client *cl);
|
||||
EAPI Eina_Bool ecore_con_client_ssl_cert_add(const char *cert_file,
|
||||
const char *crl_file,
|
||||
const char *key_file);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
EAPI int ecore_con_ssl_available_get(void);
|
||||
/**
|
||||
* @defgroup Ecore_Con_Url_Group Ecore URL Connection Functions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Ecore_Con_Url_Time
|
||||
* @enum _Ecore_Con_Url_Time
|
||||
* The type of time in the object
|
||||
*/
|
||||
typedef enum _Ecore_Con_Url_Time
|
||||
{
|
||||
ECORE_CON_URL_TIME_NONE = 0,
|
||||
ECORE_CON_URL_TIME_IFMODSINCE,
|
||||
ECORE_CON_URL_TIME_IFUNMODSINCE,
|
||||
ECORE_CON_URL_TIME_LASTMOD
|
||||
} Ecore_Con_Url_Time;
|
||||
|
||||
EAPI int ecore_con_url_init(void);
|
||||
EAPI int ecore_con_url_shutdown(void);
|
||||
EAPI Ecore_Con_Url * ecore_con_url_new(const char *url);
|
||||
EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url,
|
||||
const char *custom_request);
|
||||
EAPI void ecore_con_url_destroy(Ecore_Con_Url *url_con);
|
||||
EAPI void ecore_con_url_free(Ecore_Con_Url *url_con);
|
||||
EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con,
|
||||
const char *url);
|
||||
EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con,
|
||||
void *data);
|
||||
EAPI void * ecore_con_url_data_get(Ecore_Con_Url *url_con);
|
||||
|
@ -408,8 +459,6 @@ EAPI void ecore_con_url_additional_header_add(Ecore_Con_Url *url_co
|
|||
const char *value);
|
||||
EAPI void ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con);
|
||||
EAPI const Eina_List * ecore_con_url_response_headers_get(Ecore_Con_Url *url_con);
|
||||
EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con,
|
||||
const char *url);
|
||||
EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd);
|
||||
EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con);
|
||||
EAPI Eina_Bool ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
|
||||
|
@ -423,10 +472,6 @@ EAPI void ecore_con_url_time(Ecore_Con_Url *url_con,
|
|||
Ecore_Con_Url_Time condition,
|
||||
time_t tm);
|
||||
|
||||
EAPI Eina_Bool ecore_con_lookup(const char *name,
|
||||
Ecore_Con_Dns_Cb done_cb,
|
||||
const void *data);
|
||||
|
||||
EAPI Eina_Bool ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
|
||||
const char *filename,
|
||||
const char *user,
|
||||
|
@ -439,6 +484,10 @@ EAPI void ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
|
|||
EAPI Eina_Bool ecore_con_url_http_post_send(Ecore_Con_Url *url_con,
|
||||
void *curl_httppost);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -158,16 +158,93 @@ ecore_con_shutdown(void)
|
|||
|
||||
return _ecore_con_init_count;
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Do an asynchronous DNS lookup.
|
||||
*
|
||||
* This function performs a DNS lookup on the hostname specified by @p name, then
|
||||
* calls @p done_cb with
|
||||
*
|
||||
* @param name IP address or server name to translate.
|
||||
* @param done_cb Callback to notify when done.
|
||||
* @param data User data to be given to done_cb.
|
||||
* @return EINA_TRUE if the request did not fail to be set up, EINA_FALSE if it failed.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_lookup(const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
|
||||
{
|
||||
Ecore_Con_Server *svr;
|
||||
Ecore_Con_Lookup *lk;
|
||||
struct addrinfo hints;
|
||||
|
||||
if (!name || !done_cb)
|
||||
return EINA_FALSE;
|
||||
|
||||
svr = calloc(1, sizeof(Ecore_Con_Server));
|
||||
if (!svr)
|
||||
return EINA_FALSE;
|
||||
|
||||
lk = malloc(sizeof (Ecore_Con_Lookup));
|
||||
if (!lk)
|
||||
{
|
||||
free(svr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
lk->done_cb = done_cb;
|
||||
lk->data = data;
|
||||
|
||||
svr->name = strdup(name);
|
||||
if (!svr->name)
|
||||
goto on_error;
|
||||
|
||||
svr->type = ECORE_CON_REMOTE_TCP;
|
||||
svr->port = 1025;
|
||||
svr->data = lk;
|
||||
svr->created = EINA_TRUE;
|
||||
svr->reject_excess_clients = EINA_FALSE;
|
||||
svr->client_limit = -1;
|
||||
svr->clients = NULL;
|
||||
svr->ppid = getpid();
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_canonname = NULL;
|
||||
hints.ai_next = NULL;
|
||||
hints.ai_addr = NULL;
|
||||
|
||||
if (ecore_con_info_get(svr, _ecore_con_lookup_done, svr,
|
||||
&hints))
|
||||
return EINA_TRUE;
|
||||
|
||||
free(svr->name);
|
||||
on_error:
|
||||
free(lk);
|
||||
free(svr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Con_Server_Group Ecore Connection Server Functions
|
||||
*
|
||||
* Functions that operate on Ecore server objects.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @example ecore_con_server_example.c
|
||||
* Shows how to write a simple server using the Ecore_Con library.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a server to listen for connections.
|
||||
*
|
||||
|
@ -193,7 +270,9 @@ ecore_con_shutdown(void)
|
|||
* @return A new Ecore_Con_Server.
|
||||
*/
|
||||
EAPI Ecore_Con_Server *
|
||||
ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port,
|
||||
ecore_con_server_add(Ecore_Con_Type compl_type,
|
||||
const char *name,
|
||||
int port,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Con_Server *svr;
|
||||
|
@ -304,7 +383,9 @@ error:
|
|||
* @return A new Ecore_Con_Server.
|
||||
*/
|
||||
EAPI Ecore_Con_Server *
|
||||
ecore_con_server_connect(Ecore_Con_Type compl_type, const char *name, int port,
|
||||
ecore_con_server_connect(Ecore_Con_Type compl_type,
|
||||
const char *name,
|
||||
int port,
|
||||
const void *data)
|
||||
{
|
||||
Ecore_Con_Server *svr;
|
||||
|
@ -552,7 +633,9 @@ ecore_con_server_port_get(Ecore_Con_Server *svr)
|
|||
* error.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
|
||||
ecore_con_server_send(Ecore_Con_Server *svr,
|
||||
const void *data,
|
||||
int size)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
|
||||
{
|
||||
|
@ -621,7 +704,8 @@ ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
|
|||
* lower).
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit,
|
||||
ecore_con_server_client_limit_set(Ecore_Con_Server *svr,
|
||||
int client_limit,
|
||||
char reject_excess_clients)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
|
||||
|
@ -696,6 +780,7 @@ ecore_con_server_ssl_cert_add(const char *cert)
|
|||
|
||||
return ecore_con_ssl_server_cert_add(cert);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -704,9 +789,15 @@ ecore_con_server_ssl_cert_add(const char *cert)
|
|||
* @addtogroup Ecore_Con_Client_Group Ecore Connection Client Functions
|
||||
*
|
||||
* Functions that operate on Ecore connection client objects.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @example ecore_con_client_example.c
|
||||
* Shows how to write a simple client that connects to the example server.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sends the given data to the given client.
|
||||
* @param cl The given client.
|
||||
|
@ -716,7 +807,9 @@ ecore_con_server_ssl_cert_add(const char *cert)
|
|||
* error.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_con_client_send(Ecore_Con_Client *cl, const void *data, int size)
|
||||
ecore_con_client_send(Ecore_Con_Client *cl,
|
||||
const void *data,
|
||||
int size)
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
|
||||
{
|
||||
|
@ -944,74 +1037,6 @@ ecore_con_client_ssl_cert_add(const char *cert_file,
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Do an asynchronous DNS lookup.
|
||||
*
|
||||
* This function performs a DNS lookup on the hostname specified by @p name, then
|
||||
* calls @p done_cb with
|
||||
*
|
||||
* @param name IP address or server name to translate.
|
||||
* @param done_cb Callback to notify when done.
|
||||
* @param data User data to be given to done_cb.
|
||||
* @return EINA_TRUE if the request did not fail to be set up, EINA_FALSE if it failed.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_lookup(const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
|
||||
{
|
||||
Ecore_Con_Server *svr;
|
||||
Ecore_Con_Lookup *lk;
|
||||
struct addrinfo hints;
|
||||
|
||||
if (!name || !done_cb)
|
||||
return EINA_FALSE;
|
||||
|
||||
svr = calloc(1, sizeof(Ecore_Con_Server));
|
||||
if (!svr)
|
||||
return EINA_FALSE;
|
||||
|
||||
lk = malloc(sizeof (Ecore_Con_Lookup));
|
||||
if (!lk)
|
||||
{
|
||||
free(svr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
lk->done_cb = done_cb;
|
||||
lk->data = data;
|
||||
|
||||
svr->name = strdup(name);
|
||||
if (!svr->name)
|
||||
goto on_error;
|
||||
|
||||
svr->type = ECORE_CON_REMOTE_TCP;
|
||||
svr->port = 1025;
|
||||
svr->data = lk;
|
||||
svr->created = EINA_TRUE;
|
||||
svr->reject_excess_clients = EINA_FALSE;
|
||||
svr->client_limit = -1;
|
||||
svr->clients = NULL;
|
||||
svr->ppid = getpid();
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_INET6;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_canonname = NULL;
|
||||
hints.ai_next = NULL;
|
||||
hints.ai_addr = NULL;
|
||||
|
||||
if (ecore_con_info_get(svr, _ecore_con_lookup_done, svr,
|
||||
&hints))
|
||||
return EINA_TRUE;
|
||||
|
||||
free(svr->name);
|
||||
on_error:
|
||||
free(lk);
|
||||
free(svr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_con_server_free(Ecore_Con_Server *svr)
|
||||
{
|
||||
|
|
|
@ -59,14 +59,6 @@
|
|||
#include "Ecore_Con.h"
|
||||
#include "ecore_con_private.h"
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Con_Url_Group Ecore URL Connection Functions
|
||||
*
|
||||
* Utility functions that set up, use and shut down the Ecore URL
|
||||
* Connection library.
|
||||
* FIXME: write detailed description
|
||||
*/
|
||||
|
||||
int ECORE_CON_EVENT_URL_DATA = 0;
|
||||
int ECORE_CON_EVENT_URL_COMPLETE = 0;
|
||||
int ECORE_CON_EVENT_URL_PROGRESS = 0;
|
||||
|
@ -131,11 +123,21 @@ _url_complete_push_event(int type, void *ev)
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_Con_Url_Group Ecore URL Connection Functions
|
||||
*
|
||||
* Utility functions that set up, use and shut down the Ecore URL
|
||||
* Connection library.
|
||||
*
|
||||
* @todo write detailed description of Ecore_Con_Url
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialises the Ecore_Con_Url library.
|
||||
* @return Number of times the library has been initialised without being
|
||||
* shut down.
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI int
|
||||
ecore_con_url_init(void)
|
||||
|
@ -161,7 +163,7 @@ ecore_con_url_init(void)
|
|||
if (curl_global_init(CURL_GLOBAL_NOTHING))
|
||||
{
|
||||
while (_url_con_list)
|
||||
ecore_con_url_destroy(eina_list_data_get(_url_con_list));
|
||||
ecore_con_url_free(eina_list_data_get(_url_con_list));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -169,7 +171,7 @@ ecore_con_url_init(void)
|
|||
if (!curlm)
|
||||
{
|
||||
while (_url_con_list)
|
||||
ecore_con_url_destroy(eina_list_data_get(_url_con_list));
|
||||
ecore_con_url_free(eina_list_data_get(_url_con_list));
|
||||
|
||||
init_count--;
|
||||
return 0;
|
||||
|
@ -194,7 +196,6 @@ ecore_con_url_init(void)
|
|||
/**
|
||||
* Shuts down the Ecore_Con_Url library.
|
||||
* @return Number of calls that still uses Ecore_Con_Url
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI int
|
||||
ecore_con_url_shutdown(void)
|
||||
|
@ -219,7 +220,7 @@ ecore_con_url_shutdown(void)
|
|||
_curl_timeout = NULL;
|
||||
|
||||
while (_url_con_list)
|
||||
ecore_con_url_destroy(eina_list_data_get(_url_con_list));
|
||||
ecore_con_url_free(eina_list_data_get(_url_con_list));
|
||||
|
||||
if (curlm)
|
||||
{
|
||||
|
@ -243,7 +244,6 @@ ecore_con_url_shutdown(void)
|
|||
*
|
||||
* @return NULL on error, a new Ecore_Con_Url on success.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_custom_new()
|
||||
* @see ecore_con_url_url_set()
|
||||
|
@ -319,7 +319,6 @@ ecore_con_url_new(const char *url)
|
|||
*
|
||||
* @return NULL on error, a new Ecore_Con_Url on success.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_new()
|
||||
* @see ecore_con_url_url_set()
|
||||
|
@ -354,12 +353,12 @@ ecore_con_url_custom_new(const char *url, const char *custom_request)
|
|||
/**
|
||||
* Destroys a Ecore_Con_Url connection object.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
* @param url_con Connection object to free.
|
||||
*
|
||||
* @see ecore_con_url_new()
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
||||
ecore_con_url_free(Ecore_Con_Url *url_con)
|
||||
{
|
||||
#ifdef HAVE_CURL
|
||||
char *s;
|
||||
|
@ -369,7 +368,7 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_destroy");
|
||||
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_free");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -427,7 +426,6 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
|||
*
|
||||
* @return EINA_TRUE on success, EINA_FALSE on error.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
|
||||
|
@ -472,7 +470,6 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
|
|||
* @param url_con Connection object to associate data.
|
||||
* @param data Data to be set.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_data_get()
|
||||
*/
|
||||
|
@ -504,7 +501,6 @@ ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
|
|||
* @param key Header key
|
||||
* @param value Header value
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_send()
|
||||
* @see ecore_con_url_additional_headers_clear()
|
||||
|
@ -546,7 +542,6 @@ ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key,
|
|||
*
|
||||
* @param url_con Connection object to clean additional headers.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_additional_header_add()
|
||||
* @see ecore_con_url_send()
|
||||
|
@ -578,11 +573,10 @@ ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con)
|
|||
* Retrieves data associated with a Ecore_Con_Url connection object (previously
|
||||
* set with ecore_con_url_data_set()).
|
||||
*
|
||||
* @param Connection object to retrieve data from.
|
||||
* @param url_con Connection object to retrieve data from.
|
||||
*
|
||||
* @return Data associated with the given object.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_data_set()
|
||||
*/
|
||||
|
@ -606,7 +600,6 @@ ecore_con_url_data_get(Ecore_Con_Url *url_con)
|
|||
/**
|
||||
* FIXME
|
||||
* Sets the @ref Ecore_Con_Url object's condition/time members.
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition,
|
||||
|
@ -639,7 +632,6 @@ ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition,
|
|||
* @param url_con Connection object to set file
|
||||
* @param fd File descriptor associated with the file
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd)
|
||||
|
@ -665,7 +657,6 @@ ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd)
|
|||
*
|
||||
* @return Number of bytes received on request.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_send()
|
||||
*/
|
||||
|
@ -697,7 +688,6 @@ ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con)
|
|||
*
|
||||
* @return List of response headers. This list must not be modified by the user.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI const Eina_List *
|
||||
ecore_con_url_response_headers_get(Ecore_Con_Url *url_con)
|
||||
|
@ -720,7 +710,6 @@ ecore_con_url_response_headers_get(Ecore_Con_Url *url_con)
|
|||
*
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE on error.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username,
|
||||
|
@ -765,7 +754,6 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username,
|
|||
*
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE on error.
|
||||
*
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*
|
||||
* @see ecore_con_url_custom_new()
|
||||
* @see ecore_con_url_additional_headers_clear()
|
||||
|
@ -870,8 +858,7 @@ ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length,
|
|||
* @param upload_dir The directory to which the file should be uploaded
|
||||
* @return #EINA_TRUE on success, else #EINA_FALSE.
|
||||
* Upload @p filename to an ftp server set in @p url_con using @p user
|
||||
* and @p pass to directory @upload_dir
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
* and @p pass to directory @p upload_dir
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename,
|
||||
|
@ -943,7 +930,6 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename,
|
|||
/**
|
||||
* Send a Curl httppost
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE on error.
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost)
|
||||
|
@ -981,7 +967,6 @@ ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost)
|
|||
/**
|
||||
* Enable or disable libcurl verbose output, useful for debug
|
||||
* @return FIXME: To be more documented.
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_url_verbose_set(Ecore_Con_Url *url_con, int verbose)
|
||||
|
@ -1013,7 +998,6 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con, int verbose)
|
|||
/**
|
||||
* Enable or disable EPSV extension
|
||||
* @return FIXME: To be more documented.
|
||||
* @ingroup Ecore_Con_Url_Group
|
||||
*/
|
||||
EAPI void
|
||||
ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, int use_epsv)
|
||||
|
@ -1042,6 +1026,10 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, int use_epsv)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
static int
|
||||
_ecore_con_url_suspend_fd_handler(void)
|
||||
|
|
|
@ -303,7 +303,7 @@ ecore_file_download_abort(Ecore_File_Download_Job *job)
|
|||
if (job->completion_cb)
|
||||
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, 1);
|
||||
# ifdef HAVE_CURL
|
||||
ecore_con_url_destroy(job->url_con);
|
||||
ecore_con_url_free(job->url_con);
|
||||
# endif
|
||||
_job_list = eina_list_remove(_job_list, job);
|
||||
fclose(job->file);
|
||||
|
|
Loading…
Reference in New Issue