Sockets functions. More...
Typedefs | |
typedef struct _Ecore_Con_Server | Ecore_Con_Server |
A connection handle. | |
typedef struct _Ecore_Con_Client | Ecore_Con_Client |
A connection handle. | |
Functions | |
EAPI int | ecore_con_init (void) |
Initialises the Ecore_Con library. | |
EAPI int | ecore_con_shutdown (void) |
Shuts down the Ecore_Con library. | |
EAPI Ecore_Con_Server * | ecore_con_server_add (Ecore_Con_Type type, const char *name, int port, const void *data) |
Creates a server to listen for connections. | |
EAPI Ecore_Con_Server * | ecore_con_server_connect (Ecore_Con_Type type, const char *name, int port, const void *data) |
Creates a server object to represent the server listening at the given port. | |
EAPI void * | ecore_con_server_del (Ecore_Con_Server *svr) |
Closes the connection and frees the given server. | |
EAPI void * | ecore_con_server_data_get (Ecore_Con_Server *svr) |
Retrieves the data associated with the given server. | |
EAPI int | ecore_con_server_connected_get (Ecore_Con_Server *svr) |
Retrieves whether the given server is currently connected. | |
EAPI Eina_List * | ecore_con_server_clients_get (Ecore_Con_Server *svr) |
Retrieves the current list of clients. | |
EAPI int | ecore_con_server_send (Ecore_Con_Server *svr, const void *data, int size) |
Sends the given data to the given server. | |
EAPI void | ecore_con_server_client_limit_set (Ecore_Con_Server *svr, int client_limit, char reject_excess_clients) |
Sets a limit on the number of clients that can be handled concurrently by the given server, and a policy on what to do if excess clients try to connect. | |
EAPI char * | ecore_con_server_ip_get (Ecore_Con_Server *svr) |
Gets the IP address of a server that has been connected to. | |
EAPI void | ecore_con_server_flush (Ecore_Con_Server *svr) |
Flushes all pending data to the given server. | |
EAPI int | ecore_con_client_send (Ecore_Con_Client *cl, const void *data, int size) |
Sends the given data to the given client. | |
EAPI Ecore_Con_Server * | ecore_con_client_server_get (Ecore_Con_Client *cl) |
Retrieves the server representing the socket the client has connected to. | |
EAPI void * | ecore_con_client_del (Ecore_Con_Client *cl) |
Closes the connection and frees memory allocated to the given client. | |
EAPI void | ecore_con_client_data_set (Ecore_Con_Client *cl, const void *data) |
Sets the data associated with the given client to data . | |
EAPI void * | ecore_con_client_data_get (Ecore_Con_Client *cl) |
Retrieves the data associated with the given client. | |
EAPI char * | ecore_con_client_ip_get (Ecore_Con_Client *cl) |
Gets the IP address of a cleint that has connected. | |
EAPI void | ecore_con_client_flush (Ecore_Con_Client *cl) |
Flushes all pending data to the given client. | |
EAPI int | ecore_con_ssl_available_get (void) |
Returns if SSL support is available. | |
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 void | ecore_con_url_data_set (Ecore_Con_Url *url_con, void *data) |
Associates data with a 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_additional_header_add (Ecore_Con_Url *url_con, const char *key, const char *value) |
Adds an additional header to the request connection object. | |
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_url_set (Ecore_Con_Url *url_con, const char *url) |
Sets the URL to send the request to. | |
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 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 void | ecore_con_url_time (Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t tm) |
FIXME: To be documented. | |
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 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. | |
EAPI int | ecore_con_url_http_post_send (Ecore_Con_Url *url_con, void *curl_httppost) |
Send a Curl httppost. |
Detailed Description
Sockets functions.
The Ecore Connection Library ( Ecore_Con
) provides simple mechanisms for communications between programs using reliable sockets. It saves the programmer from having to worry about file descripters and waiting for incoming connections.
There are two main objects in the Ecore_Con
library: the Ecore_Con_Server
and the Ecore_Con_Client
.
The Ecore_Con_Server
represents a server that can be connected to. It is used regardless of whether the program is acting as a server or client itself.
To create a listening server, call ecore_con_server_add()
.
To connect to a server, call ecore_con_server_connect()
. Data can then be sent to the server using the ecore_con_server_send()
.
Whenever a client connection is made to an Ecore_Con_Server
, a ECORE_CON_CLIENT_ADD
event is emitted. Any event callbacks that are called receive a Ecore_Con_Client
object, which represents a connection that that particular client.
Functions are described in the following groupings: