public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v3 4/9] obexd: Add support for specific headers in obex transfer
Date: Mon, 16 Sep 2024 15:28:08 +0200	[thread overview]
Message-ID: <20240916132813.165731-5-frederic.danis@collabora.com> (raw)
In-Reply-To: <20240916132813.165731-1-frederic.danis@collabora.com>

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


  parent reply	other threads:[~2024-09-16 13:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16 13:28 [PATCH BlueZ v3 0/9] Add BIP for AVRCP covert art OBEX client Frédéric Danis
2024-09-16 13:28 ` [PATCH BlueZ v3 1/9] obexd: Add PSM support to session create Frédéric Danis
2024-09-16 18:47   ` Add BIP for AVRCP covert art OBEX client bluez.test.bot
2024-09-16 13:28 ` [PATCH BlueZ v3 2/9] player: Add OBEX PSM port for cover art support Frédéric Danis
2024-09-16 13:28 ` [PATCH BlueZ v3 3/9] player: Add image handle support property Frédéric Danis
2024-09-16 13:28 ` Frédéric Danis [this message]
2024-09-16 13:28 ` [PATCH BlueZ v3 5/9] obexd: Add BIP client for AVRCP cover art download Frédéric Danis
2024-09-16 17:27   ` Luiz Augusto von Dentz
2024-09-16 13:28 ` [PATCH BlueZ v3 6/9] obexd: Add GetImageProperties to bip-avrcp Frédéric Danis
2024-09-16 13:28 ` [PATCH BlueZ v3 7/9] obexd: Add GetImage " Frédéric Danis
2024-09-16 13:28 ` [PATCH BlueZ v3 8/9] avrcp: Update controller SDP record with cover art support Frédéric Danis
2024-09-16 13:28 ` [PATCH BlueZ v3 9/9] doc: Add description of org.bluez.obex.BipAvrcp Frédéric Danis
2024-09-16 17:40   ` Luiz Augusto von Dentz
2024-09-16 17:50 ` [PATCH BlueZ v3 0/9] Add BIP for AVRCP covert art OBEX client patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240916132813.165731-5-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox