From ce4de5733291b1440cb7b65dd2321f16fd994374 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 20 Aug 2018 17:47:18 +0200 Subject: [PATCH] goep_client: add goep_client_add_header_application_parameters --- src/classic/goep_client.c | 16 ++++++++++++---- src/classic/goep_client.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/classic/goep_client.c b/src/classic/goep_client.c index 451d16ba1..0a7278ce9 100644 --- a/src/classic/goep_client.c +++ b/src/classic/goep_client.c @@ -293,13 +293,21 @@ void goep_client_create_set_path_request(uint16_t goep_cid, uint8_t flags){ goep_client_packet_add_connection_id(goep_cid); } -void goep_client_add_header_target(uint16_t goep_cid, uint16_t length, const uint8_t * target){ +static void goep_client_add_header(uint16_t goep_cid, uint8_t header_type, uint16_t header_length, const uint8_t * header_data){ UNUSED(goep_cid); uint8_t header[3]; - header[0] = OBEX_HEADER_TARGET; - big_endian_store_16(header, 1, 1 + 2 + length); + header[0] = header_type; + big_endian_store_16(header, 1, 1 + 2 + header_length); goep_client_packet_append(&header[0], sizeof(header)); - goep_client_packet_append(target, length); + goep_client_packet_append(header_data, header_length); +} + +void goep_client_add_header_target(uint16_t goep_cid, uint16_t length, const uint8_t * target){ + goep_client_add_header(goep_cid, OBEX_HEADER_TARGET, length, target); +} + +void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t length, const uint8_t * data){ + goep_client_add_header(goep_cid, OBEX_HEADER_APPLICATION_PARAMETERS, length, data); } void goep_client_add_header_name(uint16_t goep_cid, const char * name){ diff --git a/src/classic/goep_client.h b/src/classic/goep_client.h index b89120ed6..26f56f86c 100644 --- a/src/classic/goep_client.h +++ b/src/classic/goep_client.h @@ -157,7 +157,7 @@ void goep_client_add_header_count(uint16_t goep_cid, uint32_t count); * @param lenght of application parameters * @param daa */ -void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t length, uint8_t * data); +void goep_client_add_header_application_parameters(uint16_t goep_cid, uint16_t length, const uint8_t * data); // int goep_client_add_body_static(uint16_t goep_cid, uint32_t length, uint8_t * data); // int goep_client_add_body_dynamic(uint16_t goep_cid, uint32_t length, void (*data_callback)(uint32_t offset, uint8_t * buffer, uint32_t len));