Improve the wording of the message for G_UNAVAILABLE
[glib.git] / gio / gsocketconnection.h
blob34a0cb184b1bd0b92c007309b1b6233cdf822eea
1 /* GIO - GLib Input, Output and Streaming Library
2 * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima
3 * Copyright © 2009 Codethink Limited
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; either version 2 of the licence or (at
8 * 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>
23 * Alexander Larsson <alexl@redhat.com>
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
30 #ifndef __G_SOCKET_CONNECTION_H__
31 #define __G_SOCKET_CONNECTION_H__
33 #include <glib-object.h>
34 #include <gio/gsocket.h>
35 #include <gio/giostream.h>
37 G_BEGIN_DECLS
39 #define G_TYPE_SOCKET_CONNECTION (g_socket_connection_get_type ())
40 #define G_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
41 G_TYPE_SOCKET_CONNECTION, GSocketConnection))
42 #define G_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
43 G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
44 #define G_IS_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
45 G_TYPE_SOCKET_CONNECTION))
46 #define G_IS_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
47 G_TYPE_SOCKET_CONNECTION))
48 #define G_SOCKET_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
49 G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
51 typedef struct _GSocketConnectionPrivate GSocketConnectionPrivate;
52 typedef struct _GSocketConnectionClass GSocketConnectionClass;
54 struct _GSocketConnectionClass
56 GIOStreamClass parent_class;
58 /* Padding for future expansion */
59 void (*_g_reserved1) (void);
60 void (*_g_reserved2) (void);
61 void (*_g_reserved3) (void);
62 void (*_g_reserved4) (void);
63 void (*_g_reserved5) (void);
64 void (*_g_reserved6) (void);
67 struct _GSocketConnection
69 GIOStream parent_instance;
70 GSocketConnectionPrivate *priv;
73 GType g_socket_connection_get_type (void) G_GNUC_CONST;
75 gboolean g_socket_connection_is_connected (GSocketConnection *connection);
76 gboolean g_socket_connection_connect (GSocketConnection *connection,
77 GSocketAddress *address,
78 GCancellable *cancellable,
79 GError **error);
80 void g_socket_connection_connect_async (GSocketConnection *connection,
81 GSocketAddress *address,
82 GCancellable *cancellable,
83 GAsyncReadyCallback callback,
84 gpointer user_data);
85 gboolean g_socket_connection_connect_finish (GSocketConnection *connection,
86 GAsyncResult *result,
87 GError **error);
89 GSocket *g_socket_connection_get_socket (GSocketConnection *connection);
90 GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection,
91 GError **error);
92 GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection,
93 GError **error);
95 void g_socket_connection_factory_register_type (GType g_type,
96 GSocketFamily family,
97 GSocketType type,
98 gint protocol);
99 GType g_socket_connection_factory_lookup_type (GSocketFamily family,
100 GSocketType type,
101 gint protocol_id);
102 GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket);
104 G_END_DECLS
106 #endif /* __G_SOCKET_CONNECTION_H__ */