Ecore Connection Server Functions
Ecore » Ecore_Con - Connection functions

This group of functions is applied to an Ecore_Con_Server object. More...

## Typedefs

typedef struct _Ecore_Con_Server | Ecore_Con_Server
| Used to provide legacy API/ABI compatibility with non-Eo applications.

## Functions

ECORE_CON_API char * | ecore_con_local_path_new (Eina_Bool is_system, const char *name, int port)
| Creates a local path to connect the socket.
ECORE_CON_API 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.
ECORE_CON_API Ecore_Con_Server * | ecore_con_server_connect (Ecore_Con_Type type, const char *name, int port, const void *data)
| Creates a connection to the specified server and return an associated object.
ECORE_CON_API void * | ecore_con_server_del (Ecore_Con_Server *svr)
| Closes the connection and free the given server.
ECORE_CON_API const char * | ecore_con_server_name_get (const Ecore_Con_Server *svr)
| Retrieves the name of server.
ECORE_CON_API void * | ecore_con_server_data_get (Ecore_Con_Server *svr)
| Retrieves the data associated with the given server.
ECORE_CON_API void * | ecore_con_server_data_set (Ecore_Con_Server *svr, void *data)
| Sets the data associated with the given server.
ECORE_CON_API Eina_Bool | ecore_con_server_connected_get (const Ecore_Con_Server *svr)
| Retrieves whether the given server is currently connected.
ECORE_CON_API int | ecore_con_server_port_get (const Ecore_Con_Server *svr)
| Retrieves the server port in use.
ECORE_CON_API double | ecore_con_server_uptime_get (const Ecore_Con_Server *svr)
| Checks how long a server has been connected.
ECORE_CON_API int | ecore_con_server_send (Ecore_Con_Server *svr, const void *data, int size)
| Sends the given data to the given server.
ECORE_CON_API 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.
ECORE_CON_API const Eina_List * | ecore_con_server_clients_get (const Ecore_Con_Server *svr)
| Retrieves the current list of clients.
ECORE_CON_API const char * | ecore_con_server_ip_get (const Ecore_Con_Server *svr)
| Gets the IP address of a server that has been connected to.
ECORE_CON_API void | ecore_con_server_flush (Ecore_Con_Server *svr)
| Flushes all pending data to the given server.
ECORE_CON_API void | ecore_con_server_timeout_set (Ecore_Con_Server *svr, double timeout)
| Sets the default time after which an inactive client will be disconnected.
ECORE_CON_API double | ecore_con_server_timeout_get (const Ecore_Con_Server *svr)
| Gets the default time after which an inactive client will be disconnected.
ECORE_CON_API int | ecore_con_server_fd_get (const Ecore_Con_Server *svr)
| Gets the fd that the server is connected to.
ECORE_CON_API int | ecore_con_client_fd_get (const Ecore_Con_Client *cl)
| Gets the fd that the client is connected to.
static Eina_Bool | _ecore_con_server_server_set (Ecore_Con_Server *svr, Eo *server)
static Eina_Value | _ecore_con_server_server_ssl_job (void *data, const Eina_Value v, const Eina_Future *dead)
static void | _ecore_con_server_proxy_apply (Ecore_Con_Server *svr, const Ecore_Con_Socks *socks)
| convert socks to proxy URL string and apply using efl_net_dialer_proxy_set().
static Eina_Bool | _ecore_con_server_dialer_set (Ecore_Con_Server *svr, Eo *dialer)
static Eina_Value | _ecore_con_server_dialer_ssl_job (void *data, const Eina_Value v, const Eina_Future *dead)
static Eina_Value | _ecore_con_server_dialer_ssl_upgrade_job (void *data, const Eina_Value v, const Eina_Future *dead)
ECORE_CON_API Eina_Bool | ecore_con_ssl_server_cert_add (Ecore_Con_Server *svr, const char *cert)
| Adds an SSL certificate for use in ecore_con functions.
ECORE_CON_API Eina_Bool | ecore_con_ssl_server_privkey_add (Ecore_Con_Server *svr, const char *privkey)
| Adds an SSL private key for use in ecore_con functions.
ECORE_CON_API Eina_Bool | ecore_con_ssl_server_crl_add (Ecore_Con_Server *svr, const char *crl)
| Adds an SSL CRL for use in ecore_con functions.
ECORE_CON_API Eina_Bool | ecore_con_ssl_server_cafile_add (Ecore_Con_Server *svr, const char *cafile)
| Adds an SSL CA file for use in ecore_con functions.
ECORE_CON_API void | ecore_con_ssl_server_verify (Ecore_Con_Server *svr)
| Enables certificate verification on a server object.
ECORE_CON_API void | ecore_con_ssl_server_verify_basic (Ecore_Con_Server *svr)
| Enables hostname-based certificate verification on a server object.
ECORE_CON_API void | ecore_con_ssl_server_verify_name_set (Ecore_Con_Server *svr, const char *name)
| Sets the hostname to verify against in certificate verification.
ECORE_CON_API const char * | ecore_con_ssl_server_verify_name_get (Ecore_Con_Server *svr)
| Gets the hostname to verify against in certificate verification.
ECORE_CON_API Eina_Bool | ecore_con_ssl_server_upgrade (Ecore_Con_Server *svr, Ecore_Con_Type compl_type)
| Upgrades a connection to a specified level of encryption.

## Detailed Description

This group of functions is applied to an Ecore_Con_Server object.

Functions that operate on Ecore server objects.

It doesn't mean that they should be used in the server application, but on the server object. In fact, most of them should be used in the client application, when retrieving information or sending data.

Setting up a server is very simple: you just need to start it with ecore_con_server_add() and setup some callbacks to the events ECORE_CON_EVENT_CLIENT_ADD, ECORE_CON_EVENT_CLIENT_DEL and ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is communicating with the server:

if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL)))
exit(1);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, _add_cb, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, _del_cb, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, _data_cb, NULL);
ecore_main_loop_begin();
ECORE_CON_EVENT_CLIENT_ADD
ECORE_CON_API int ECORE_CON_EVENT_CLIENT_ADD
A client has connected to the server.
Definition ecore_con_legacy.c:157
ECORE_CON_EVENT_CLIENT_DEL
ECORE_CON_API int ECORE_CON_EVENT_CLIENT_DEL
A client has disconnected from the server.
Definition ecore_con_legacy.c:158
ECORE_CON_EVENT_CLIENT_DATA
ECORE_CON_API int ECORE_CON_EVENT_CLIENT_DATA
A client connected to the server has sent data.
Definition ecore_con_legacy.c:166
ecore_con_server_add
ECORE_CON_API 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.
Definition ecore_con_legacy.c:1696
ecore_event_handler_add
Ecore_Event_Handler * ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
Adds an event handler.
Definition ecore_events.c:13
ecore_main_loop_begin
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition ecore_main.c:1311

The function ecore_con_server_connect() can be used to write a client that connects to a server. The resulting code will be very similar to the server code:

if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL)))
exit(1);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _add_cb, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _del_cb, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _data_cb, NULL);
ecore_main_loop_begin();
ECORE_CON_EVENT_SERVER_ADD
ECORE_CON_API int ECORE_CON_EVENT_SERVER_ADD
A server was created.
Definition ecore_con_legacy.c:160
ECORE_CON_EVENT_SERVER_DEL
ECORE_CON_API int ECORE_CON_EVENT_SERVER_DEL
A server connection was lost.
Definition ecore_con_legacy.c:154
ECORE_CON_EVENT_SERVER_DATA
ECORE_CON_API int ECORE_CON_EVENT_SERVER_DATA
A server connection object has data.
Definition ecore_con_legacy.c:161
ecore_con_server_connect
ECORE_CON_API Ecore_Con_Server * ecore_con_server_connect(Ecore_Con_Type type, const char *name, int port, const void *data)
Creates a connection to the specified server and return an associated object.
Definition ecore_con_legacy.c:2165

After these two pieces of code are executed, respectively, in the server and client code, the server will be up and running and the client will try to connect to it. The connection, with its subsequent messages being sent from server to client and client to server, can be represented in the following sequence diagram:

Please notice the important difference between these two codes: the first is used for writing a server, while the second should be used for writing a client.

A reference for the `client` functions can be found at Ecore Connection Client Functions.

Examples of usage for this API can be found here:

- Ecore_Con - Creating a server
- Ecore_Con - Creating a client

## Function Documentation

## ecore_con_local_path_new()

ECORE_CON_API char * ecore_con_local_path_new | ( | Eina_Bool | is_system,
|  | const char * | name,
|  | int | port )

Creates a local path to connect the socket.

In the old API, ecore_con_server_add() and ecore_con_server_connect() calculated a local path for connections using `ECORE_CON_LOCAL_USER` and `ECORE_CON_LOCAL_SYSTEM`, this function returns that path allocated so it can be used in applications that want to connect to that path without replicating its logic.

- If type is `ECORE_CON_LOCAL_USER`, the server will connect to the Unix socket. The path to the socket is taken from XDG_RUNTIME_DIR, if that is not set, then from HOME, even if this is not set, then from TMPDIR. If none is set, then path would be /tmp. From this path the function would connect to socket at "[path]/.ecore/[name]/[port]". If port is negative, then to socket at "[path]/.ecore/[name]".
- If type is `ECORE_CON_LOCAL_SYSTEM`, the server will connect to Unix socket at "/tmp/.ecore_service|[name]|[port]". If port is negative, then to Unix socket at "/tmp/.ecore_service|[name]".

Parameters

  is_system | If EINA_TRUE, will be a system wide socket similar to `ECORE_CON_LOCAL_SYSTEM`. If EINA_FALSE, then it's similar to `ECORE_CON_LOCAL_USER`.
  name | Name to associate with the socket. It is used when generating the socket name of a Unix socket, `NULL` will not be accepted.
  port | Number to identify socket. When a Unix socket is used, it becomes part of the socket name.

Returns
  NULL on failure or newly allocated path string on success, remember to free() it after usage.

Since
  1.19

References eina_environment_tmp_get(), EINA_SAFETY_ON_NULL_RETURN_VAL, and ERR.

Referenced by ecore_ipc_server_add(), and ecore_ipc_server_connect().

## ecore_con_server_add()

ECORE_CON_API 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.

Parameters

  type | The connection type.
  name | Name to associate with the socket. It is used when generating the socket name of a Unix socket, or for determining what host to listen on for TCP sockets. `NULL` will not be accepted.
  port | Number to identify socket. When a Unix socket is used, it becomes part of the socket name. When a TCP socket is used, it is used as the TCP port.
  data | Data to associate with the created Ecore_Con_Server object.

Returns
  A new Ecore_Con_Server.

The socket on which the server listens depends on the connection type:

- If type is `ECORE_CON_LOCAL_USER`, the server will listen on the Unix socket. The path to the socket is taken from XDG_RUNTIME_DIR, if that is not set, then from HOME, even if this is not set, then from TMPDIR. If none is set, then path would be /tmp. From this path socket would be created as "[path]/.ecore/[name]/[port]". If port is negative, then "[path]/.ecore/[name]".
- If type is `ECORE_CON_LOCAL_SYSTEM`, the server will listen on Unix socket "/tmp/.ecore_service|[name]|[port]". If port is negative, then "/tmp/.ecore_service|[name]".
- If type is `ECORE_CON_LOCAL_ABSTRACT`, then port number is not considered while creating the socket.
- If type is `ECORE_CON_REMOTE_TCP`, the server will listen on TCP port `port`.

More information about the `type` can be found at _Ecore_Con_Type.

The `data` parameter can be fetched later using ecore_con_server_data_get() or changed with ecore_con_server_data_set().

See also
  ecore_con_local_path_new()

Note
  This API is deprecated and new code should use #EFL_NET_SERVER_SIMPLE_CLASS. See
  - efl_net_server_simple_example.c

Examples
  ecore_con_server_example.c, and ecore_con_server_simple_example.c.

References EINA_FALSE, EINA_SAFETY_ON_NULL_GOTO, EINA_SAFETY_ON_NULL_RETURN_VAL, and ERR.

## ecore_con_server_connect()

ECORE_CON_API Ecore_Con_Server * ecore_con_server_connect | ( | Ecore_Con_Type | type,
|  | const char * | name,
|  | int | port,
|  | const void * | data )

Creates a connection to the specified server and return an associated object.

Parameters

  type | The connection type.
  name | Name used when determining what socket to connect to. It is used to generate the socket name when the socket is a Unix socket. It is used as the hostname when connecting with a TCP socket.
  port | Number to identify the socket to connect to. Used when generating the socket name for a Unix socket, or as the TCP port when connecting to a TCP socket.
  data | Data to associate with the created Ecore_Con_Server object.

Returns
  A new Ecore_Con_Server.

The socket to which the connection is made depends on the connection type:

- If type is `ECORE_CON_LOCAL_USER`, the server will connect to the Unix socket. The path to the socket is taken from XDG_RUNTIME_DIR, if that is not set, then from HOME, even if this is not set, then from TMPDIR. If none is set, then path would be /tmp. From this path the function would connect to socket at "[path]/.ecore/[name]/[port]". If port is negative, then to socket at "[path]/.ecore/[name]".
- If type is `ECORE_CON_LOCAL_SYSTEM`, the server will connect to Unix socket at "/tmp/.ecore_service|[name]|[port]". If port is negative, then to Unix socket at "/tmp/.ecore_service|[name]".
- If type is `ECORE_CON_LOCAL_ABSTRACT`, then port number is not considered while connecting to socket.
- If type is `ECORE_CON_REMOTE_TCP`, the server will listen on TCP port `port`.

More information about the `type` can be found at _Ecore_Con_Type.

This function won't block. It will either succeed, or fail due to invalid parameters, failed memory allocation, etc., returning `NULL` on that case.

However, even if this call returns a valid Ecore_Con_Server, the connection will only be successfully completed if an event of type ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an ECORE_CON_EVENT_SERVER_DEL will be received.

The created object gets deleted automatically if the connection to the server is lost.

The `data` parameter can be fetched later using ecore_con_server_data_get() or changed with ecore_con_server_data_set().

See also
  ecore_con_local_path_new()

Note
  This API is deprecated and new code should use #EFL_NET_DIALER_SIMPLE_CLASS. See
  - efl_net_dialer_simple_example.c

Examples
  ecore_con_client_example.c, and ecore_con_client_simple_example.c.

References EINA_SAFETY_ON_NULL_GOTO, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_TRUE, and ERR.

## ecore_con_server_del()

ECORE_CON_API void * ecore_con_server_del | ( | Ecore_Con_Server * | svr | ) |

Closes the connection and free the given server.

Parameters

  svr | The given server.

Returns
  Data associated with the server when it was created.

All the clients connected to this server will be disconnected.

See also
  ecore_con_server_add, ecore_con_server_connect

Examples
  ecore_con_client_example.c, ecore_con_client_simple_example.c, and ecore_con_server_example.c.

## ecore_con_server_name_get()

ECORE_CON_API const char * ecore_con_server_name_get | ( | const Ecore_Con_Server * | svr | ) |

Retrieves the name of server.

The name returned is the name used to connect on this server.

Parameters

  svr | The given server.

Returns
  The name of the server.

Examples
  ecore_con_client_simple_example.c.

## ecore_con_server_data_get()

ECORE_CON_API void * ecore_con_server_data_get | ( | Ecore_Con_Server * | svr | ) |

Retrieves the data associated with the given server.

Parameters

  svr | The given server.

Returns
  The associated data.

See also
  ecore_con_server_data_set()

Examples
  ecore_con_client_simple_example.c.

## ecore_con_server_data_set()

ECORE_CON_API void * ecore_con_server_data_set | ( | Ecore_Con_Server * | svr,
|  | void * | data )

Sets the data associated with the given server.

Parameters

  svr | The given server.
  data | The data to associate with `svr`.

Returns
  The previously associated data, if any.

See also
  ecore_con_server_data_get()

Examples
  ecore_con_client_simple_example.c.

## ecore_con_server_connected_get()

ECORE_CON_API Eina_Bool ecore_con_server_connected_get | ( | const Ecore_Con_Server * | svr | ) |

Retrieves whether the given server is currently connected.

Parameters

  svr | The given server.

Returns
  `EINA_TRUE` if the server is connected, `EINA_FALSE` otherwise.

Examples
  ecore_con_client_simple_example.c.

References EINA_FALSE, and EINA_TRUE.

## ecore_con_server_port_get()

ECORE_CON_API int ecore_con_server_port_get | ( | const Ecore_Con_Server * | svr | ) |

Retrieves the server port in use.

Parameters

  svr | The given server.

Returns
  The server port in use.

The port where the server is listening for connections.

Examples
  ecore_con_client_simple_example.c.

## ecore_con_server_uptime_get()

ECORE_CON_API double ecore_con_server_uptime_get | ( | const Ecore_Con_Server * | svr | ) |

Checks how long a server has been connected.

Parameters

  svr | The server to check

Returns
  The total time, in seconds, that the server has been connected/running.

This function is used to find out the time that has been elapsed since ecore_con_server_add() succeeded.

Examples
  ecore_con_server_simple_example.c.

References ecore_time_get().

## ecore_con_server_send()

ECORE_CON_API int ecore_con_server_send | ( | Ecore_Con_Server * | svr,
|  | const void * | data,
|  | int | size )

Sends the given data to the given server.

Parameters

  svr | The given server.
  data | The given data.
  size | Length of the data, in bytes, to send.

Returns
  The number of bytes sent. `0` will be returned if there is an error.

This function will send the given data to the server as soon as the program is back to the main loop. Thus, this function returns immediately (non-blocking). If the data needs to be sent now, call ecore_con_server_flush() after this one.

See also
  ecore_con_client_send()
  ecore_con_server_flush()

Examples
  ecore_con_client_example.c, and ecore_con_client_simple_example.c.

References eina_binbuf_append_length(), eina_binbuf_new(), eina_error_msg_get(), EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, ERR, and _Eina_Slice::len.

## ecore_con_server_client_limit_set()

ECORE_CON_API 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.

Parameters

  svr | The given server.
  client_limit | The maximum number of clients to handle concurrently. -1 means unlimited (default). 0 effectively disables the server.
  reject_excess_clients | Set to 1 to automatically disconnect excess clients as soon as they connect if you are already handling client_limit clients. Set to 0 (default) to just hold off on the "accept()" system call until the number of active clients drops. This causes the kernel to queue up to 4096 connections (or your kernel's limit, whichever is lower).

Beware that if you set this once ecore is already running, you may already have pending CLIENT_ADD events in your event queue. Those clients have already connected and will not be affected by this call. Only clients subsequently trying to connect will be affected.

Examples
  ecore_con_server_simple_example.c.

## ecore_con_server_clients_get()

ECORE_CON_API const Eina_List * ecore_con_server_clients_get | ( | const Ecore_Con_Server * | svr | ) |

Retrieves the current list of clients.

Each node in the returned list points to an Efl_Network_Client. This list cannot be modified or freed. It can also change if new clients are connected or disconnected, and will become invalid when the server is deleted/freed.

Parameters

  svr | The given server.

Returns
  The list of clients on this server.

Examples
  ecore_con_server_simple_example.c.

## ecore_con_server_ip_get()

ECORE_CON_API const char * ecore_con_server_ip_get | ( | const Ecore_Con_Server * | svr | ) |

Gets the IP address of a server that has been connected to.

Parameters

  svr | The given server.

Returns
  A pointer to an internal string that contains the IP address of the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation. This string should not be modified or trusted to stay valid after deletion for the `svr` object. If no IP is known `NULL` is returned.

Examples
  ecore_con_client_example.c, and ecore_con_client_simple_example.c.

## ecore_con_server_flush()

ECORE_CON_API void ecore_con_server_flush | ( | Ecore_Con_Server * | svr | ) |

Flushes all pending data to the given server.

Parameters

  svr | The given server.

This function will block until all data is sent to the server.

See also
  ecore_con_server_send()
  ecore_con_client_flush()

Examples
  ecore_con_client_example.c, and ecore_con_client_simple_example.c.

References ecore_main_loop_iterate(), EINA_FALSE, and EINA_TRUE.

Referenced by ecore_con_ssl_server_upgrade().

## ecore_con_server_timeout_set()

ECORE_CON_API void ecore_con_server_timeout_set | ( | Ecore_Con_Server * | svr,
|  | double | timeout )

Sets the default time after which an inactive client will be disconnected.

Parameters

  svr | The server object.
  timeout | The timeout, in seconds, to disconnect after.

This function is used by the server to set the default idle timeout on clients. If the any of the clients becomes idle for a time higher than this value, it will be disconnected. A value of < 1 disables the idle timeout.

This timeout is not affected by the one set by ecore_con_client_timeout_set(). A client will be disconnected whenever the client or the server timeout is reached. That means, the lower timeout value will be used for that client if ecore_con_client_timeout_set() is used on it.

See also
  ecore_con_server_timeout_get()
  ecore_con_client_timeout_set()

Examples
  ecore_con_server_simple_example.c.

## ecore_con_server_timeout_get()

ECORE_CON_API double ecore_con_server_timeout_get | ( | const Ecore_Con_Server * | svr | ) |

Gets the default time after which an inactive client will be disconnected.

Parameters

  svr | The server object.

Returns
  The timeout, in seconds, to disconnect after.

This function is used to get the idle timeout for clients. A value of < 1 means the idle timeout is disabled.

See also
  ecore_con_server_timeout_set()
  ecore_con_client_timeout_get()

## ecore_con_server_fd_get()

ECORE_CON_API int ecore_con_server_fd_get | ( | const Ecore_Con_Server * | svr | ) |

Gets the fd that the server is connected to.

Parameters

  svr | The server object

Returns
  The fd, or `-1` on failure

This function returns the fd which is used by the underlying server connection. It should not be tampered with unless you REALLY know what you are doing.

Note
  This function is only valid for servers created with ecore_con_server_connect().

Warning
  Seriously. Don't use this unless you know what you are doing.

Since
  1.1

## ecore_con_client_fd_get()

ECORE_CON_API int ecore_con_client_fd_get | ( | const Ecore_Con_Client * | cl | ) |

Gets the fd that the client is connected to.

Parameters

  cl | The client object

Returns
  The fd, or `-1` on failure

This function returns the fd which is used by the underlying client connection. It should not be tampered with unless you REALLY know what you are doing.

Since
  1.1

## _ecore_con_server_proxy_apply()

void _ecore_con_server_proxy_apply | ( | Ecore_Con_Server * | svr,
|  | const Ecore_Con_Socks * | socks )

static

convert socks to proxy URL string and apply using efl_net_dialer_proxy_set().

Parameters

  svr | the server created by ecore_con_server_connect().
  socks | the socks handle created by ecore_con_socks4_remote_add() or ecore_con_socks5_remote_add().

References DBG, and ERR.

## ecore_con_ssl_server_cert_add()

ECORE_CON_API Eina_Bool ecore_con_ssl_server_cert_add | ( | Ecore_Con_Server * | svr,
|  | const char * | cert )

Adds an SSL certificate for use in ecore_con functions.

Use this function to add a SSL PEM certificate. Simply specify the cert here to use it in the server object for connecting or listening. If there is an error loading the certificate, an error will automatically be logged.

Parameters

  svr | The server object
  cert | The path to the certificate.

Returns
  `EINA_FALSE` if the file cannot be loaded, otherwise `EINA_TRUE`.

References EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, eina_stringshare_add(), and EINA_TRUE.

## ecore_con_ssl_server_privkey_add()

ECORE_CON_API Eina_Bool ecore_con_ssl_server_privkey_add | ( | Ecore_Con_Server * | svr,
|  | const char * | key_file )

Adds an SSL private key for use in ecore_con functions.

Use this function to add a SSL PEM private key. Simply specify the key file here to use it in the server object for connecting or listening. If there is an error loading the key, an error will automatically be logged.

Parameters

  svr | The server object.
  key_file | The path to the key file.

Returns
  `EINA_FALSE` if the file cannot be loaded, otherwise `EINA_TRUE`.

References EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, eina_stringshare_add(), and EINA_TRUE.

## ecore_con_ssl_server_crl_add()

ECORE_CON_API Eina_Bool ecore_con_ssl_server_crl_add | ( | Ecore_Con_Server * | svr,
|  | const char * | crl_file )

Adds an SSL CRL for use in ecore_con functions.

Use this function to add a SSL PEM CRL file. Simply specify the CRL file here to use it in the server object for connecting or listening. If there is an error loading the CRL, an error will automatically be logged.

Parameters

  svr | The server object.
  crl_file | The path to the CRL file.

Returns
  `EINA_FALSE` if the file cannot be loaded, otherwise `EINA_TRUE`.

References EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, eina_stringshare_add(), and EINA_TRUE.

## ecore_con_ssl_server_cafile_add()

ECORE_CON_API Eina_Bool ecore_con_ssl_server_cafile_add | ( | Ecore_Con_Server * | svr,
|  | const char * | ca_file )

Adds an SSL CA file for use in ecore_con functions.

Use this function to add a SSL PEM CA file. Simply specify the file here to use it in the server object for connecting or listening. If there is an error loading the CAs, an error will automatically be logged.

Parameters

  svr | The server object.
  ca_file | The path to the CA file.

Returns
  `EINA_FALSE` if the file cannot be loaded, otherwise `EINA_TRUE`.

Note
  since 1.2, this function can load directories.

References EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, eina_stringshare_add(), and EINA_TRUE.

## ecore_con_ssl_server_verify()

ECORE_CON_API void ecore_con_ssl_server_verify | ( | Ecore_Con_Server * | svr | ) |

Enables certificate verification on a server object.

Call this function on a server object before main loop has started to enable verification of certificates against loaded certificates.

Parameters

  svr | The server object

References EINA_SAFETY_ON_NULL_RETURN, EINA_SAFETY_ON_TRUE_RETURN, EINA_TRUE, and WRN.

## ecore_con_ssl_server_verify_basic()

ECORE_CON_API void ecore_con_ssl_server_verify_basic | ( | Ecore_Con_Server * | svr | ) |

Enables hostname-based certificate verification on a server object.

Call this function on a server object before main loop has started to enable verification of certificates using ONLY their hostnames.

Parameters

  svr | The server object.

Note
  This function has no effect when used on a listening server created by ecore_con_server_add.

Since
  1.1

References EINA_SAFETY_ON_NULL_RETURN, EINA_SAFETY_ON_TRUE_RETURN, EINA_TRUE, and WRN.

## ecore_con_ssl_server_verify_name_set()

ECORE_CON_API void ecore_con_ssl_server_verify_name_set | ( | Ecore_Con_Server * | svr,
|  | const char * | name )

Sets the hostname to verify against in certificate verification.

Sometimes the certificate hostname will not match the hostname that you are connecting to, and will instead match a different name. An example of this is that if you connect to talk.google.com to use Google Talk, you receive Google's certificate for gmail.com. This certificate should be trusted, and so you must call this function with "gmail.com" as `name`. See RFC2818 for more details.

Parameters

  svr | The server object.
  name | The hostname to verify against

Since
  1.2

References EINA_SAFETY_ON_NULL_RETURN, EINA_SAFETY_ON_TRUE_RETURN, and eina_stringshare_replace().

## ecore_con_ssl_server_verify_name_get()

ECORE_CON_API const char * ecore_con_ssl_server_verify_name_get | ( | Ecore_Con_Server * | svr | ) |

Gets the hostname to verify against in certificate verification.

This function returns the name which will be used to validate the SSL certificate common name (CN) or alt name (subjectAltName). It will default to the `name` param in ecore_con_server_connect(), but can be changed with ecore_con_ssl_server_verify_name_set().

Parameters

  svr | The server object.

Returns
  The hostname which will be used

Since
  1.2

## ecore_con_ssl_server_upgrade()

ECORE_CON_API Eina_Bool ecore_con_ssl_server_upgrade | ( | Ecore_Con_Server * | svr,
|  | Ecore_Con_Type | ssl_type )

Upgrades a connection to a specified level of encryption.

Use this function to begin an SSL handshake on a connection (STARTTLS or similar). Once the upgrade has been completed, an ECORE_CON_EVENT_SERVER_UPGRADE event will be emitted. The connection should be treated as disconnected until the next event.

Parameters

  svr | The server object.
  ssl_type | The SSL connection type (ONLY).

Returns
  `EINA_FALSE` if the connection cannot be upgraded, otherwise `EINA_TRUE`.

Note
  This function is NEVER to be used on a server object created with ecore_con_server_add.

Warning
  Setting a wrong value for `ssl_type` WILL mess up your program.

Since
  1.1

References DBG, ecore_animator_frametime_get(), ecore_con_server_flush(), ecore_time_get(), EINA_FALSE, EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, EINA_TRUE, and ERR.