upgrade obexd to 0.47
[profile/ivi/obexd.git] / unit / util.h
1 /*
2  *
3  *  OBEX library with GLib integration
4  *
5  *  Copyright (C) 2011  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #include <gobex/gobex.h>
23
24 enum {
25         TEST_ERROR_TIMEOUT,
26         TEST_ERROR_UNEXPECTED,
27 };
28
29 struct test_buf {
30         const void *data;
31         gssize len;
32 };
33
34 struct test_data {
35         guint count;
36         GError *err;
37         struct test_buf recv[4];
38         struct test_buf send[4];
39         guint provide_delay;
40         GObex *obex;
41         guint id;
42         gsize total;
43         GMainLoop *mainloop;
44 };
45
46 #define TEST_ERROR test_error_quark()
47 GQuark test_error_quark(void);
48
49 void dump_bufs(const void *mem1, size_t len1, const void *mem2, size_t len2);
50 void assert_memequal(const void *mem1, size_t len1,
51                                                 const void *mem2, size_t len2);
52
53 GObex *create_gobex(int fd, GObexTransportType transport_type,
54                                                 gboolean close_on_unref);
55 void create_endpoints(GObex **obex, GIOChannel **io, int sock_type);
56
57 gboolean test_io_cb(GIOChannel *io, GIOCondition cond, gpointer user_data);
58 gboolean test_timeout(gpointer user_data);