gsocketclient.h 11 KB

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