1 /* GIO - GLib Input, Output and Streaming Library 2 * 3 * Copyright (C) 2006-2007 Red Hat, Inc. 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 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, write to the 17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 * Author: Alexander Larsson <alexl@redhat.com> 21 */ 22 23 #ifndef __G_VFS_CHANNEL_H__ 24 #define __G_VFS_CHANNEL_H__ 25 26 #include <glib-object.h> 27 #include <gvfsjob.h> 28 #include <gvfsbackend.h> 29 #include <gvfsdaemonprotocol.h> 30 31 G_BEGIN_DECLS 32 33 #define G_VFS_TYPE_CHANNEL (g_vfs_channel_get_type ()) 34 #define G_VFS_CHANNEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_CHANNEL, GVfsChannel)) 35 #define G_VFS_CHANNEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_CHANNEL, GVfsChannelClass)) 36 #define G_VFS_IS_CHANNEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_CHANNEL)) 37 #define G_VFS_IS_CHANNEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_CHANNEL)) 38 #define G_VFS_CHANNEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_CHANNEL, GVfsChannelClass)) 39 40 typedef struct _GVfsChannel GVfsChannel; 41 typedef struct _GVfsChannelClass GVfsChannelClass; 42 typedef struct _GVfsChannelPrivate GVfsChannelPrivate; 43 44 struct _GVfsChannel 45 { 46 GObject parent_instance; 47 48 GVfsChannelPrivate *priv; 49 }; 50 51 struct _GVfsChannelClass 52 { 53 GObjectClass parent_class; 54 55 GVfsJob *(*close) (GVfsChannel *channel); 56 GVfsJob *(*handle_request) (GVfsChannel *channel, 57 guint32 command, 58 guint32 seq_nr, 59 guint32 arg1, 60 guint32 arg2, 61 gpointer data, 62 gsize data_len, 63 GError **error); 64 GVfsJob *(*readahead) (GVfsChannel *channel, 65 GVfsJob *job); 66 }; 67 68 GType g_vfs_channel_get_type (void) G_GNUC_CONST; 69 70 int g_vfs_channel_steal_remote_fd (GVfsChannel *channel); 71 GVfsBackend * g_vfs_channel_get_backend (GVfsChannel *channel); 72 GVfsBackendHandle g_vfs_channel_get_backend_handle (GVfsChannel *channel); 73 void g_vfs_channel_set_backend_handle (GVfsChannel *channel, 74 GVfsBackendHandle backend_handle); 75 gboolean g_vfs_channel_has_job (GVfsChannel *channel); 76 GVfsJob * g_vfs_channel_get_job (GVfsChannel *channel); 77 void g_vfs_channel_send_error (GVfsChannel *channel, 78 GError *error); 79 void g_vfs_channel_send_info (GVfsChannel *channel, 80 GFileInfo *info); 81 void g_vfs_channel_send_reply (GVfsChannel *channel, 82 GVfsDaemonSocketProtocolReply *reply, 83 const void *data, 84 gsize data_len); 85 void g_vfs_channel_send_reply_take (GVfsChannel *channel, 86 GVfsDaemonSocketProtocolReply *reply, 87 void *data, 88 gsize data_len); 89 guint32 g_vfs_channel_get_current_seq_nr (GVfsChannel *channel); 90 GPid g_vfs_channel_get_actual_consumer (GVfsChannel *channel); 91 void g_vfs_channel_force_close (GVfsChannel *channel); 92 /* TODO: i/o priority? */ 93 94 G_END_DECLS 95 96 #endif /* __G_VFS_CHANNEL_H__ */ 97