Added missing "Since:" annotations for g_input_stream_read_bytes() APIs.
[platform/upstream/glib.git] / gio / gsimpleproxyresolver.c
index 7691b6f..8610e2b 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 #include "gsimpleproxyresolver.h"
 #include "ginetaddress.h"
@@ -64,6 +65,7 @@ struct _GSimpleProxyResolverPrivate {
 static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (GSimpleProxyResolver)
                          G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER,
                                                 g_simple_proxy_resolver_iface_init))
 
@@ -95,9 +97,7 @@ g_simple_proxy_resolver_finalize (GObject *object)
 static void
 g_simple_proxy_resolver_init (GSimpleProxyResolver *resolver)
 {
-  resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver,
-                                                G_TYPE_SIMPLE_PROXY_RESOLVER,
-                                                GSimpleProxyResolverPrivate);
+  resolver->priv = g_simple_proxy_resolver_get_instance_private (resolver);
   resolver->priv->uri_proxies = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                        g_free, g_free);
 }
@@ -402,8 +402,6 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (resolver_class);
 
-  g_type_class_add_private (resolver_class, sizeof (GSimpleProxyResolverPrivate));
-
   object_class->get_property = g_simple_proxy_resolver_get_property;
   object_class->set_property = g_simple_proxy_resolver_set_property;
   object_class->finalize = g_simple_proxy_resolver_finalize;
@@ -416,10 +414,8 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
    * of the schemes set with g_simple_proxy_resolver_set_uri_proxy().
    *
    * Note that as a special case, if this URI starts with
-   * "<literal>socks://</literal>", #GSimpleProxyResolver will treat
-   * it as referring to all three of the <literal>socks5</literal>,
-   * <literal>socks4a</literal>, and <literal>socks4</literal> proxy
-   * types.
+   * "socks://", #GSimpleProxyResolver will treat it as referring
+   * to all three of the socks5, socks4a, and socks4 proxy types.
    */
   g_object_class_install_property (object_class, PROP_DEFAULT_PROXY,
                                   g_param_spec_string ("default-proxy",
@@ -437,32 +433,21 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
    *
    * Entries can be in one of 4 formats:
    *
-   * <itemizedlist>
-   *   <listitem>
-   *     A hostname, such as "<literal>example.com</literal>",
-   *     "<literal>.example.com</literal>", or
-   *     "<literal>*.example.com</literal>", any of which match
-   *     "<literal>example.com</literal>" or any subdomain of it.
-   *   </listitem>
-   *   <listitem>
-   *     An IPv4 or IPv6 address, such as
-   *     "<literal>192.168.1.1</literal>", which matches only
-   *     that address.
-   *   </listitem>
-   *   <listitem>
-   *     A hostname or IP address followed by a port, such as
-   *     "<literal>example.com:80</literal>", which matches whatever
-   *     the hostname or IP address would match, but only for URLs
-   *     with the (explicitly) indicated port. In the case of an IPv6
-   *     address, the address part must appear in brackets:
-   *     "<literal>[::1]:443</literal>"
-   *   </listitem>
-   *   <listitem>
-   *     An IP address range, given by a base address and prefix length,
-   *     such as "<literal>fe80::/10</literal>", which matches any
-   *     address in that range.
-   *   </listitem>
-   * </itemizedlist>
+   * - A hostname, such as "example.com", ".example.com", or
+   *   "*.example.com", any of which match "example.com" or
+   *   any subdomain of it.
+   *
+   * - An IPv4 or IPv6 address, such as "192.168.1.1",
+   *   which matches only that address.
+   *
+   * - A hostname or IP address followed by a port, such as
+   *   "example.com:80", which matches whatever the hostname or IP
+   *   address would match, but only for URLs with the (explicitly)
+   *   indicated port. In the case of an IPv6 address, the address
+   *   part must appear in brackets: "[::1]:443"
+   *
+   * - An IP address range, given by a base address and prefix length,
+   *   such as "fe80::/10", which matches any address in that range.
    *
    * Note that when dealing with Unicode hostnames, the matching is
    * done against the ASCII form of the name.
@@ -470,13 +455,10 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
    * Also note that hostname exclusions apply only to connections made
    * to hosts identified by name, and IP address exclusions apply only
    * to connections made to hosts identified by address. That is, if
-   * <literal>example.com</literal> has an address of
-   * <literal>192.168.1.1</literal>, and the :ignore-hosts list
-   * contains only "<literal>192.168.1.1</literal>", then a connection
-   * to "<literal>example.com</literal>" (eg, via a #GNetworkAddress)
-   * will use the proxy, and a connection to
-   * "<literal>192.168.1.1</literal>" (eg, via a #GInetSocketAddress)
-   * will not.
+   * example.com has an address of 192.168.1.1, and the :ignore-hosts list
+   * contains only "192.168.1.1", then a connection to "example.com"
+   * (eg, via a #GNetworkAddress) will use the proxy, and a connection to
+   * "192.168.1.1" (eg, via a #GInetSocketAddress) will not.
    *
    * These rules match the "ignore-hosts"/"noproxy" rules most
    * commonly used by other applications.
@@ -502,16 +484,16 @@ g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface)
 /**
  * g_simple_proxy_resolver_new:
  * @default_proxy: (allow-none): the default proxy to use, eg
- *   "socks://192.168.1.1"
+ *     "socks://192.168.1.1"
  * @ignore_hosts: (allow-none): an optional list of hosts/IP addresses
- *   to not use a proxy for.
+ *     to not use a proxy for.
  *
  * Creates a new #GSimpleProxyResolver. See
  * #GSimpleProxyResolver:default-proxy and
  * #GSimpleProxyResolver:ignore-hosts for more details on how the
  * arguments are interpreted.
  *
- * Returns: a new #GSimpleProxyResolver
+ * Returns: (transfer full) a new #GSimpleProxyResolver
  *
  * Since: 2.36
  */
@@ -534,16 +516,15 @@ g_simple_proxy_resolver_new (const gchar  *default_proxy,
  * don't match #GSimpleProxyResolver:ignore-hosts or a proxy set
  * via g_simple_proxy_resolver_set_uri_proxy().
  *
- * If @default_proxy starts with "<literal>socks://</literal>",
+ * If @default_proxy starts with "socks://",
  * #GSimpleProxyResolver will treat it as referring to all three of
- * the <literal>socks5</literal>, <literal>socks4a</literal>, and
- * <literal>socks4</literal> proxy types.
+ * the socks5, socks4a, and socks4 proxy types.
  *
  * Since: 2.36
  */
 void
-g_simple_proxy_resolver_set_default_proxy (GSimpleProxyResolver  *resolver,
-                                           const gchar           *default_proxy)
+g_simple_proxy_resolver_set_default_proxy (GSimpleProxyResolver *resolver,
+                                           const gchar          *default_proxy)
 {
   g_return_if_fail (G_IS_SIMPLE_PROXY_RESOLVER (resolver));
 
@@ -552,9 +533,22 @@ g_simple_proxy_resolver_set_default_proxy (GSimpleProxyResolver  *resolver,
   g_object_notify (G_OBJECT (resolver), "default-proxy");
 }
 
+/**
+ * g_simple_proxy_resolver_set_ignore_hosts:
+ * @resolver: a #GSimpleProxyResolver
+ * @ignore_hosts: %NULL-terminated list of hosts/IP addresses
+ *     to not use a proxy for
+ *
+ * Sets the list of ignored hosts.
+ *
+ * See #GSimpleProxyResolver:ignore-hosts for more details on how the
+ * @ignore_hosts argument is interpreted.
+ *
+ * Since: 2.36
+ */
 void
-g_simple_proxy_resolver_set_ignore_hosts  (GSimpleProxyResolver  *resolver,
-                                           gchar                **ignore_hosts)
+g_simple_proxy_resolver_set_ignore_hosts (GSimpleProxyResolver  *resolver,
+                                          gchar                **ignore_hosts)
 {
   g_return_if_fail (G_IS_SIMPLE_PROXY_RESOLVER (resolver));
 
@@ -575,9 +569,8 @@ g_simple_proxy_resolver_set_ignore_hosts  (GSimpleProxyResolver  *resolver,
  * #GSimpleProxyResolver:ignore-hosts) will be proxied via @proxy.
  *
  * As with #GSimpleProxyResolver:default-proxy, if @proxy starts with
- * "<literal>socks://</literal>", #GSimpleProxyResolver will treat it
- * as referring to all three of the <literal>socks5</literal>,
- * <literal>socks4a</literal>, and <literal>socks4</literal> proxy
+ * "socks://", #GSimpleProxyResolver will treat it
+ * as referring to all three of the socks5, socks4a, and socks4 proxy
  * types.
  *
  * Since: 2.36