diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-07-04 23:02:12 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:21:59 +0100 |
commit | 814b06ed671f35fb8480bf632cc3cd47873742f7 (patch) | |
tree | 2b8db0812c111d62656cca694292f47e715d30e6 /gobex/gobex-packet.c | |
parent | 26f20b39af69d847b4810c9f3c3078f9a5dbca34 (diff) | |
download | bluez-814b06ed671f35fb8480bf632cc3cd47873742f7.tar.gz |
gobex: Add g_obex_packet_find_header and g_obex_packet_prepend_header
Diffstat (limited to 'gobex/gobex-packet.c')
-rw-r--r-- | gobex/gobex-packet.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c index e55b20569..29a6aa2d9 100644 --- a/gobex/gobex-packet.c +++ b/gobex/gobex-packet.c @@ -64,6 +64,28 @@ guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final) return pkt->opcode; } +GObexHeader *g_obex_packet_find_header(GObexPacket *pkt, guint8 id) +{ + GSList *l; + + for (l = pkt->headers; l != NULL; l = g_slist_next(l)) { + GObexHeader *hdr = l->data; + + if (g_obex_header_get_id(hdr) == id) + return hdr; + } + + return NULL; +} + +gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header) +{ + pkt->headers = g_slist_prepend(pkt->headers, header); + pkt->hlen += g_obex_header_get_length(header); + + return TRUE; +} + gboolean g_obex_packet_add_header(GObexPacket *pkt, GObexHeader *header) { pkt->headers = g_slist_append(pkt->headers, header); |