You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

124 regels
3.9 KiB

  1. /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
  2. /* GIO - GLib Input, Output and Streaming Library
  3. *
  4. * Copyright (C) 2010 Collabora Ltd.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. *
  21. * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
  22. */
  23. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  24. #error "Only <gio/gio.h> can be included directly."
  25. #endif
  26. #ifndef __G_PROXY_H__
  27. #define __G_PROXY_H__
  28. #include <gio/giotypes.h>
  29. G_BEGIN_DECLS
  30. #define G_TYPE_PROXY (g_proxy_get_type ())
  31. #define G_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY, GProxy))
  32. #define G_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY))
  33. #define G_PROXY_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_PROXY, GProxyInterface))
  34. /**
  35. * G_PROXY_EXTENSION_POINT_NAME:
  36. *
  37. * Extension point for proxy functionality.
  38. * See <link linkend="extending-gio">Extending GIO</link>.
  39. *
  40. * Since: 2.26
  41. */
  42. #define G_PROXY_EXTENSION_POINT_NAME "gio-proxy"
  43. /**
  44. * GProxy:
  45. *
  46. * Interface that handles proxy connection and payload.
  47. *
  48. * Since: 2.26
  49. */
  50. typedef struct _GProxyInterface GProxyInterface;
  51. /**
  52. * GProxyInterface:
  53. * @g_iface: The parent interface.
  54. * @connect: Connect to proxy server and wrap (if required) the #connection
  55. * to handle payload.
  56. * @connect_async: Same has connect() but asynchronous.
  57. * @connect_finish: Returns the result of connect_async()
  58. *
  59. * Provides an interface for handling proxy connection and payload.
  60. *
  61. * Since: 2.26
  62. */
  63. struct _GProxyInterface
  64. {
  65. GTypeInterface g_iface;
  66. /* Virtual Table */
  67. GIOStream * (* connect) (GProxy *proxy,
  68. GIOStream *connection,
  69. GProxyAddress *proxy_address,
  70. GCancellable *cancellable,
  71. GError **error);
  72. void (* connect_async) (GProxy *proxy,
  73. GIOStream *connection,
  74. GProxyAddress *proxy_address,
  75. GCancellable *cancellable,
  76. GAsyncReadyCallback callback,
  77. gpointer user_data);
  78. GIOStream * (* connect_finish) (GProxy *proxy,
  79. GAsyncResult *result,
  80. GError **error);
  81. gboolean (* supports_hostname) (GProxy *proxy);
  82. };
  83. GType g_proxy_get_type (void) G_GNUC_CONST;
  84. GProxy *g_proxy_get_default_for_protocol (const gchar *protocol);
  85. GIOStream *g_proxy_connect (GProxy *proxy,
  86. GIOStream *connection,
  87. GProxyAddress *proxy_address,
  88. GCancellable *cancellable,
  89. GError **error);
  90. void g_proxy_connect_async (GProxy *proxy,
  91. GIOStream *connection,
  92. GProxyAddress *proxy_address,
  93. GCancellable *cancellable,
  94. GAsyncReadyCallback callback,
  95. gpointer user_data);
  96. GIOStream *g_proxy_connect_finish (GProxy *proxy,
  97. GAsyncResult *result,
  98. GError **error);
  99. gboolean g_proxy_supports_hostname (GProxy *proxy);
  100. G_END_DECLS
  101. #endif /* __G_PROXY_H__ */