1 /* GIO - GLib Input, Output and Streaming Library
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.1 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, see <http://www.gnu.org/licenses/>.
18 * Authors: Christian Kellner <gicmo@gnome.org>
19 * Samuel Cormier-Iijima <sciyoshi@gmail.com>
20 * Ryan Lortie <desrt@desrt.ca>
21 * Alexander Larsson <alexl@redhat.com>
24 #ifndef __G_SOCKET_CONNECTION_H__
25 #define __G_SOCKET_CONNECTION_H__
27 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
28 #error "Only <gio/gio.h> can be included directly."
31 #include <glib-object.h>
32 #include <gio/gsocket.h>
33 #include <gio/giostream.h>
37 #define G_TYPE_SOCKET_CONNECTION (g_socket_connection_get_type ())
38 #define G_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
39 G_TYPE_SOCKET_CONNECTION, GSocketConnection))
40 #define G_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
41 G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
42 #define G_IS_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
43 G_TYPE_SOCKET_CONNECTION))
44 #define G_IS_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
45 G_TYPE_SOCKET_CONNECTION))
46 #define G_SOCKET_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
47 G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass))
49 typedef struct _GSocketConnectionPrivate GSocketConnectionPrivate
;
50 typedef struct _GSocketConnectionClass GSocketConnectionClass
;
52 struct _GSocketConnectionClass
54 GIOStreamClass parent_class
;
56 /* Padding for future expansion */
57 void (*_g_reserved1
) (void);
58 void (*_g_reserved2
) (void);
59 void (*_g_reserved3
) (void);
60 void (*_g_reserved4
) (void);
61 void (*_g_reserved5
) (void);
62 void (*_g_reserved6
) (void);
65 struct _GSocketConnection
67 GIOStream parent_instance
;
68 GSocketConnectionPrivate
*priv
;
72 GType
g_socket_connection_get_type (void) G_GNUC_CONST
;
74 GLIB_AVAILABLE_IN_2_32
75 gboolean
g_socket_connection_is_connected (GSocketConnection
*connection
);
76 GLIB_AVAILABLE_IN_2_32
77 gboolean
g_socket_connection_connect (GSocketConnection
*connection
,
78 GSocketAddress
*address
,
79 GCancellable
*cancellable
,
81 GLIB_AVAILABLE_IN_2_32
82 void g_socket_connection_connect_async (GSocketConnection
*connection
,
83 GSocketAddress
*address
,
84 GCancellable
*cancellable
,
85 GAsyncReadyCallback callback
,
87 GLIB_AVAILABLE_IN_2_32
88 gboolean
g_socket_connection_connect_finish (GSocketConnection
*connection
,
93 GSocket
*g_socket_connection_get_socket (GSocketConnection
*connection
);
95 GSocketAddress
*g_socket_connection_get_local_address (GSocketConnection
*connection
,
98 GSocketAddress
*g_socket_connection_get_remote_address (GSocketConnection
*connection
,
101 GLIB_AVAILABLE_IN_ALL
102 void g_socket_connection_factory_register_type (GType g_type
,
103 GSocketFamily family
,
106 GLIB_AVAILABLE_IN_ALL
107 GType
g_socket_connection_factory_lookup_type (GSocketFamily family
,
110 GLIB_AVAILABLE_IN_ALL
111 GSocketConnection
*g_socket_connection_factory_create_connection (GSocket
*socket
);
115 #endif /* __G_SOCKET_CONNECTION_H__ */