## LmProxy LmProxy — API for the proxy support in Loudmouth |

## Synopsis

                        LmProxy;
    enum                LmProxyType;
    LmProxy *           lm_proxy_new                        (LmProxyType type);
    LmProxy *           lm_proxy_new_with_server            (LmProxyType type,
                                                             const gchar *server,
                                                             guint port);
    LmProxyType         lm_proxy_get_type                   (LmProxy *proxy);
    void                lm_proxy_set_type                   (LmProxy *proxy,
                                                             LmProxyType type);
    const gchar *       lm_proxy_get_server                 (LmProxy *proxy);
    void                lm_proxy_set_server                 (LmProxy *proxy,
                                                             const gchar *server);
    guint               lm_proxy_get_port                   (LmProxy *proxy);
    void                lm_proxy_set_port                   (LmProxy *proxy,
                                                             guint port);
    const gchar *       lm_proxy_get_username               (LmProxy *proxy);
    void                lm_proxy_set_username               (LmProxy *proxy,
                                                             const gchar *username);
    const gchar *       lm_proxy_get_password               (LmProxy *proxy);
    void                lm_proxy_set_password               (LmProxy *proxy,
                                                             const gchar *password);
    LmProxy *           lm_proxy_ref                        (LmProxy *proxy);
    void                lm_proxy_unref                      (LmProxy *proxy);

## Description

Use this together with an LmConnection to get the connection to use connect through a proxy. Example of how to use the LmProxy API.

    LmConnection *connection;
    LmProxy      *proxy;
    connection = lm_connection_new ("myserver");
    proxy = lm_proxy_new_with_server (LM_PROXY_TYPE_HTTP,
    				  "myproxyserver",
    				  8080);
    lm_connection_set_proxy (connection, proxy);
    ...

## Details

### LmProxy

    typedef struct _LmProxy LmProxy;

This should not be accessed directly. Use the accessor functions as described below.

### enum LmProxyType

    typedef enum {
    	LM_PROXY_TYPE_NONE = 0,
    	LM_PROXY_TYPE_HTTP
    } LmProxyType;

The type of the proxy.

`LM_PROXY_TYPE_NONE` | Unused
`LM_PROXY_TYPE_HTTP` | An HTTP proxy.

### lm_proxy_new ()

    LmProxy *           lm_proxy_new                        (LmProxyType type);

Creates a new Proxy. Used lm_connection_set_proxy to make a connection user this proxy.

`type` : | the type of the new proxy
Returns : | a newly create proxy

### lm_proxy_new_with_server ()

    LmProxy *           lm_proxy_new_with_server            (LmProxyType type,
                                                             const gchar *server,
                                                             guint port);

Creates a new Proxy. Use lm_connection_set_proxy to make a connection user this proxy.

`type` : | the type of the new proxy
`server` : | the proxy server
`port` : | the proxy server port
Returns : | a newly create proxy

### lm_proxy_get_type ()

    LmProxyType         lm_proxy_get_type                   (LmProxy *proxy);

Fetches the proxy type

`proxy` : | an LmProxy
Returns : | the type

### lm_proxy_set_type ()

    void                lm_proxy_set_type                   (LmProxy *proxy,
                                                             LmProxyType type);

Sets the proxy type for `proxy` to `type`.

`proxy` : | an LmProxy
`type` : | an LmProxyType

### lm_proxy_get_server ()

    const gchar *       lm_proxy_get_server                 (LmProxy *proxy);

Fetches the server address that `proxy` is using.

`proxy` : | an LmProxy
Returns : | the proxy server address

### lm_proxy_set_server ()

    void                lm_proxy_set_server                 (LmProxy *proxy,
                                                             const gchar *server);

Sets the server address for `proxy` to `server`.

`proxy` : | an LmProxy
`server` : | Address of the proxy server

### lm_proxy_get_port ()

    guint               lm_proxy_get_port                   (LmProxy *proxy);

Fetches the port that `proxy` is using.

`proxy` : | an LmProxy
Returns : | The port

### lm_proxy_set_port ()

    void                lm_proxy_set_port                   (LmProxy *proxy,
                                                             guint port);

Sets the server port that `proxy` will be using.

`proxy` : | an LmProxy
`port` : | proxy server port

### lm_proxy_get_username ()

    const gchar *       lm_proxy_get_username               (LmProxy *proxy);

Fetches the username that `proxy` is using.

`proxy` : | an LmProxy
Returns : | the username

### lm_proxy_set_username ()

    void                lm_proxy_set_username               (LmProxy *proxy,
                                                             const gchar *username);

Sets the username for `proxy` to `username` or `NULL` to unset.

`proxy` : | an LmProxy
`username` : | Username

### lm_proxy_get_password ()

    const gchar *       lm_proxy_get_password               (LmProxy *proxy);

Fetches the password that `proxy` is using.

`proxy` : | an LmProxy
Returns : | the proxy password

### lm_proxy_set_password ()

    void                lm_proxy_set_password               (LmProxy *proxy,
                                                             const gchar *password);

Sets the password for `proxy` to `password` or `NULL` to unset.

`proxy` : | an LmProxy
`password` : | Password

### lm_proxy_ref ()

    LmProxy *           lm_proxy_ref                        (LmProxy *proxy);

Adds a reference to `proxy`.

`proxy` : | an LmProxy
Returns : | the proxy

### lm_proxy_unref ()

    void                lm_proxy_unref                      (LmProxy *proxy);

Removes a reference from `proxy`. When no more references are present `proxy` is freed.

`proxy` : | an LmProxy