configure.ac: Don't allow UNIX IPC to be configured for a native Windows build.
[mpd-mk.git] / src / archive_plugin.h
blobb08c93389bb218fe3f574bf64afb815e796149ca
1 /*
2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MPD_ARCHIVE_PLUGIN_H
21 #define MPD_ARCHIVE_PLUGIN_H
23 #include <glib.h>
25 #include <stdbool.h>
27 struct input_stream;
28 struct archive_file;
30 struct archive_plugin {
31 const char *name;
33 /**
34 * optional, set this to NULL if the archive plugin doesn't
35 * have/need one this must false if there is an error and
36 * true otherwise
38 bool (*init)(void);
40 /**
41 * optional, set this to NULL if the archive plugin doesn't
42 * have/need one
44 void (*finish)(void);
46 /**
47 * tryes to open archive file and associates handle with archive
48 * returns pointer to handle used is all operations with this archive
49 * or NULL when opening fails
51 struct archive_file *(*open)(const char *path_fs, GError **error_r);
53 /**
54 * reset routine will move current read index in archive to default
55 * position and then the filenames from archives can be read
56 * via scan_next routine
58 void (*scan_reset)(struct archive_file *);
60 /**
61 * the read method will return corresponding files from archive
62 * (as pathnames) and move read index to next file. When there is no
63 * next file it return NULL.
65 char *(*scan_next)(struct archive_file *);
67 /**
68 * Opens an input_stream of a file within the archive.
70 * @param path the path within the archive
71 * @param error_r location to store the error occuring, or
72 * NULL to ignore errors
74 struct input_stream *(*open_stream)(struct archive_file *af,
75 const char *path,
76 GError **error_r);
78 /**
79 * closes archive file.
81 void (*close)(struct archive_file *);
83 /**
84 * suffixes handled by this plugin.
85 * last element in these arrays must always be a NULL
87 const char *const*suffixes;
90 struct archive_file *
91 archive_file_open(const struct archive_plugin *plugin, const char *path,
92 GError **error_r);
94 void
95 archive_file_close(struct archive_file *file);
97 void
98 archive_file_scan_reset(struct archive_file *file);
100 char *
101 archive_file_scan_next(struct archive_file *file);
103 struct input_stream *
104 archive_file_open_stream(struct archive_file *file,
105 const char *path, GError **error_r);
107 #endif