[PATCH BlueZ v3 4/9] obexd: Add support for specific headers in obex transfer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The BIP is using the Image Handle Tag header to set the file handle
to transfer.
---
 obexd/client/transfer.c | 19 +++++++++++++++++++
 obexd/client/transfer.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index a7a85a0c0..879d67d58 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -57,6 +57,7 @@ struct obc_transfer {
 	GObex *obex;
 	uint8_t status;
 	GObexApparam *apparam;
+	GSList *headers;
 	guint8 op;
 	struct transfer_callback *callback;
 	DBusConnection *conn;
@@ -400,6 +401,11 @@ static const GDBusPropertyTable obc_transfer_properties[] = {
 	{ }
 };
 
+static void header_free(void *data, void *user_data)
+{
+	g_obex_header_free(data);
+}
+
 static void obc_transfer_free(struct obc_transfer *transfer)
 {
 	DBG("%p", transfer);
@@ -441,6 +447,8 @@ static void obc_transfer_free(struct obc_transfer *transfer)
 	if (transfer->obex)
 		g_obex_unref(transfer->obex);
 
+	g_slist_foreach(transfer->headers, header_free, NULL);
+	g_slist_free(transfer->headers);
 	g_free(transfer->callback);
 	g_free(transfer->owner);
 	g_free(transfer->filename);
@@ -820,6 +828,12 @@ static gboolean transfer_start_get(struct obc_transfer *transfer, GError **err)
 		g_obex_packet_add_bytes(req, G_OBEX_HDR_TYPE, transfer->type,
 						strlen(transfer->type) + 1);
 
+	while (transfer->headers) {
+		hdr = transfer->headers->data;
+		g_obex_packet_add_header(req, hdr);
+		transfer->headers = g_slist_remove(transfer->headers, hdr);
+	}
+
 	if (transfer->apparam != NULL) {
 		hdr = g_obex_header_new_apparam(transfer->apparam);
 		g_obex_packet_add_header(req, hdr);
@@ -974,3 +988,8 @@ gint64 obc_transfer_get_size(struct obc_transfer *transfer)
 {
 	return transfer->size;
 }
+
+void obc_transfer_add_header(struct obc_transfer *transfer, void *data)
+{
+	transfer->headers = g_slist_append(transfer->headers, data);
+}
diff --git a/obexd/client/transfer.h b/obexd/client/transfer.h
index 323332a62..1ed195984 100644
--- a/obexd/client/transfer.h
+++ b/obexd/client/transfer.h
@@ -47,3 +47,5 @@ gint64 obc_transfer_get_size(struct obc_transfer *transfer);
 
 DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer,
 							DBusMessage *message);
+
+void obc_transfer_add_header(struct obc_transfer *transfer, void *data);
-- 
2.34.1





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux