2020-09-22 03:00:27 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2011-06-21 01:32:02 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* OBEX library with GLib integration
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GOBEX_H
|
|
|
|
#define __GOBEX_H
|
|
|
|
|
2011-07-11 04:09:02 +08:00
|
|
|
#include <stdarg.h>
|
2011-06-21 01:32:02 +08:00
|
|
|
#include <glib.h>
|
|
|
|
|
2015-03-01 16:27:37 +08:00
|
|
|
#include "gobex/gobex-defs.h"
|
|
|
|
#include "gobex/gobex-packet.h"
|
2011-06-26 06:02:48 +08:00
|
|
|
|
2011-06-27 21:54:59 +08:00
|
|
|
typedef enum {
|
|
|
|
G_OBEX_TRANSPORT_STREAM,
|
|
|
|
G_OBEX_TRANSPORT_PACKET,
|
|
|
|
} GObexTransportType;
|
|
|
|
|
2011-06-21 01:32:02 +08:00
|
|
|
typedef struct _GObex GObex;
|
2011-06-21 19:48:54 +08:00
|
|
|
|
2011-07-05 18:16:35 +08:00
|
|
|
typedef void (*GObexFunc) (GObex *obex, GError *err, gpointer user_data);
|
2011-07-01 16:25:20 +08:00
|
|
|
typedef void (*GObexRequestFunc) (GObex *obex, GObexPacket *req,
|
|
|
|
gpointer user_data);
|
2011-06-27 21:17:04 +08:00
|
|
|
typedef void (*GObexResponseFunc) (GObex *obex, GError *err, GObexPacket *rsp,
|
|
|
|
gpointer user_data);
|
2011-06-27 16:06:48 +08:00
|
|
|
|
2011-06-29 19:33:04 +08:00
|
|
|
gboolean g_obex_send(GObex *obex, GObexPacket *pkt, GError **err);
|
2011-06-27 16:06:48 +08:00
|
|
|
|
2013-05-01 13:27:56 +08:00
|
|
|
guint g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
|
2011-06-29 23:30:18 +08:00
|
|
|
GObexResponseFunc func, gpointer user_data,
|
|
|
|
GError **err);
|
2011-06-30 05:26:19 +08:00
|
|
|
gboolean g_obex_cancel_req(GObex *obex, guint req_id,
|
|
|
|
gboolean remove_callback);
|
2011-06-27 21:17:04 +08:00
|
|
|
|
2011-07-12 03:28:47 +08:00
|
|
|
gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err,
|
2016-12-03 10:06:12 +08:00
|
|
|
guint first_hdr_type, ...);
|
2011-07-11 06:07:33 +08:00
|
|
|
|
2011-07-05 18:16:35 +08:00
|
|
|
void g_obex_set_disconnect_function(GObex *obex, GObexFunc func,
|
2011-06-29 17:20:42 +08:00
|
|
|
gpointer user_data);
|
2011-07-11 15:47:34 +08:00
|
|
|
guint g_obex_add_request_function(GObex *obex, guint8 opcode,
|
2011-07-06 03:51:32 +08:00
|
|
|
GObexRequestFunc func,
|
|
|
|
gpointer user_data);
|
2011-07-11 15:47:34 +08:00
|
|
|
gboolean g_obex_remove_request_function(GObex *obex, guint id);
|
2011-07-07 19:33:42 +08:00
|
|
|
|
|
|
|
void g_obex_suspend(GObex *obex);
|
|
|
|
void g_obex_resume(GObex *obex);
|
2012-01-03 21:52:21 +08:00
|
|
|
gboolean g_obex_srm_active(GObex *obex);
|
2020-06-30 21:47:31 +08:00
|
|
|
void g_obex_drop_tx_queue(GObex *obex);
|
2011-07-07 19:33:42 +08:00
|
|
|
|
2011-07-01 17:24:33 +08:00
|
|
|
GObex *g_obex_new(GIOChannel *io, GObexTransportType transport_type,
|
|
|
|
gssize rx_mtu, gssize tx_mtu);
|
2011-06-21 01:32:02 +08:00
|
|
|
|
|
|
|
GObex *g_obex_ref(GObex *obex);
|
|
|
|
void g_obex_unref(GObex *obex);
|
|
|
|
|
2011-07-11 06:07:33 +08:00
|
|
|
/* High level client functions */
|
2011-07-04 21:21:45 +08:00
|
|
|
|
2011-07-11 04:09:02 +08:00
|
|
|
guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
|
2016-12-03 10:06:12 +08:00
|
|
|
GError **err, guint first_hdr_id, ...);
|
2011-07-05 04:32:43 +08:00
|
|
|
|
2014-03-21 18:56:08 +08:00
|
|
|
guint g_obex_disconnect(GObex *obex, GObexResponseFunc func, gpointer user_data,
|
|
|
|
GError **err);
|
|
|
|
|
2011-07-09 19:22:19 +08:00
|
|
|
guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2011-07-09 19:29:22 +08:00
|
|
|
guint g_obex_mkdir(GObex *obex, const char *path, GObexResponseFunc func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2011-07-09 19:36:05 +08:00
|
|
|
guint g_obex_delete(GObex *obex, const char *name, GObexResponseFunc func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2011-08-30 17:30:39 +08:00
|
|
|
guint g_obex_copy(GObex *obex, const char *name, const char *dest,
|
|
|
|
GObexResponseFunc func, gpointer user_data,
|
|
|
|
GError **err);
|
|
|
|
|
|
|
|
guint g_obex_move(GObex *obex, const char *name, const char *dest,
|
|
|
|
GObexResponseFunc func, gpointer user_data,
|
|
|
|
GError **err);
|
|
|
|
|
2014-08-27 22:16:06 +08:00
|
|
|
guint g_obex_abort(GObex *obex, GObexResponseFunc func, gpointer user_data,
|
|
|
|
GError **err);
|
|
|
|
|
2011-07-11 22:17:48 +08:00
|
|
|
/* Transfer related high-level functions */
|
|
|
|
|
|
|
|
guint g_obex_put_req(GObex *obex, GObexDataProducer data_func,
|
|
|
|
GObexFunc complete_func, gpointer user_data,
|
2016-12-03 10:06:12 +08:00
|
|
|
GError **err, guint first_hdr_id, ...);
|
2011-07-11 22:17:48 +08:00
|
|
|
|
2011-08-30 17:33:20 +08:00
|
|
|
guint g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
|
|
|
|
GObexDataProducer data_func, GObexFunc complete_func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2011-07-11 22:17:48 +08:00
|
|
|
guint g_obex_get_req(GObex *obex, GObexDataConsumer data_func,
|
|
|
|
GObexFunc complete_func, gpointer user_data,
|
2016-12-03 10:06:12 +08:00
|
|
|
GError **err, guint first_hdr_id, ...);
|
2011-07-11 22:17:48 +08:00
|
|
|
|
2011-08-30 17:33:20 +08:00
|
|
|
guint g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
|
|
|
|
GObexDataConsumer data_func, GObexFunc complete_func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2011-07-11 22:17:48 +08:00
|
|
|
guint g_obex_put_rsp(GObex *obex, GObexPacket *req,
|
|
|
|
GObexDataConsumer data_func, GObexFunc complete_func,
|
|
|
|
gpointer user_data, GError **err,
|
2016-12-03 10:06:12 +08:00
|
|
|
guint first_hdr_id, ...);
|
2011-07-11 22:17:48 +08:00
|
|
|
|
|
|
|
guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
|
|
|
|
GObexFunc complete_func, gpointer user_data,
|
2016-12-03 10:06:12 +08:00
|
|
|
GError **err, guint first_hdr_id, ...);
|
2011-07-11 22:17:48 +08:00
|
|
|
|
2012-01-11 21:22:02 +08:00
|
|
|
guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
|
|
|
|
GObexDataProducer data_func, GObexFunc complete_func,
|
|
|
|
gpointer user_data, GError **err);
|
|
|
|
|
2012-05-04 17:57:04 +08:00
|
|
|
gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func,
|
|
|
|
gpointer user_data);
|
2011-07-11 22:17:48 +08:00
|
|
|
|
2011-12-08 21:07:53 +08:00
|
|
|
const char *g_obex_strerror(guint8 err_code);
|
2012-02-18 23:18:57 +08:00
|
|
|
guint8 g_obex_errno_to_rsp(int err);
|
2011-12-08 21:07:53 +08:00
|
|
|
|
2011-06-21 01:32:02 +08:00
|
|
|
#endif /* __GOBEX_H */
|