Ecore Connection SOCKS functions

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Functions
Ecore Connection SOCKS functions
Ecore » Ecore_Con - Connection functions

## Data Structures
struct | _Ecore_Con_Event_Proxy_Bind
| Used as the `data` param for the ECORE_CON_EVENT_PROXY_BIND event. More...

## Typedefs
typedef struct Ecore_Con_Socks | Ecore_Con_Socks
| An object representing a SOCKS proxy.

## Functions
ECORE_CON_API Ecore_Con_Socks * | ecore_con_socks4_remote_add (const char *ip, int port, const char *username)
| Adds a SOCKS v4 proxy to the proxy list.
ECORE_CON_API Eina_Bool | ecore_con_socks4_remote_exists (const char *ip, int port, const char *username)
| Finds a SOCKS v4 proxy in the proxy list.
ECORE_CON_API void | ecore_con_socks4_remote_del (const char *ip, int port, const char *username)
| Removes a SOCKS v4 proxy from the proxy list and delete it.
ECORE_CON_API Ecore_Con_Socks * | ecore_con_socks5_remote_add (const char *ip, int port, const char *username, const char *password)
| Adds a SOCKS v5 proxy to the proxy list.
ECORE_CON_API Eina_Bool | ecore_con_socks5_remote_exists (const char *ip, int port, const char *username, const char *password)
| Finds a SOCKS v5 proxy in the proxy list.
ECORE_CON_API void | ecore_con_socks5_remote_del (const char *ip, int port, const char *username, const char *password)
| Removes a SOCKS v5 proxy from the proxy list and delete it.
ECORE_CON_API void | ecore_con_socks_lookup_set (Ecore_Con_Socks *ecs, Eina_Bool enable)
| Sets DNS lookup mode on an existing SOCKS proxy.
ECORE_CON_API Eina_Bool | ecore_con_socks_lookup_get (Ecore_Con_Socks *ecs)
| Gets DNS lookup mode on an existing SOCKS proxy.
ECORE_CON_API void | ecore_con_socks_bind_set (Ecore_Con_Socks *ecs, Eina_Bool is_bind)
| Enables bind mode on a SOCKS proxy.
ECORE_CON_API Eina_Bool | ecore_con_socks_bind_get (Ecore_Con_Socks *ecs)
| Returns bind mode of a SOCKS proxy.
ECORE_CON_API unsigned int | ecore_con_socks_version_get (Ecore_Con_Socks *ecs)
| Returns SOCKS version of a SOCKS proxy.
ECORE_CON_API void | ecore_con_socks_remote_del (Ecore_Con_Socks *ecs)
| Removes a SOCKS v4 proxy from the proxy list and delete it.
ECORE_CON_API void | ecore_con_socks_apply_once (Ecore_Con_Socks *ecs)
| Sets a proxy object to be used with the next server created with ecore_con_server_connect().
ECORE_CON_API void | ecore_con_socks_apply_always (Ecore_Con_Socks *ecs)
| Sets a proxy object to be used with all servers created with ecore_con_server_connect().

## Detailed Description

## Typedef Documentation

## ◆ Ecore_Con_Socks

Ecore_Con_Socks

An object representing a SOCKS proxy.

Since
  1.2

## Function Documentation

## ◆ ecore_con_socks4_remote_add()

ECORE_CON_API Ecore_Con_Socks * ecore_con_socks4_remote_add | ( | const char * | ip,
|  | int | port,
|  | const char * | username
| ) |  |

Adds a SOCKS v4 proxy to the proxy list.

Use this to create (or return, if previously added) a SOCKS proxy object which can be used by any ecore_con servers.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy.
  username | The username to use for the proxy. (OPTIONAL)

Returns
  An allocated proxy object, or `NULL` on failure.

Note
  This object NEVER needs to be explicitly freed.

Since
  1.2

References eina_list_append(), and eina_stringshare_add().

## ◆ ecore_con_socks4_remote_exists()

ECORE_CON_API Eina_Bool ecore_con_socks4_remote_exists | ( | const char * | ip,
|  | int | port,
|  | const char * | username
| ) |  |

Finds a SOCKS v4 proxy in the proxy list.

Use this to determine if a SOCKS proxy was previously added by checking the proxy list against the parameters given.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy, or -1 to match the first proxy with `ip`
  username | The username used for the proxy. (OPTIONAL)

Returns
  True only if a proxy exists matching the given params.

Note
  This function matches slightly more loosely than ecore_con_socks4_remote_add(), and ecore_con_socks4_remote_add() should be used to return the actual object.

Since
  1.2

References EINA_FALSE.

## ◆ ecore_con_socks4_remote_del()

ECORE_CON_API void ecore_con_socks4_remote_del | ( | const char * | ip,
|  | int | port,
|  | const char * | username
| ) |  |

Removes a SOCKS v4 proxy from the proxy list and delete it.

Use this to remove a SOCKS proxy from the proxy list by checking the list against the parameters given. The proxy will then be deleted.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy, or -1 to match the first proxy with `ip`
  username | The username used for the proxy. (OPTIONAL)

Note
  This function matches in the same way as ecore_con_socks4_remote_exists().

Warning
  Be aware that deleting a proxy which is being used WILL ruin your life.

Since
  1.2

References eina_list_remove().

## ◆ ecore_con_socks5_remote_add()

ECORE_CON_API Ecore_Con_Socks * ecore_con_socks5_remote_add | ( | const char * | ip,
|  | int | port,
|  | const char * | username,
|  | const char * | password
| ) |  |

Adds a SOCKS v5 proxy to the proxy list.

Use this to create (or return, if previously added) a SOCKS proxy object which can be used by any ecore_con servers.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy.
  username | The username to use for the proxy. (OPTIONAL)
  password | The password to use for the proxy. (OPTIONAL)

Returns
  An allocated proxy object, or `NULL` on failure.

Note
  This object NEVER needs to be explicitly freed.

Since
  1.2

References eina_list_append(), and eina_stringshare_add().

## ◆ ecore_con_socks5_remote_exists()

ECORE_CON_API Eina_Bool ecore_con_socks5_remote_exists | ( | const char * | ip,
|  | int | port,
|  | const char * | username,
|  | const char * | password
| ) |  |

Finds a SOCKS v5 proxy in the proxy list.

Use this to determine if a SOCKS proxy was previously added by checking the proxy list against the parameters given.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy, or -1 to match the first proxy with `ip`
  username | The username used for the proxy. (OPTIONAL)
  password | The password used for the proxy. (OPTIONAL)

Returns
  True only if a proxy exists matching the given params.

Note
  This function matches slightly more loosely than ecore_con_socks5_remote_add(), and ecore_con_socks5_remote_add() should be used to return the actual object.

Since
  1.2

References EINA_FALSE.

## ◆ ecore_con_socks5_remote_del()

ECORE_CON_API void ecore_con_socks5_remote_del | ( | const char * | ip,
|  | int | port,
|  | const char * | username,
|  | const char * | password
| ) |  |

Removes a SOCKS v5 proxy from the proxy list and delete it.

Use this to remove a SOCKS proxy from the proxy list by checking the list against the parameters given. The proxy will then be deleted.

Parameters

  ip | The ip address of the proxy. (NOT DOMAIN NAME. IP ADDRESS.)
  port | The port to connect to on the proxy, or -1 to match the first proxy with `ip`
  username | The username used for the proxy. (OPTIONAL)
  password | The password used for the proxy. (OPTIONAL)

Note
  This function matches in the same way as ecore_con_socks4_remote_exists().

Warning
  Be aware that deleting a proxy which is being used WILL ruin your life.

Since
  1.2

References eina_list_remove().

## ◆ ecore_con_socks_lookup_set()

ECORE_CON_API void ecore_con_socks_lookup_set | ( | Ecore_Con_Socks * | ecs,
|  | Eina_Bool | enable
| ) |  |

Sets DNS lookup mode on an existing SOCKS proxy.

According to RFC, SOCKS v4 does not require that a proxy perform its own DNS lookups for addresses. SOCKS v4a specifies the protocol for this. SOCKS v5 allows DNS lookups. If you want to enable remote DNS lookup and are sure that your proxy supports it, use this function.

Parameters

  ecs | The proxy object.
  enable | If true, the proxy will perform the dns lookup.

Note
  By default, this setting is DISABLED.

Since
  1.2

## ◆ ecore_con_socks_lookup_get()

ECORE_CON_API Eina_Bool ecore_con_socks_lookup_get | ( | Ecore_Con_Socks * | ecs | ) |

Gets DNS lookup mode on an existing SOCKS proxy.

According to RFC, SOCKS v4 does not require that a proxy perform its own DNS lookups for addresses. SOCKS v4a specifies the protocol for this. SOCKS v5 allows DNS lookups. This function returns whether lookups are enabled on a proxy object.

Parameters

  ecs | The proxy object.

Returns
  If true, the proxy will perform the dns lookup.

Note
  By default, this setting is DISABLED.

Since
  1.2

References EINA_FALSE.

## ◆ ecore_con_socks_bind_set()

ECORE_CON_API void ecore_con_socks_bind_set | ( | Ecore_Con_Socks * | ecs,
|  | Eina_Bool | is_bind
| ) |  |

Enables bind mode on a SOCKS proxy.

Use this function to enable binding a remote port for use with a remote server. For more information, see http://ufasoft.com/doc/socks4_protocol.htm

Parameters

  ecs | The proxy object.
  is_bind | If true, the connection established will be a port binding.

Warning
  Be aware that changing the operation mode of an active proxy may result in undefined behavior

Since
  1.2

References EINA_SAFETY_ON_NULL_RETURN.

## ◆ ecore_con_socks_bind_get()

ECORE_CON_API Eina_Bool ecore_con_socks_bind_get | ( | Ecore_Con_Socks * | ecs | ) |

Returns bind mode of a SOCKS proxy.

Use this function to return bind mode of a proxy (binding a remote port for use with a remote server). For more information, see http://ufasoft.com/doc/socks4_protocol.htm

Parameters

  ecs | The proxy object.

Returns
  If true, the connection established will be a port binding.

Since
  1.2

References EINA_FALSE, and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ ecore_con_socks_version_get()

ECORE_CON_API unsigned int ecore_con_socks_version_get | ( | Ecore_Con_Socks * | ecs | ) |

Returns SOCKS version of a SOCKS proxy.

Use this function to return the SOCKS protocol version of a proxy.

Parameters

  ecs | The proxy object.

Returns
  `0` on error, else `4/5`

Since
  1.2

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ ecore_con_socks_remote_del()

ECORE_CON_API void ecore_con_socks_remote_del | ( | Ecore_Con_Socks * | ecs | ) |

Removes a SOCKS v4 proxy from the proxy list and delete it.

Use this to remove a SOCKS proxy from the proxy list by directly deleting the object given.

Parameters

  ecs | The proxy object to delete

Warning
  Be aware that deleting a proxy which is being used WILL ruin your life.

Since
  1.2

References eina_list_remove(), and EINA_SAFETY_ON_NULL_RETURN.

## ◆ ecore_con_socks_apply_once()

ECORE_CON_API void ecore_con_socks_apply_once | ( | Ecore_Con_Socks * | ecs | ) |

Sets a proxy object to be used with the next server created with ecore_con_server_connect().

This function sets a proxy for the next ecore_con connection. After the next server is created, the proxy will NEVER be applied again unless explicitly enabled.

Parameters

  ecs | The proxy object

See also
  ecore_con_socks_apply_always()

Since
  1.2

## ◆ ecore_con_socks_apply_always()

ECORE_CON_API void ecore_con_socks_apply_always | ( | Ecore_Con_Socks * | ecs | ) |

Sets a proxy object to be used with all servers created with ecore_con_server_connect().

This function sets a proxy for all ecore_con connections. It will always be used.

Parameters

  ecs | The proxy object.

See also
  ecore_con_socks_apply_once().

Since
  1.2

Note
  ecore-con supports setting this through environment variables like so: ECORE_CON_SOCKS_V4=[user@]server-port:lookup ECORE_CON_SOCKS_V5=[user@]server-port:lookup user is the OPTIONAL string that would be passed to the proxy as the username. server is the IP_ADDRESS of the proxy server. port is the port to connect to on the proxy server. lookup is 1 if the proxy should perform all DNS lookups, otherwise 0 or omitted.