summaryrefslogtreecommitdiff
path: root/daemon/gvfsafpserver.h
blob: 0688ff10afdb16b3c2f731e0c382951eb7660020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 /* GIO - GLib Input, Output and Streaming Library
 * 
 * Copyright (C) Carl-Anton Ingmarsson 2011 <ca.ingmarsson@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
 */

#ifndef _GVFSAFPSERVER_H_
#define _GVFSAFPSERVER_H_

#include <gio/gio.h>

#include "gmountsource.h"
#include "gvfsafpconnection.h"

G_BEGIN_DECLS

typedef enum
{
  AFP_VERSION_INVALID,
  AFP_VERSION_3_0,
  AFP_VERSION_3_1,
  AFP_VERSION_3_2,
  AFP_VERSION_3_3
} AfpVersion;

#define G_VFS_TYPE_AFP_SERVER             (g_vfs_afp_server_get_type ())
#define G_VFS_AFP_SERVER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_VFS_TYPE_AFP_SERVER, GVfsAfpServer))
#define G_VFS_AFP_SERVER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), G_VFS_TYPE_AFP_SERVER, GVfsAfpServerClass))
#define G_VFS_IS_AFP_SERVER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_VFS_TYPE_AFP_SERVER))
#define G_VFS_IS_AFP_SERVER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), G_VFS_TYPE_AFP_SERVER))
#define G_VFS_AFP_SERVER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), G_VFS_TYPE_AFP_SERVER, GVfsAfpServerClass))

typedef struct _GVfsAfpServerClass GVfsAfpServerClass;
typedef struct _GVfsAfpServer GVfsAfpServer;

struct _GVfsAfpServerClass
{
  GObjectClass parent_class;
};

struct _GVfsAfpServer
{
  GObject parent_instance;

  GNetworkAddress     *addr;
  GVfsAfpConnection   *conn;

  guint16             flags;
  char                *machine_type;
  char                *server_name;
  char                *utf8_server_name;
  GSList              *uams;
  AfpVersion          version;

  gint32              time_diff;
};

GType              g_vfs_afp_server_get_type             (void) G_GNUC_CONST;

GVfsAfpServer*     g_vfs_afp_server_new                  (GNetworkAddress *addr);

gboolean           g_vfs_afp_server_login                (GVfsAfpServer *afp_serv,
                                                          const char     *initial_user,
                                                          GMountSource   *mount_source,
                                                          char           **logged_in_user,
                                                          GCancellable   *cancellable,
                                                          GError         **error);

gint64             g_vfs_afp_server_time_to_local_time   (GVfsAfpServer *afp_serv,
                                                          gint32         server_time);

void               g_vfs_afp_server_get_vol_parms        (GVfsAfpServer       *server,
                                                          guint16              volume_id,
                                                          guint16              vol_bitmap,
                                                          GCancellable        *cancellable,
                                                          GAsyncReadyCallback  callback,
                                                          gpointer             user_data);
GFileInfo *        g_vfs_afp_server_get_vol_parms_finish (GVfsAfpServer       *server,
                                                          GAsyncResult        *result,
                                                          GError             **error);

typedef struct _GVfsAfpVolumeData GVfsAfpVolumeData;
struct _GVfsAfpVolumeData
{
  char *name;
  guint16 flags;
};

void               g_vfs_afp_server_get_volumes          (GVfsAfpServer       *server,
                                                          GCancellable        *cancellable,
                                                          GAsyncReadyCallback  callback,
                                                          gpointer             user_data);
GPtrArray *        g_vfs_afp_server_get_volumes_finish   (GVfsAfpServer  *server,
                                                          GAsyncResult   *result,
                                                          GError         **error);

G_END_DECLS

#endif /* _GVFSAFPSERVER_H_ */