gobex: Add a simple g_obex_request_add_header implementation

This commit is contained in:
Johan Hedberg 2011-06-22 11:17:42 +03:00 committed by Marcel Holtmann
parent 4e4246a90a
commit eed615f8b3
2 changed files with 11 additions and 0 deletions

View File

@ -156,6 +156,13 @@ void g_obex_header_free(GObexHeader *header)
g_free(header);
}
gboolean g_obex_request_add_header(GObexRequest *req, GObexHeader *header)
{
req->headers = g_slist_append(req->headers, header);
return TRUE;
}
GObexRequest *g_obex_request_new(uint8_t opcode)
{
GObexRequest *req;
@ -169,6 +176,8 @@ GObexRequest *g_obex_request_new(uint8_t opcode)
void g_obex_request_free(GObexRequest *req)
{
g_slist_foreach(req->headers, (GFunc) g_obex_header_free, NULL);
g_slist_free(req->headers);
g_free(req);
}

View File

@ -70,6 +70,8 @@ GObexHeader *g_obex_header_parse(const void *data, size_t len,
gboolean copy, size_t *parsed);
void g_obex_header_free(GObexHeader *header);
gboolean g_obex_request_add_header(GObexRequest *req, GObexHeader *header);
GObexRequest *g_obex_request_new(uint8_t opcode);
void g_obex_request_free(GObexRequest *req);