PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/gio/gsocket.h

https://gitlab.com/ImageMagick/glib
C Header | 305 lines | 260 code | 22 blank | 23 comment | 1 complexity | e542f5b1d2f8e98cd98f84a12af284b1 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-3.0
  1. /*
  2. * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
  3. * Copyright © 2009 Codethink Limited
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General
  16. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Authors: Christian Kellner <gicmo@gnome.org>
  19. * Samuel Cormier-Iijima <sciyoshi@gmail.com>
  20. * Ryan Lortie <desrt@desrt.ca>
  21. */
  22. #ifndef __G_SOCKET_H__
  23. #define __G_SOCKET_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 (g_socket_get_type ())
  30. #define G_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  31. G_TYPE_SOCKET, GSocket))
  32. #define G_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  33. G_TYPE_SOCKET, GSocketClass))
  34. #define G_IS_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  35. G_TYPE_SOCKET))
  36. #define G_IS_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  37. G_TYPE_SOCKET))
  38. #define G_SOCKET_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  39. G_TYPE_SOCKET, GSocketClass))
  40. typedef struct _GSocketPrivate GSocketPrivate;
  41. typedef struct _GSocketClass GSocketClass;
  42. struct _GSocketClass
  43. {
  44. GObjectClass parent_class;
  45. /*< private >*/
  46. /* Padding for future expansion */
  47. void (*_g_reserved1) (void);
  48. void (*_g_reserved2) (void);
  49. void (*_g_reserved3) (void);
  50. void (*_g_reserved4) (void);
  51. void (*_g_reserved5) (void);
  52. void (*_g_reserved6) (void);
  53. void (*_g_reserved7) (void);
  54. void (*_g_reserved8) (void);
  55. void (*_g_reserved9) (void);
  56. void (*_g_reserved10) (void);
  57. };
  58. struct _GSocket
  59. {
  60. GObject parent_instance;
  61. GSocketPrivate *priv;
  62. };
  63. GLIB_AVAILABLE_IN_ALL
  64. GType g_socket_get_type (void) G_GNUC_CONST;
  65. GLIB_AVAILABLE_IN_ALL
  66. GSocket * g_socket_new (GSocketFamily family,
  67. GSocketType type,
  68. GSocketProtocol protocol,
  69. GError **error);
  70. GLIB_AVAILABLE_IN_ALL
  71. GSocket * g_socket_new_from_fd (gint fd,
  72. GError **error);
  73. GLIB_AVAILABLE_IN_ALL
  74. int g_socket_get_fd (GSocket *socket);
  75. GLIB_AVAILABLE_IN_ALL
  76. GSocketFamily g_socket_get_family (GSocket *socket);
  77. GLIB_AVAILABLE_IN_ALL
  78. GSocketType g_socket_get_socket_type (GSocket *socket);
  79. GLIB_AVAILABLE_IN_ALL
  80. GSocketProtocol g_socket_get_protocol (GSocket *socket);
  81. GLIB_AVAILABLE_IN_ALL
  82. GSocketAddress * g_socket_get_local_address (GSocket *socket,
  83. GError **error);
  84. GLIB_AVAILABLE_IN_ALL
  85. GSocketAddress * g_socket_get_remote_address (GSocket *socket,
  86. GError **error);
  87. GLIB_AVAILABLE_IN_ALL
  88. void g_socket_set_blocking (GSocket *socket,
  89. gboolean blocking);
  90. GLIB_AVAILABLE_IN_ALL
  91. gboolean g_socket_get_blocking (GSocket *socket);
  92. GLIB_AVAILABLE_IN_ALL
  93. void g_socket_set_keepalive (GSocket *socket,
  94. gboolean keepalive);
  95. GLIB_AVAILABLE_IN_ALL
  96. gboolean g_socket_get_keepalive (GSocket *socket);
  97. GLIB_AVAILABLE_IN_ALL
  98. gint g_socket_get_listen_backlog (GSocket *socket);
  99. GLIB_AVAILABLE_IN_ALL
  100. void g_socket_set_listen_backlog (GSocket *socket,
  101. gint backlog);
  102. GLIB_AVAILABLE_IN_ALL
  103. guint g_socket_get_timeout (GSocket *socket);
  104. GLIB_AVAILABLE_IN_ALL
  105. void g_socket_set_timeout (GSocket *socket,
  106. guint timeout);
  107. GLIB_AVAILABLE_IN_2_32
  108. guint g_socket_get_ttl (GSocket *socket);
  109. GLIB_AVAILABLE_IN_2_32
  110. void g_socket_set_ttl (GSocket *socket,
  111. guint ttl);
  112. GLIB_AVAILABLE_IN_2_32
  113. gboolean g_socket_get_broadcast (GSocket *socket);
  114. GLIB_AVAILABLE_IN_2_32
  115. void g_socket_set_broadcast (GSocket *socket,
  116. gboolean broadcast);
  117. GLIB_AVAILABLE_IN_2_32
  118. gboolean g_socket_get_multicast_loopback (GSocket *socket);
  119. GLIB_AVAILABLE_IN_2_32
  120. void g_socket_set_multicast_loopback (GSocket *socket,
  121. gboolean loopback);
  122. GLIB_AVAILABLE_IN_2_32
  123. guint g_socket_get_multicast_ttl (GSocket *socket);
  124. GLIB_AVAILABLE_IN_2_32
  125. void g_socket_set_multicast_ttl (GSocket *socket,
  126. guint ttl);
  127. GLIB_AVAILABLE_IN_ALL
  128. gboolean g_socket_is_connected (GSocket *socket);
  129. GLIB_AVAILABLE_IN_ALL
  130. gboolean g_socket_bind (GSocket *socket,
  131. GSocketAddress *address,
  132. gboolean allow_reuse,
  133. GError **error);
  134. GLIB_AVAILABLE_IN_2_32
  135. gboolean g_socket_join_multicast_group (GSocket *socket,
  136. GInetAddress *group,
  137. gboolean source_specific,
  138. const gchar *iface,
  139. GError **error);
  140. GLIB_AVAILABLE_IN_2_32
  141. gboolean g_socket_leave_multicast_group (GSocket *socket,
  142. GInetAddress *group,
  143. gboolean source_specific,
  144. const gchar *iface,
  145. GError **error);
  146. GLIB_AVAILABLE_IN_ALL
  147. gboolean g_socket_connect (GSocket *socket,
  148. GSocketAddress *address,
  149. GCancellable *cancellable,
  150. GError **error);
  151. GLIB_AVAILABLE_IN_ALL
  152. gboolean g_socket_check_connect_result (GSocket *socket,
  153. GError **error);
  154. GLIB_AVAILABLE_IN_ALL
  155. gssize g_socket_get_available_bytes (GSocket *socket);
  156. GLIB_AVAILABLE_IN_ALL
  157. GIOCondition g_socket_condition_check (GSocket *socket,
  158. GIOCondition condition);
  159. GLIB_AVAILABLE_IN_ALL
  160. gboolean g_socket_condition_wait (GSocket *socket,
  161. GIOCondition condition,
  162. GCancellable *cancellable,
  163. GError **error);
  164. GLIB_AVAILABLE_IN_2_32
  165. gboolean g_socket_condition_timed_wait (GSocket *socket,
  166. GIOCondition condition,
  167. gint64 timeout,
  168. GCancellable *cancellable,
  169. GError **error);
  170. GLIB_AVAILABLE_IN_ALL
  171. GSocket * g_socket_accept (GSocket *socket,
  172. GCancellable *cancellable,
  173. GError **error);
  174. GLIB_AVAILABLE_IN_ALL
  175. gboolean g_socket_listen (GSocket *socket,
  176. GError **error);
  177. GLIB_AVAILABLE_IN_ALL
  178. gssize g_socket_receive (GSocket *socket,
  179. gchar *buffer,
  180. gsize size,
  181. GCancellable *cancellable,
  182. GError **error);
  183. GLIB_AVAILABLE_IN_ALL
  184. gssize g_socket_receive_from (GSocket *socket,
  185. GSocketAddress **address,
  186. gchar *buffer,
  187. gsize size,
  188. GCancellable *cancellable,
  189. GError **error);
  190. GLIB_AVAILABLE_IN_ALL
  191. gssize g_socket_send (GSocket *socket,
  192. const gchar *buffer,
  193. gsize size,
  194. GCancellable *cancellable,
  195. GError **error);
  196. GLIB_AVAILABLE_IN_ALL
  197. gssize g_socket_send_to (GSocket *socket,
  198. GSocketAddress *address,
  199. const gchar *buffer,
  200. gsize size,
  201. GCancellable *cancellable,
  202. GError **error);
  203. GLIB_AVAILABLE_IN_ALL
  204. gssize g_socket_receive_message (GSocket *socket,
  205. GSocketAddress **address,
  206. GInputVector *vectors,
  207. gint num_vectors,
  208. GSocketControlMessage ***messages,
  209. gint *num_messages,
  210. gint *flags,
  211. GCancellable *cancellable,
  212. GError **error);
  213. GLIB_AVAILABLE_IN_ALL
  214. gssize g_socket_send_message (GSocket *socket,
  215. GSocketAddress *address,
  216. GOutputVector *vectors,
  217. gint num_vectors,
  218. GSocketControlMessage **messages,
  219. gint num_messages,
  220. gint flags,
  221. GCancellable *cancellable,
  222. GError **error);
  223. GLIB_AVAILABLE_IN_2_48
  224. gint g_socket_receive_messages (GSocket *socket,
  225. GInputMessage *messages,
  226. guint num_messages,
  227. gint flags,
  228. GCancellable *cancellable,
  229. GError **error);
  230. GLIB_AVAILABLE_IN_2_44
  231. gint g_socket_send_messages (GSocket *socket,
  232. GOutputMessage *messages,
  233. guint num_messages,
  234. gint flags,
  235. GCancellable *cancellable,
  236. GError **error);
  237. GLIB_AVAILABLE_IN_ALL
  238. gboolean g_socket_close (GSocket *socket,
  239. GError **error);
  240. GLIB_AVAILABLE_IN_ALL
  241. gboolean g_socket_shutdown (GSocket *socket,
  242. gboolean shutdown_read,
  243. gboolean shutdown_write,
  244. GError **error);
  245. GLIB_AVAILABLE_IN_ALL
  246. gboolean g_socket_is_closed (GSocket *socket);
  247. GLIB_AVAILABLE_IN_ALL
  248. GSource * g_socket_create_source (GSocket *socket,
  249. GIOCondition condition,
  250. GCancellable *cancellable);
  251. GLIB_AVAILABLE_IN_ALL
  252. gboolean g_socket_speaks_ipv4 (GSocket *socket);
  253. GLIB_AVAILABLE_IN_ALL
  254. GCredentials *g_socket_get_credentials (GSocket *socket,
  255. GError **error);
  256. GLIB_AVAILABLE_IN_ALL
  257. gssize g_socket_receive_with_blocking (GSocket *socket,
  258. gchar *buffer,
  259. gsize size,
  260. gboolean blocking,
  261. GCancellable *cancellable,
  262. GError **error);
  263. GLIB_AVAILABLE_IN_ALL
  264. gssize g_socket_send_with_blocking (GSocket *socket,
  265. const gchar *buffer,
  266. gsize size,
  267. gboolean blocking,
  268. GCancellable *cancellable,
  269. GError **error);
  270. GLIB_AVAILABLE_IN_2_36
  271. gboolean g_socket_get_option (GSocket *socket,
  272. gint level,
  273. gint optname,
  274. gint *value,
  275. GError **error);
  276. GLIB_AVAILABLE_IN_2_36
  277. gboolean g_socket_set_option (GSocket *socket,
  278. gint level,
  279. gint optname,
  280. gint value,
  281. GError **error);
  282. G_END_DECLS
  283. #endif /* __G_SOCKET_H__ */