| 1 | /* GIO - GLib Input, Output and Streaming Library | 
| 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 |  *          Alexander Larsson <alexl@redhat.com> | 
| 22 |  */ | 
| 23 |  | 
| 24 | #ifndef __G_SOCKET_CONNECTION_H__ | 
| 25 | #define __G_SOCKET_CONNECTION_H__ | 
| 26 |  | 
| 27 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) | 
| 28 | #error "Only <gio/gio.h> can be included directly." | 
| 29 | #endif | 
| 30 |  | 
| 31 | #include <glib-object.h> | 
| 32 | #include <gio/gsocket.h> | 
| 33 | #include <gio/giostream.h> | 
| 34 |  | 
| 35 | G_BEGIN_DECLS | 
| 36 |  | 
| 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)) | 
| 48 |  | 
| 49 | typedef struct _GSocketConnectionPrivate                    GSocketConnectionPrivate; | 
| 50 | typedef struct _GSocketConnectionClass                      GSocketConnectionClass; | 
| 51 |  | 
| 52 | struct _GSocketConnectionClass | 
| 53 | { | 
| 54 |   GIOStreamClass parent_class; | 
| 55 |  | 
| 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); | 
| 63 | }; | 
| 64 |  | 
| 65 | struct _GSocketConnection | 
| 66 | { | 
| 67 |   GIOStream parent_instance; | 
| 68 |   GSocketConnectionPrivate *priv; | 
| 69 | }; | 
| 70 |  | 
| 71 | GLIB_AVAILABLE_IN_ALL | 
| 72 | GType              g_socket_connection_get_type                  (void) G_GNUC_CONST; | 
| 73 |  | 
| 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, | 
| 80 | 								  GError            **error); | 
| 81 | GLIB_AVAILABLE_IN_2_32 | 
| 82 | void               g_socket_connection_connect_async             (GSocketConnection  *connection, | 
| 83 | 								  GSocketAddress     *address, | 
| 84 | 								  GCancellable       *cancellable, | 
| 85 | 								  GAsyncReadyCallback callback, | 
| 86 | 								  gpointer            user_data); | 
| 87 | GLIB_AVAILABLE_IN_2_32 | 
| 88 | gboolean           g_socket_connection_connect_finish            (GSocketConnection  *connection, | 
| 89 | 								  GAsyncResult       *result, | 
| 90 | 								  GError            **error); | 
| 91 |  | 
| 92 | GLIB_AVAILABLE_IN_ALL | 
| 93 | GSocket           *g_socket_connection_get_socket                (GSocketConnection  *connection); | 
| 94 | GLIB_AVAILABLE_IN_ALL | 
| 95 | GSocketAddress    *g_socket_connection_get_local_address         (GSocketConnection  *connection, | 
| 96 | 								  GError            **error); | 
| 97 | GLIB_AVAILABLE_IN_ALL | 
| 98 | GSocketAddress    *g_socket_connection_get_remote_address        (GSocketConnection  *connection, | 
| 99 | 								  GError            **error); | 
| 100 |  | 
| 101 | GLIB_AVAILABLE_IN_ALL | 
| 102 | void               g_socket_connection_factory_register_type     (GType               g_type, | 
| 103 | 								  GSocketFamily       family, | 
| 104 | 								  GSocketType         type, | 
| 105 | 								  gint                protocol); | 
| 106 | GLIB_AVAILABLE_IN_ALL | 
| 107 | GType              g_socket_connection_factory_lookup_type       (GSocketFamily       family, | 
| 108 | 								  GSocketType         type, | 
| 109 | 								  gint                protocol_id); | 
| 110 | GLIB_AVAILABLE_IN_ALL | 
| 111 | GSocketConnection *g_socket_connection_factory_create_connection (GSocket            *socket); | 
| 112 |  | 
| 113 | G_END_DECLS | 
| 114 |  | 
| 115 | #endif /* __G_SOCKET_CONNECTION_H__ */ | 
| 116 |  |