Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / obexd / src / mimetype.h
1 /*
2  *
3  *  OBEX Server
4  *
5  *  Copyright (C) 2007-2010  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 typedef gboolean (*obex_object_io_func) (void *object, int flags, int err,
25                                                         void *user_data);
26
27 struct obex_mime_type_driver {
28         const uint8_t *target;
29         unsigned int target_size;
30         const char *mimetype;
31         const uint8_t *who;
32         unsigned int who_size;
33         void *(*open) (const char *name, int oflag, mode_t mode,
34                         void *driver_data, size_t *size, int *err);
35         int (*close) (void *object);
36         ssize_t (*get_next_header)(void *object, void *buf, size_t mtu,
37                                                                 uint8_t *hi);
38         ssize_t (*read) (void *object, void *buf, size_t count);
39         ssize_t (*write) (void *object, const void *buf, size_t count);
40         int (*flush) (void *object);
41         int (*copy) (const char *name, const char *destname);
42         int (*move) (const char *name, const char *destname);
43         int (*remove) (const char *name);
44         int (*set_io_watch) (void *object, obex_object_io_func func,
45                                 void *user_data);
46 };
47
48 int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
49 void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);
50 struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
51                                 unsigned int target_size,
52                                 const char *mimetype, const uint8_t *who,
53                                 unsigned int who_size);
54
55 void obex_object_set_io_flags(void *object, int flags, int err);