Diff between e12802a76b6a26d7556be8392aa9af75b8e983c5 and 003421aed298c52eacd5e58c120f877df5462ea0

Changed Files

File Additions Deletions Status
gobex/gobex-packet.c +46 -0 modified
gobex/gobex-packet.h +6 -0 modified

Full Patch

diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 8303456..5765c8b 100644
--- a/gobex/gobex-packet.c
+++ b/gobex/gobex-packet.c
@@ -121,6 +121,52 @@ gboolean g_obex_packet_add_body(GObexPacket *pkt, GObexDataProducer func,
 	return TRUE;
 }
 
+gboolean g_obex_packet_add_unicode(GObexPacket *pkt, guint8 id,
+							const char *str)
+{
+	GObexHeader *hdr;
+
+	hdr = g_obex_header_new_unicode(id, str);
+	if (hdr == NULL)
+		return FALSE;
+
+	return g_obex_packet_add_header(pkt, hdr);
+}
+
+gboolean g_obex_packet_add_bytes(GObexPacket *pkt, guint8 id,
+						const void *data, gsize len)
+{
+	GObexHeader *hdr;
+
+	hdr = g_obex_header_new_bytes(id, data, len);
+	if (hdr == NULL)
+		return FALSE;
+
+	return g_obex_packet_add_header(pkt, hdr);
+}
+
+gboolean g_obex_packet_add_uint8(GObexPacket *pkt, guint8 id, guint8 val)
+{
+	GObexHeader *hdr;
+
+	hdr = g_obex_header_new_uint8(id, val);
+	if (hdr == NULL)
+		return FALSE;
+
+	return g_obex_packet_add_header(pkt, hdr);
+}
+
+gboolean g_obex_packet_add_uint32(GObexPacket *pkt, guint8 id, guint32 val)
+{
+	GObexHeader *hdr;
+
+	hdr = g_obex_header_new_uint32(id, val);
+	if (hdr == NULL)
+		return FALSE;
+
+	return g_obex_packet_add_header(pkt, hdr);
+}
+
 const void *g_obex_packet_get_data(GObexPacket *pkt, gsize *len)
 {
 	if (pkt->data_len == 0) {
diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h
index ff6dcd2..6bdfcf0 100644
--- a/gobex/gobex-packet.h
+++ b/gobex/gobex-packet.h
@@ -89,6 +89,12 @@ gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header);
 gboolean g_obex_packet_add_header(GObexPacket *pkt, GObexHeader *header);
 gboolean g_obex_packet_add_body(GObexPacket *pkt, GObexDataProducer func,
 							gpointer user_data);
+gboolean g_obex_packet_add_unicode(GObexPacket *pkt, guint8 id,
+							const char *str);
+gboolean g_obex_packet_add_bytes(GObexPacket *pkt, guint8 id,
+						const void *data, gsize len);
+gboolean g_obex_packet_add_uint8(GObexPacket *pkt, guint8 id, guint8 val);
+gboolean g_obex_packet_add_uint32(GObexPacket *pkt, guint8 id, guint32 val);
 gboolean g_obex_packet_set_data(GObexPacket *pkt, const void *data, gsize len,
 						GObexDataPolicy data_policy);
 const void *g_obex_packet_get_data(GObexPacket *pkt, gsize *len);