mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-02 16:44:18 +08:00
obexd: Add support for specific headers in obex transfer
The BIP is using the Image Handle Tag header to set the file handle to transfer.
This commit is contained in:
parent
5cd301e888
commit
8562d0e387
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user