lightmelody

changeset 706:01620bdc3d7b objectify

Rewrote Lm.Proxy
author Arc Riley <arcriley@gmail.com>
date Wed, 02 Jan 2013 00:59:34 -0500
parents 1ecb42cf6a09
children 0300a149f777
files include/loudmouth/lm-proxy.h include/loudmouth/loudmouth.h src/Proxy.gs src/lm-old-socket.c src/lm-proxy.c vapi/loudmouth.vapi
diffstat 6 files changed, 65 insertions(+), 598 deletions(-) [+]
line diff
     1.1 --- a/include/loudmouth/lm-proxy.h	Wed Jan 02 06:48:34 2013 +0530
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,78 +0,0 @@
     1.4 -/*
     1.5 - *  Copyright (C) 2012,2013 Copyleft Games Group
     1.6 - *  Copyright (C) 2004 Imendio AB
     1.7 - *
     1.8 - *  This program is free software; you can redistribute it and/or modify
     1.9 - *  it under the terms of the GNU Affero General Public License as published
    1.10 - *  by the Free Software Foundation, either version 3 of the License, or
    1.11 - *  (at your option) any later version.
    1.12 - *
    1.13 - *  This program is distributed in the hope that it will be useful,
    1.14 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 - *  GNU Affero General Public License for more details.
    1.17 - *
    1.18 - *  You should have received a copy of the GNU Affero General Public License
    1.19 - *  along with this program; if not, see http://www.gnu.org/licenses
    1.20 - *
    1.21 - */
    1.22 -
    1.23 -#ifndef __LM_PROXY_H__
    1.24 -#define __LM_PROXY_H__
    1.25 -
    1.26 -#if !defined (LM_INSIDE_LIGHTMELODY_H) && !defined (LM_COMPILATION)
    1.27 -#error "Only <lightmelody/lightmelody.h> can be included directly, this file may disappear or change contents."
    1.28 -#endif
    1.29 -
    1.30 -G_BEGIN_DECLS
    1.31 -
    1.32 -/**
    1.33 - * LmProxy:
    1.34 - *
    1.35 - * This should not be accessed directly. Use the accessor functions as described below.
    1.36 - */
    1.37 -typedef struct _LmProxy LmProxy;
    1.38 -
    1.39 -/**
    1.40 - * LmProxyType:
    1.41 - * @LM_PROXY_TYPE_NONE: Unused
    1.42 - * @LM_PROXY_TYPE_HTTP: An HTTP proxy.
    1.43 - *
    1.44 - * The type of the proxy.
    1.45 - */
    1.46 -typedef enum {
    1.47 -    LM_PROXY_TYPE_NONE = 0,
    1.48 -    LM_PROXY_TYPE_HTTP
    1.49 -} LmProxyType;
    1.50 -
    1.51 -LmProxy *     lm_proxy_new              (LmProxyType         type);
    1.52 -LmProxy *     lm_proxy_new_with_server  (LmProxyType         type,
    1.53 -                                         const gchar        *server,
    1.54 -                                         guint               port);
    1.55 -
    1.56 -LmProxyType   lm_proxy_get_type         (LmProxy            *proxy);
    1.57 -void          lm_proxy_set_type         (LmProxy            *proxy,
    1.58 -                                         LmProxyType         type);
    1.59 -
    1.60 -const gchar * lm_proxy_get_server       (LmProxy            *proxy);
    1.61 -void          lm_proxy_set_server       (LmProxy            *proxy,
    1.62 -                                         const gchar        *server);
    1.63 -
    1.64 -guint         lm_proxy_get_port         (LmProxy            *proxy);
    1.65 -void          lm_proxy_set_port         (LmProxy            *proxy,
    1.66 -                                         guint               port);
    1.67 -
    1.68 -const gchar * lm_proxy_get_username     (LmProxy            *proxy);
    1.69 -void          lm_proxy_set_username     (LmProxy            *proxy,
    1.70 -                                         const gchar        *username);
    1.71 -
    1.72 -const gchar * lm_proxy_get_password     (LmProxy            *proxy);
    1.73 -void          lm_proxy_set_password     (LmProxy            *proxy,
    1.74 -                                         const gchar        *password);
    1.75 -
    1.76 -LmProxy *     lm_proxy_ref              (LmProxy            *proxy);
    1.77 -void          lm_proxy_unref            (LmProxy            *proxy);
    1.78 -
    1.79 -G_END_DECLS
    1.80 -#endif /* __LM_PROXY_H__ */
    1.81 -
     2.1 --- a/include/loudmouth/loudmouth.h	Wed Jan 02 06:48:34 2013 +0530
     2.2 +++ b/include/loudmouth/loudmouth.h	Wed Jan 02 00:59:34 2013 -0500
     2.3 @@ -24,7 +24,6 @@
     2.4  
     2.5  #include <loudmouth/lm-message.h>
     2.6  #include <loudmouth/lm-message-node.h>
     2.7 -#include <loudmouth/lm-proxy.h>
     2.8  #include <loudmouth/lm-utils.h>
     2.9  #include <loudmouth/lm-ssl.h>
    2.10  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/Proxy.gs	Wed Jan 02 00:59:34 2013 -0500
     3.3 @@ -0,0 +1,61 @@
     3.4 +/*
     3.5 + *  LightMelody - Lightweight XMPP/Jingle Client Library
     3.6 + *  Copyright (C) 2012,2013 Copyleft Games Group
     3.7 + *
     3.8 + *  This program is free software; you can redistribute it and/or modify
     3.9 + *  it under the terms of the GNU Affero General Public License as published
    3.10 + *  by the Free Software Foundation, either version 3 of the License, or
    3.11 + *  (at your option) any later version.
    3.12 + *
    3.13 + *  This program is distributed in the hope that it will be useful,
    3.14 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.16 + *  GNU Affero General Public License for more details.
    3.17 + *
    3.18 + *  You should have received a copy of the GNU Affero General Public License
    3.19 + *  along with this program; if not, see http://www.gnu.org/licenses
    3.20 + *
    3.21 + */
    3.22 +
    3.23 +[indent=4]
    3.24 +
    3.25 +class Lm.Proxy
    3.26 +    enum Type
    3.27 +        NONE = 0
    3.28 +        HTTP
    3.29 +
    3.30 +
    3.31 +    construct (type : Type)
    3.32 +        self.set_type(type)
    3.33 +
    3.34 +
    3.35 +    construct with_server (type : Type, server : string, port : uint)
    3.36 +        self.set_type(type)
    3.37 +        self.server = server
    3.38 +        self.port = port
    3.39 +
    3.40 +
    3.41 +    def set_type (type : Type)
    3.42 +        case type
    3.43 +            when Type.HTTP
    3.44 +                self.protocol = "http"
    3.45 +                self.port = 8080
    3.46 +            default
    3.47 +                self.protocol = null
    3.48 +                self.port = 0
    3.49 +
    3.50 +
    3.51 +    prop password : unowned string
    3.52 +
    3.53 +
    3.54 +    prop protocol : unowned string?
    3.55 +
    3.56 +
    3.57 +    prop port : uint
    3.58 +
    3.59 +
    3.60 +    prop server : unowned string
    3.61 +
    3.62 +
    3.63 +    prop username : unowned string
    3.64 +
     4.1 --- a/src/lm-old-socket.c	Wed Jan 02 06:48:34 2013 +0530
     4.2 +++ b/src/lm-old-socket.c	Wed Jan 02 00:59:34 2013 -0500
     4.3 @@ -41,7 +41,7 @@
     4.4  #include "lm-debug.h"
     4.5  #include "lm-internals.h"
     4.6  #include "lm-misc.h"
     4.7 -#include <loudmouth/lm-proxy.h>
     4.8 +#include <lightmelody.h>
     4.9  #include "lm-resolver.h"
    4.10  #include <loudmouth/lm-ssl.h>
    4.11  #include "lm-ssl-internals.h"
    4.12 @@ -667,12 +667,15 @@
    4.13      _lm_sock_set_blocking (connect_data->fd, FALSE);
    4.14  
    4.15      if (socket->proxy) {
    4.16 +    /*
    4.17 +
    4.18          socket->watch_connect =
    4.19              lm_misc_add_io_watch (socket->context,
    4.20                                    connect_data->io_channel,
    4.21                                    G_IO_OUT|G_IO_ERR,
    4.22                                    (GIOFunc) _lm_proxy_connect_cb,
    4.23                                    connect_data);
    4.24 +    */
    4.25      } else {
    4.26          socket->watch_connect =
    4.27              lm_misc_add_io_watch (socket->context,
     5.1 --- a/src/lm-proxy.c	Wed Jan 02 06:48:34 2013 +0530
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,501 +0,0 @@
     5.4 -/*
     5.5 - *  Copyright (C) 2012,2013 Copyleft Games Group
     5.6 - *  Copyright (C) 2004 Imendio AB
     5.7 - *  Copyright (C) 2004 Josh Beam <josh@3ddrome.com>
     5.8 - *
     5.9 - *  This program is free software; you can redistribute it and/or modify
    5.10 - *  it under the terms of the GNU Affero General Public License as published
    5.11 - *  by the Free Software Foundation, either version 3 of the License, or
    5.12 - *  (at your option) any later version.
    5.13 - *
    5.14 - *  This program is distributed in the hope that it will be useful,
    5.15 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.16 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.17 - *  GNU Affero General Public License for more details.
    5.18 - *
    5.19 - *  You should have received a copy of the GNU Affero General Public License
    5.20 - *  along with this program; if not, see http://www.gnu.org/licenses
    5.21 - *
    5.22 - */
    5.23 -
    5.24 -/**
    5.25 - * SECTION:lm-proxy
    5.26 - * @Title: LmProxy
    5.27 - * @Short_description: API for the proxy support in LightMelody
    5.28 - *
    5.29 - * Use this together with an #LmConnection to get the connection to use connect through a proxy. Example of how to use the #LmProxy API.
    5.30 - * <informalexample><programlisting><![CDATA[
    5.31 - * LmConnection *connection;
    5.32 - * LmProxy      *proxy;
    5.33 - *
    5.34 - * connection = lm_connection_new ("myserver");
    5.35 - * proxy = lm_proxy_new_with_server (LM_PROXY_TYPE_HTTP,
    5.36 - *                "myproxyserver",
    5.37 - *                8080);
    5.38 - * lm_connection_set_proxy (connection, proxy);
    5.39 - * ...]]></programlisting></informalexample>
    5.40 - */
    5.41 -
    5.42 -#include <config.h>
    5.43 -
    5.44 -#include <glib.h>
    5.45 -#include <string.h>
    5.46 -
    5.47 -#ifndef G_OS_WIN32
    5.48 -
    5.49 -#include <unistd.h>
    5.50 -#include <sys/socket.h>
    5.51 -
    5.52 -#else  /* G_OS_WIN32 */
    5.53 -
    5.54 -#include <winsock2.h>
    5.55 -
    5.56 -#endif /* G_OS_WIN32 */
    5.57 -
    5.58 -#include "lm-internals.h"
    5.59 -#include <loudmouth/lm-proxy.h>
    5.60 -#include <loudmouth/lm-utils.h>
    5.61 -
    5.62 -struct _LmProxy {
    5.63 -    LmProxyType  type;
    5.64 -    gchar       *server;
    5.65 -    guint        port;
    5.66 -    gchar       *username;
    5.67 -    gchar       *password;
    5.68 -    guint        io_watch;
    5.69 -
    5.70 -    gint         ref_count;
    5.71 -};
    5.72 -
    5.73 -static void          proxy_free              (LmProxy       *proxy);
    5.74 -static gboolean      proxy_http_negotiate    (LmProxy       *proxy,
    5.75 -                                              gint           fd,
    5.76 -                                              const gchar   *server,
    5.77 -                                              guint          port);
    5.78 -static gboolean      proxy_negotiate         (LmProxy       *proxy,
    5.79 -                                              gint           fd,
    5.80 -                                              const gchar   *server,
    5.81 -                                              guint          port);
    5.82 -static gboolean      proxy_http_read_cb      (GIOChannel    *source,
    5.83 -                                              GIOCondition   condition,
    5.84 -                                              gpointer       data);
    5.85 -static gboolean      proxy_read_cb           (GIOChannel    *source,
    5.86 -                                              GIOCondition   condition,
    5.87 -                                              gpointer       data);
    5.88 -
    5.89 -static void
    5.90 -proxy_free (LmProxy *proxy)
    5.91 -{
    5.92 -    g_free (proxy->server);
    5.93 -    g_free (proxy->username);
    5.94 -    g_free (proxy->password);
    5.95 -
    5.96 -    g_free (proxy);
    5.97 -}
    5.98 -
    5.99 -static gboolean
   5.100 -proxy_http_negotiate (LmProxy *proxy, gint fd, const gchar *server, guint port)
   5.101 -{
   5.102 -    gchar *str;
   5.103 -
   5.104 -    if (proxy->username && proxy->password) {
   5.105 -        gchar *tmp1;
   5.106 -        gchar *tmp2;
   5.107 -
   5.108 -        tmp1 = g_strdup_printf ("%s:%s",
   5.109 -                                proxy->username,
   5.110 -                                proxy->password);
   5.111 -        tmp2 = g_base64_encode ((const guchar *) tmp1,
   5.112 -                                (gsize) strlen (tmp1));
   5.113 -        g_free (tmp1);
   5.114 -
   5.115 -        str = g_strdup_printf ("CONNECT %s:%u HTTP/1.1\r\nHost: %s:%u\r\nProxy-Authorization: Basic %s\r\n\r\n",
   5.116 -                               server, port,
   5.117 -                               server, port,
   5.118 -                               tmp2);
   5.119 -        g_free (tmp2);
   5.120 -    } else {
   5.121 -        str = g_strdup_printf ("CONNECT %s:%u HTTP/1.1\r\nHost: %s:%u\r\n\r\n",
   5.122 -                               server, port,
   5.123 -                               server, port);
   5.124 -    }
   5.125 -
   5.126 -    send (fd, str, strlen (str), 0);
   5.127 -    g_free (str);
   5.128 -    return TRUE;
   5.129 -}
   5.130 -
   5.131 -/* returns TRUE when connected through proxy */
   5.132 -static gboolean
   5.133 -proxy_http_read_cb (GIOChannel *source, GIOCondition condition, gpointer data)
   5.134 -{
   5.135 -    gchar          buf[512];
   5.136 -    gsize          bytes_read;
   5.137 -    GError        *error = NULL;
   5.138 -
   5.139 -    g_io_channel_read_chars (source, buf, 512, &bytes_read, &error);
   5.140 -
   5.141 -    if (bytes_read < 16) {
   5.142 -        return FALSE;
   5.143 -    }
   5.144 -
   5.145 -    if (strncmp (buf, "HTTP/1.1 200", 12) != 0 &&
   5.146 -        strncmp (buf, "HTTP/1.0 200", 12) != 0) {
   5.147 -        return FALSE;
   5.148 -    }
   5.149 -
   5.150 -    if (strncmp (buf + (bytes_read - 4), "\r\n\r\n", 4) != 0) {
   5.151 -        return FALSE;
   5.152 -    }
   5.153 -
   5.154 -    return TRUE;
   5.155 -}
   5.156 -
   5.157 -static gboolean
   5.158 -proxy_read_cb (GIOChannel *source, GIOCondition condition, gpointer data)
   5.159 -{
   5.160 -    LmConnectData *connect_data;
   5.161 -    LmConnection  *connection;
   5.162 -    LmProxy       *proxy;
   5.163 -    gboolean       retval = FALSE;
   5.164 -
   5.165 -    connect_data = (LmConnectData *) data;
   5.166 -    connection = connect_data->connection;
   5.167 -    proxy = lm_connection_get_proxy (connection);
   5.168 -
   5.169 -    g_return_val_if_fail (proxy != NULL, FALSE);
   5.170 -
   5.171 -    if (lm_connection_is_open (connection)) {
   5.172 -        return FALSE;
   5.173 -    }
   5.174 -
   5.175 -    switch (lm_proxy_get_type (proxy)) {
   5.176 -    default:
   5.177 -    case LM_PROXY_TYPE_NONE:
   5.178 -        g_assert_not_reached ();
   5.179 -        break;
   5.180 -    case LM_PROXY_TYPE_HTTP:
   5.181 -        retval = proxy_http_read_cb (source, condition, data);
   5.182 -        break;
   5.183 -    }
   5.184 -
   5.185 -    if (retval == TRUE) {
   5.186 -        g_source_remove (proxy->io_watch);
   5.187 -        _lm_old_socket_succeeded ((LmConnectData *) data);
   5.188 -    }
   5.189 -
   5.190 -    return FALSE;
   5.191 -}
   5.192 -
   5.193 -gboolean
   5.194 -proxy_negotiate (LmProxy *proxy, gint fd, const gchar *server, guint port)
   5.195 -{
   5.196 -    g_return_val_if_fail (proxy != NULL, FALSE);
   5.197 -
   5.198 -    switch (proxy->type) {
   5.199 -    case LM_PROXY_TYPE_NONE:
   5.200 -        return TRUE;
   5.201 -    case LM_PROXY_TYPE_HTTP:
   5.202 -        return proxy_http_negotiate (proxy, fd, server, port);
   5.203 -    default:
   5.204 -        g_assert_not_reached ();
   5.205 -    }
   5.206 -
   5.207 -    return FALSE;
   5.208 -}
   5.209 -
   5.210 -gboolean
   5.211 -_lm_proxy_connect_cb (GIOChannel *source, GIOCondition condition, gpointer data)
   5.212 -{
   5.213 -    LmConnection  *connection;
   5.214 -    LmConnectData *connect_data;
   5.215 -    LmProxy       *proxy;
   5.216 -    int            error;
   5.217 -    socklen_t      len;
   5.218 -
   5.219 -    connect_data = (LmConnectData *) data;
   5.220 -    connection = connect_data->connection;
   5.221 -    proxy = lm_connection_get_proxy (connection);
   5.222 -
   5.223 -    g_return_val_if_fail (proxy != NULL, FALSE);
   5.224 -
   5.225 -    if (condition == G_IO_ERR) {
   5.226 -        len = sizeof (error);
   5.227 -        _lm_sock_get_error (connect_data->fd, &error, &len);
   5.228 -        _lm_old_socket_failed_with_error (connect_data, error);
   5.229 -        return FALSE;
   5.230 -    } else if (condition == G_IO_OUT) {
   5.231 -        if (!proxy_negotiate (lm_connection_get_proxy (connection), connect_data->fd, lm_connection_get_server (connection), lm_connection_get_port (connection))) {
   5.232 -            _lm_old_socket_failed (connect_data);
   5.233 -            return FALSE;
   5.234 -        }
   5.235 -
   5.236 -        proxy->io_watch = g_io_add_watch (connect_data->io_channel,
   5.237 -                                          G_IO_IN|G_IO_ERR,
   5.238 -                                          (GIOFunc) proxy_read_cb,
   5.239 -                                          connect_data);
   5.240 -    } else {
   5.241 -        g_assert_not_reached ();
   5.242 -    }
   5.243 -
   5.244 -    return FALSE;
   5.245 -}
   5.246 -
   5.247 -/**
   5.248 - * lm_proxy_new
   5.249 - * @type: the type of the new proxy
   5.250 - *
   5.251 - * Creates a new Proxy. Used #lm_connection_set_proxy to make a connection
   5.252 - * user this proxy.
   5.253 - *
   5.254 - * Return value: a newly create proxy
   5.255 - **/
   5.256 -LmProxy *
   5.257 -lm_proxy_new (LmProxyType type)
   5.258 -{
   5.259 -    LmProxy *proxy;
   5.260 -
   5.261 -    proxy = g_new0 (LmProxy, 1);
   5.262 -
   5.263 -    proxy->ref_count = 1;
   5.264 -    proxy->type = type;
   5.265 -
   5.266 -    switch (proxy->type) {
   5.267 -    case LM_PROXY_TYPE_HTTP:
   5.268 -        proxy->port = 8000;
   5.269 -        break;
   5.270 -    default:
   5.271 -        proxy->port = 0;
   5.272 -    }
   5.273 -
   5.274 -    return proxy;
   5.275 -}
   5.276 -
   5.277 -/**
   5.278 - * lm_proxy_new_with_server
   5.279 - * @type: the type of the new proxy
   5.280 - * @server: the proxy server
   5.281 - * @port: the proxy server port
   5.282 - *
   5.283 - * Creates a new Proxy. Use #lm_connection_set_proxy to make a connection
   5.284 - * user this proxy.
   5.285 - *
   5.286 - * Return value: a newly create proxy
   5.287 - **/
   5.288 -LmProxy *
   5.289 -lm_proxy_new_with_server (LmProxyType  type,
   5.290 -                          const gchar *server,
   5.291 -                          guint        port)
   5.292 -{
   5.293 -    LmProxy *proxy;
   5.294 -
   5.295 -    proxy = lm_proxy_new (type);
   5.296 -    lm_proxy_set_server (proxy, server);
   5.297 -    lm_proxy_set_port (proxy, port);
   5.298 -
   5.299 -    return proxy;
   5.300 -}
   5.301 -
   5.302 -/**
   5.303 - * lm_proxy_get_type
   5.304 - * @proxy: an #LmProxy
   5.305 - *
   5.306 - * Fetches the proxy type
   5.307 - *
   5.308 - * Return value: the type
   5.309 - **/
   5.310 -LmProxyType
   5.311 -lm_proxy_get_type (LmProxy *proxy)
   5.312 -{
   5.313 -    g_return_val_if_fail (proxy != NULL, LM_PROXY_TYPE_NONE);
   5.314 -
   5.315 -    return proxy->type;
   5.316 -}
   5.317 -
   5.318 -/**
   5.319 - * lm_proxy_set_type
   5.320 - * @proxy: an #LmProxy
   5.321 - * @type: an LmProxyType
   5.322 - *
   5.323 - * Sets the proxy type for @proxy to @type.
   5.324 - **/
   5.325 -void
   5.326 -lm_proxy_set_type (LmProxy *proxy, LmProxyType type)
   5.327 -{
   5.328 -    g_return_if_fail (proxy != NULL);
   5.329 -
   5.330 -    proxy->type = type;
   5.331 -}
   5.332 -
   5.333 -/**
   5.334 - * lm_proxy_get_server:
   5.335 - * @proxy: an #LmProxy
   5.336 - *
   5.337 - * Fetches the server address that @proxy is using.
   5.338 - *
   5.339 - * Return value: the proxy server address
   5.340 - **/
   5.341 -const gchar *
   5.342 -lm_proxy_get_server (LmProxy *proxy)
   5.343 -{
   5.344 -    g_return_val_if_fail (proxy != NULL, NULL);
   5.345 -
   5.346 -    return proxy->server;
   5.347 -}
   5.348 -
   5.349 -/**
   5.350 - * lm_proxy_set_server:
   5.351 - * @proxy: an #LmProxy
   5.352 - * @server: Address of the proxy server
   5.353 - *
   5.354 - * Sets the server address for @proxy to @server.
   5.355 - **/
   5.356 -void
   5.357 -lm_proxy_set_server (LmProxy *proxy, const gchar *server)
   5.358 -{
   5.359 -    g_return_if_fail (proxy != NULL);
   5.360 -    g_return_if_fail (server != NULL);
   5.361 -
   5.362 -    g_free (proxy->server);
   5.363 -    proxy->server = _lm_utils_hostname_to_punycode (server);
   5.364 -}
   5.365 -
   5.366 -/**
   5.367 - * lm_proxy_get_port:
   5.368 - * @proxy: an #LmProxy
   5.369 - *
   5.370 - * Fetches the port that @proxy is using.
   5.371 - *
   5.372 - * Return value: The port
   5.373 - **/
   5.374 -guint
   5.375 -lm_proxy_get_port (LmProxy *proxy)
   5.376 -{
   5.377 -    g_return_val_if_fail (proxy != NULL, 0);
   5.378 -
   5.379 -    return proxy->port;
   5.380 -}
   5.381 -
   5.382 -/**
   5.383 - * lm_proxy_set_port:
   5.384 - * @proxy: an #LmProxy
   5.385 - * @port: proxy server port
   5.386 - *
   5.387 - * Sets the server port that @proxy will be using.
   5.388 - **/
   5.389 -void
   5.390 -lm_proxy_set_port (LmProxy *proxy, guint port)
   5.391 -{
   5.392 -    g_return_if_fail (proxy != NULL);
   5.393 -
   5.394 -    proxy->port = port;
   5.395 -}
   5.396 -
   5.397 -/**
   5.398 - * lm_proxy_get_username:
   5.399 - * @proxy: an #LmProxy
   5.400 - *
   5.401 - * Fetches the username that @proxy is using.
   5.402 - *
   5.403 - * Return value: the username
   5.404 - **/
   5.405 -const gchar *
   5.406 -lm_proxy_get_username (LmProxy *proxy)
   5.407 -{
   5.408 -    g_return_val_if_fail (proxy != NULL, NULL);
   5.409 -
   5.410 -    return proxy->username;
   5.411 -}
   5.412 -
   5.413 -/**
   5.414 - * lm_proxy_set_username:
   5.415 - * @proxy: an #LmProxy
   5.416 - * @username: Username
   5.417 - *
   5.418 - * Sets the username for @proxy to @username or %NULL to unset.
   5.419 - **/
   5.420 -void
   5.421 -lm_proxy_set_username (LmProxy *proxy, const gchar *username)
   5.422 -{
   5.423 -    g_return_if_fail (proxy != NULL);
   5.424 -
   5.425 -    g_free (proxy->username);
   5.426 -
   5.427 -    if (username) {
   5.428 -        proxy->username = g_strdup (username);
   5.429 -    } else {
   5.430 -        proxy->username = NULL;
   5.431 -    }
   5.432 -}
   5.433 -/**
   5.434 - * lm_proxy_get_password:
   5.435 - * @proxy: an #LmProxy
   5.436 - *
   5.437 - * Fetches the password that @proxy is using.
   5.438 - *
   5.439 - * Return value: the proxy password
   5.440 - **/
   5.441 -const gchar *
   5.442 -lm_proxy_get_password (LmProxy *proxy)
   5.443 -{
   5.444 -    g_return_val_if_fail (proxy != NULL, NULL);
   5.445 -
   5.446 -    return proxy->password;
   5.447 -}
   5.448 -
   5.449 -/**
   5.450 - * lm_proxy_set_password:
   5.451 - * @proxy: an #LmProxy
   5.452 - * @password: Password
   5.453 - *
   5.454 - * Sets the password for @proxy to @password or %NULL to unset.
   5.455 - **/
   5.456 -void
   5.457 -lm_proxy_set_password (LmProxy *proxy, const gchar *password)
   5.458 -{
   5.459 -    g_return_if_fail (proxy != NULL);
   5.460 -
   5.461 -    g_free (proxy->password);
   5.462 -
   5.463 -    if (password) {
   5.464 -        proxy->password = g_strdup (password);
   5.465 -    } else {
   5.466 -        proxy->password = NULL;
   5.467 -    }
   5.468 -}
   5.469 -
   5.470 -/**
   5.471 - * lm_proxy_ref:
   5.472 - * @proxy: an #LmProxy
   5.473 - *
   5.474 - * Adds a reference to @proxy.
   5.475 - *
   5.476 - * Return value: the proxy
   5.477 - **/
   5.478 -LmProxy *
   5.479 -lm_proxy_ref (LmProxy *proxy)
   5.480 -{
   5.481 -    g_return_val_if_fail (proxy != NULL, NULL);
   5.482 -
   5.483 -    proxy->ref_count++;
   5.484 -    return proxy;
   5.485 -}
   5.486 -
   5.487 -/**
   5.488 - * lm_proxy_unref
   5.489 - * @proxy: an #LmProxy
   5.490 - *
   5.491 - * Removes a reference from @proxy. When no more references are present
   5.492 - * @proxy is freed.
   5.493 - **/
   5.494 -void
   5.495 -lm_proxy_unref (LmProxy *proxy)
   5.496 -{
   5.497 -    g_return_if_fail (proxy != NULL);
   5.498 -
   5.499 -    proxy->ref_count--;
   5.500 -
   5.501 -    if (proxy->ref_count == 0) {
   5.502 -        proxy_free (proxy);
   5.503 -    }
   5.504 -}
     6.1 --- a/vapi/loudmouth.vapi	Wed Jan 02 06:48:34 2013 +0530
     6.2 +++ b/vapi/loudmouth.vapi	Wed Jan 02 00:59:34 2013 -0500
     6.3 @@ -53,23 +53,6 @@
     6.4  		public void set_value (string value);
     6.5  		public string to_string ();
     6.6  	}
     6.7 -	[CCode (cheader_filename = "loudmouth/loudmouth.h", ref_function = "lm_proxy_ref", unref_function = "lm_proxy_unref")]
     6.8 -	[Compact]
     6.9 -	public class Proxy {
    6.10 -		[CCode (has_construct_function = false)]
    6.11 -		public Proxy (Lm.ProxyType type);
    6.12 -		public unowned string get_password ();
    6.13 -		public uint get_port ();
    6.14 -		public unowned string get_server ();
    6.15 -		public unowned string get_username ();
    6.16 -		public void set_password (string password);
    6.17 -		public void set_port (uint port);
    6.18 -		public void set_server (string server);
    6.19 -		public void set_type (Lm.ProxyType type);
    6.20 -		public void set_username (string username);
    6.21 -		[CCode (has_construct_function = false)]
    6.22 -		public Proxy.with_server (Lm.ProxyType type, string server, uint port);
    6.23 -	}
    6.24  	[CCode (cheader_filename = "loudmouth/loudmouth.h", ref_function = "lm_ssl_ref", unref_function = "lm_ssl_unref")]
    6.25  	[Compact]
    6.26  	public class SSL {