util.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. *
  4. * OBEX library with GLib integration
  5. *
  6. * Copyright (C) 2011 Intel Corporation. All rights reserved.
  7. *
  8. */
  9. #define TEST_BUF_MAX 5
  10. enum {
  11. TEST_ERROR_TIMEOUT,
  12. TEST_ERROR_UNEXPECTED,
  13. };
  14. struct test_buf {
  15. const void *data;
  16. gssize len;
  17. };
  18. struct test_data {
  19. guint count;
  20. GError *err;
  21. struct test_buf recv[TEST_BUF_MAX];
  22. struct test_buf send[TEST_BUF_MAX];
  23. guint provide_delay;
  24. GObex *obex;
  25. guint id;
  26. gsize total;
  27. guint timer_id;
  28. guint io_id;
  29. GMainLoop *mainloop;
  30. };
  31. #define TEST_ERROR test_error_quark()
  32. GQuark test_error_quark(void);
  33. void dump_bufs(const void *mem1, size_t len1, const void *mem2, size_t len2);
  34. void assert_memequal(const void *mem1, size_t len1,
  35. const void *mem2, size_t len2);
  36. GObex *create_gobex(int fd, GObexTransportType transport_type,
  37. gboolean close_on_unref);
  38. void create_endpoints(GObex **obex, GIOChannel **io, int sock_type);
  39. gboolean test_io_cb(GIOChannel *io, GIOCondition cond, gpointer user_data);
  40. gboolean test_timeout(gpointer user_data);