2 * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
3 * Copyright © 2009 Codethink Limited
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 of the License, or (at your option) any later version.
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.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Authors: Christian Kellner <gicmo@gnome.org>
21 * Samuel Cormier-Iijima <sciyoshi@gmail.com>
22 * Ryan Lortie <desrt@desrt.ca>
25 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26 #error "Only <gio/gio.h> can be included directly."
29 #ifndef __G_SOCKET_H__
30 #define __G_SOCKET_H__
32 #include <gio/giotypes.h>
36 #define G_TYPE_SOCKET (g_socket_get_type ())
37 #define G_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
38 G_TYPE_SOCKET, GSocket))
39 #define G_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
40 G_TYPE_SOCKET, GSocketClass))
41 #define G_IS_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
43 #define G_IS_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
45 #define G_SOCKET_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
46 G_TYPE_SOCKET, GSocketClass))
48 typedef struct _GSocketPrivate GSocketPrivate;
49 typedef struct _GSocketClass GSocketClass;
53 GObjectClass parent_class;
57 /* Padding for future expansion */
58 void (*_g_reserved1) (void);
59 void (*_g_reserved2) (void);
60 void (*_g_reserved3) (void);
61 void (*_g_reserved4) (void);
62 void (*_g_reserved5) (void);
63 void (*_g_reserved6) (void);
64 void (*_g_reserved7) (void);
65 void (*_g_reserved8) (void);
66 void (*_g_reserved9) (void);
67 void (*_g_reserved10) (void);
72 GObject parent_instance;
76 GType g_socket_get_type (void) G_GNUC_CONST;
77 GSocket * g_socket_new (GSocketFamily family,
79 GSocketProtocol protocol,
81 GSocket * g_socket_new_from_fd (gint fd,
83 int g_socket_get_fd (GSocket *socket);
84 GSocketFamily g_socket_get_family (GSocket *socket);
85 GSocketType g_socket_get_socket_type (GSocket *socket);
86 GSocketProtocol g_socket_get_protocol (GSocket *socket);
87 GSocketAddress * g_socket_get_local_address (GSocket *socket,
89 GSocketAddress * g_socket_get_remote_address (GSocket *socket,
91 void g_socket_set_blocking (GSocket *socket,
93 gboolean g_socket_get_blocking (GSocket *socket);
94 void g_socket_set_keepalive (GSocket *socket,
96 gboolean g_socket_get_keepalive (GSocket *socket);
97 gint g_socket_get_listen_backlog (GSocket *socket);
98 void g_socket_set_listen_backlog (GSocket *socket,
100 guint g_socket_get_timeout (GSocket *socket);
101 void g_socket_set_timeout (GSocket *socket,
103 gboolean g_socket_get_multicast_loopback (GSocket *socket);
104 void g_socket_set_multicast_loopback (GSocket *socket,
106 guint g_socket_get_multicast_ttl (GSocket *socket);
107 void g_socket_set_multicast_ttl (GSocket *socket,
109 gboolean g_socket_is_connected (GSocket *socket);
110 gboolean g_socket_bind (GSocket *socket,
111 GSocketAddress *address,
112 gboolean allow_reuse,
114 gboolean g_socket_join_multicast_group (GSocket *socket,
116 const gchar *interface,
118 gboolean g_socket_leave_multicast_group (GSocket *socket,
120 const gchar *interface,
122 gboolean g_socket_connect (GSocket *socket,
123 GSocketAddress *address,
124 GCancellable *cancellable,
126 gboolean g_socket_check_connect_result (GSocket *socket,
129 GIOCondition g_socket_condition_check (GSocket *socket,
130 GIOCondition condition);
131 gboolean g_socket_condition_wait (GSocket *socket,
132 GIOCondition condition,
133 GCancellable *cancellable,
135 GSocket * g_socket_accept (GSocket *socket,
136 GCancellable *cancellable,
138 gboolean g_socket_listen (GSocket *socket,
140 gssize g_socket_receive (GSocket *socket,
143 GCancellable *cancellable,
145 gssize g_socket_receive_from (GSocket *socket,
146 GSocketAddress **address,
149 GCancellable *cancellable,
151 gssize g_socket_send (GSocket *socket,
154 GCancellable *cancellable,
156 gssize g_socket_send_to (GSocket *socket,
157 GSocketAddress *address,
160 GCancellable *cancellable,
162 gssize g_socket_receive_message (GSocket *socket,
163 GSocketAddress **address,
164 GInputVector *vectors,
166 GSocketControlMessage ***messages,
169 GCancellable *cancellable,
171 gssize g_socket_send_message (GSocket *socket,
172 GSocketAddress *address,
173 GOutputVector *vectors,
175 GSocketControlMessage **messages,
178 GCancellable *cancellable,
180 gboolean g_socket_close (GSocket *socket,
182 gboolean g_socket_shutdown (GSocket *socket,
183 gboolean shutdown_read,
184 gboolean shutdown_write,
186 gboolean g_socket_is_closed (GSocket *socket);
187 GSource * g_socket_create_source (GSocket *socket,
188 GIOCondition condition,
189 GCancellable *cancellable);
190 gboolean g_socket_speaks_ipv4 (GSocket *socket);
191 GCredentials *g_socket_get_credentials (GSocket *socket,
194 gssize g_socket_receive_with_blocking (GSocket *socket,
198 GCancellable *cancellable,
200 gssize g_socket_send_with_blocking (GSocket *socket,
204 GCancellable *cancellable,
209 #endif /* __G_SOCKET_H__ */