gsocketclient.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright © 2008, 2009 Codethink Limited
  4. * Copyright © 2009 Red Hat, Inc
  5. *
  6. * SPDX-License-Identifier: LGPL-2.1-or-later
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General
  19. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * Authors: Ryan Lortie <desrt@desrt.ca>
  22. * Alexander Larsson <alexl@redhat.com>
  23. */
  24. #ifndef __G_SOCKET_CLIENT_H__
  25. #define __G_SOCKET_CLIENT_H__
  26. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  27. #error "Only <gio/gio.h> can be included directly."
  28. #endif
  29. #include <gio/giotypes.h>
  30. G_BEGIN_DECLS
  31. #define G_TYPE_SOCKET_CLIENT (g_socket_client_get_type ())
  32. #define G_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  33. G_TYPE_SOCKET_CLIENT, GSocketClient))
  34. #define G_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  35. G_TYPE_SOCKET_CLIENT, GSocketClientClass))
  36. #define G_IS_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  37. G_TYPE_SOCKET_CLIENT))
  38. #define G_IS_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  39. G_TYPE_SOCKET_CLIENT))
  40. #define G_SOCKET_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  41. G_TYPE_SOCKET_CLIENT, GSocketClientClass))
  42. typedef struct _GSocketClientPrivate GSocketClientPrivate;
  43. typedef struct _GSocketClientClass GSocketClientClass;
  44. struct _GSocketClientClass
  45. {
  46. GObjectClass parent_class;
  47. void (* event) (GSocketClient *client,
  48. GSocketClientEvent event,
  49. GSocketConnectable *connectable,
  50. GIOStream *connection);
  51. /* Padding for future expansion */
  52. void (*_g_reserved1) (void);
  53. void (*_g_reserved2) (void);
  54. void (*_g_reserved3) (void);
  55. void (*_g_reserved4) (void);
  56. };
  57. struct _GSocketClient
  58. {
  59. GObject parent_instance;
  60. GSocketClientPrivate *priv;
  61. };
  62. GIO_AVAILABLE_IN_ALL
  63. GType g_socket_client_get_type (void) G_GNUC_CONST;
  64. GIO_AVAILABLE_IN_ALL
  65. GSocketClient *g_socket_client_new (void);
  66. GIO_AVAILABLE_IN_ALL
  67. GSocketFamily g_socket_client_get_family (GSocketClient *client);
  68. GIO_AVAILABLE_IN_ALL
  69. void g_socket_client_set_family (GSocketClient *client,
  70. GSocketFamily family);
  71. GIO_AVAILABLE_IN_ALL
  72. GSocketType g_socket_client_get_socket_type (GSocketClient *client);
  73. GIO_AVAILABLE_IN_ALL
  74. void g_socket_client_set_socket_type (GSocketClient *client,
  75. GSocketType type);
  76. GIO_AVAILABLE_IN_ALL
  77. GSocketProtocol g_socket_client_get_protocol (GSocketClient *client);
  78. GIO_AVAILABLE_IN_ALL
  79. void g_socket_client_set_protocol (GSocketClient *client,
  80. GSocketProtocol protocol);
  81. GIO_AVAILABLE_IN_ALL
  82. GSocketAddress *g_socket_client_get_local_address (GSocketClient *client);
  83. GIO_AVAILABLE_IN_ALL
  84. void g_socket_client_set_local_address (GSocketClient *client,
  85. GSocketAddress *address);
  86. GIO_AVAILABLE_IN_ALL
  87. guint g_socket_client_get_timeout (GSocketClient *client);
  88. GIO_AVAILABLE_IN_ALL
  89. void g_socket_client_set_timeout (GSocketClient *client,
  90. guint timeout);
  91. GIO_AVAILABLE_IN_ALL
  92. gboolean g_socket_client_get_enable_proxy (GSocketClient *client);
  93. GIO_AVAILABLE_IN_ALL
  94. void g_socket_client_set_enable_proxy (GSocketClient *client,
  95. gboolean enable);
  96. GIO_AVAILABLE_IN_2_28
  97. gboolean g_socket_client_get_tls (GSocketClient *client);
  98. GIO_AVAILABLE_IN_2_28
  99. void g_socket_client_set_tls (GSocketClient *client,
  100. gboolean tls);
  101. GIO_DEPRECATED_IN_2_72
  102. GTlsCertificateFlags g_socket_client_get_tls_validation_flags (GSocketClient *client);
  103. GIO_DEPRECATED_IN_2_72
  104. void g_socket_client_set_tls_validation_flags (GSocketClient *client,
  105. GTlsCertificateFlags flags);
  106. GIO_AVAILABLE_IN_2_36
  107. GProxyResolver *g_socket_client_get_proxy_resolver (GSocketClient *client);
  108. GIO_AVAILABLE_IN_2_36
  109. void g_socket_client_set_proxy_resolver (GSocketClient *client,
  110. GProxyResolver *proxy_resolver);
  111. GIO_AVAILABLE_IN_ALL
  112. GSocketConnection * g_socket_client_connect (GSocketClient *client,
  113. GSocketConnectable *connectable,
  114. GCancellable *cancellable,
  115. GError **error);
  116. GIO_AVAILABLE_IN_ALL
  117. GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
  118. const gchar *host_and_port,
  119. guint16 default_port,
  120. GCancellable *cancellable,
  121. GError **error);
  122. GIO_AVAILABLE_IN_ALL
  123. GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
  124. const gchar *domain,
  125. const gchar *service,
  126. GCancellable *cancellable,
  127. GError **error);
  128. GIO_AVAILABLE_IN_2_26
  129. GSocketConnection * g_socket_client_connect_to_uri (GSocketClient *client,
  130. const gchar *uri,
  131. guint16 default_port,
  132. GCancellable *cancellable,
  133. GError **error);
  134. GIO_AVAILABLE_IN_ALL
  135. void g_socket_client_connect_async (GSocketClient *client,
  136. GSocketConnectable *connectable,
  137. GCancellable *cancellable,
  138. GAsyncReadyCallback callback,
  139. gpointer user_data);
  140. GIO_AVAILABLE_IN_ALL
  141. GSocketConnection * g_socket_client_connect_finish (GSocketClient *client,
  142. GAsyncResult *result,
  143. GError **error);
  144. GIO_AVAILABLE_IN_ALL
  145. void g_socket_client_connect_to_host_async (GSocketClient *client,
  146. const gchar *host_and_port,
  147. guint16 default_port,
  148. GCancellable *cancellable,
  149. GAsyncReadyCallback callback,
  150. gpointer user_data);
  151. GIO_AVAILABLE_IN_ALL
  152. GSocketConnection * g_socket_client_connect_to_host_finish (GSocketClient *client,
  153. GAsyncResult *result,
  154. GError **error);
  155. GIO_AVAILABLE_IN_ALL
  156. void g_socket_client_connect_to_service_async (GSocketClient *client,
  157. const gchar *domain,
  158. const gchar *service,
  159. GCancellable *cancellable,
  160. GAsyncReadyCallback callback,
  161. gpointer user_data);
  162. GIO_AVAILABLE_IN_ALL
  163. GSocketConnection * g_socket_client_connect_to_service_finish (GSocketClient *client,
  164. GAsyncResult *result,
  165. GError **error);
  166. GIO_AVAILABLE_IN_ALL
  167. void g_socket_client_connect_to_uri_async (GSocketClient *client,
  168. const gchar *uri,
  169. guint16 default_port,
  170. GCancellable *cancellable,
  171. GAsyncReadyCallback callback,
  172. gpointer user_data);
  173. GIO_AVAILABLE_IN_ALL
  174. GSocketConnection * g_socket_client_connect_to_uri_finish (GSocketClient *client,
  175. GAsyncResult *result,
  176. GError **error);
  177. GIO_AVAILABLE_IN_ALL
  178. void g_socket_client_add_application_proxy (GSocketClient *client,
  179. const gchar *protocol);
  180. G_END_DECLS
  181. #endif /* __G_SOCKET_CLIENT_H___ */