From 5e24938677cdd556f7ece2be889b01cdf5a53e48 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 15 Nov 2011 15:27:54 +0200 Subject: Introduce obex_get_non_header_data This function remove the need of calling OBEX_ObjectGetNonHdrData in the plugins. --- src/obex-priv.h | 2 ++ src/obex.c | 10 ++++++++++ src/obex.h | 2 ++ 3 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/obex-priv.h b/src/obex-priv.h index a834511..6a439b4 100644 --- a/src/obex-priv.h +++ b/src/obex-priv.h @@ -36,6 +36,8 @@ struct obex_session { time_t time; uint8_t *apparam; size_t apparam_len; + uint8_t *nonhdr; + size_t nonhdr_len; uint8_t *buf; int64_t pending; int64_t offset; diff --git a/src/obex.c b/src/obex.c index a1621b9..3a06775 100644 --- a/src/obex.c +++ b/src/obex.c @@ -931,6 +931,8 @@ static void cmd_setpath(struct obex_session *os, break; } + os->nonhdr_len = OBEX_ObjectGetNonHdrData(obj, &os->nonhdr); + err = os->service->setpath(os, obj, os->service_data); os_set_response(obj, err); } @@ -1546,6 +1548,14 @@ ssize_t obex_get_apparam(struct obex_session *os, const uint8_t **buffer) return os->apparam_len; } +ssize_t obex_get_non_header_data(struct obex_session *os, + const uint8_t **data) +{ + *data = os->nonhdr; + + return os->nonhdr_len; +} + int memncmp0(const void *a, size_t na, const void *b, size_t nb) { if (na != nb) diff --git a/src/obex.h b/src/obex.h index 6ede0a4..3e8ce00 100644 --- a/src/obex.h +++ b/src/obex.h @@ -48,6 +48,8 @@ int obex_move(struct obex_session *os, const char *source, uint8_t obex_get_action_id(struct obex_session *os); char *obex_get_id(struct obex_session *os); ssize_t obex_get_apparam(struct obex_session *os, const uint8_t **buffer); +ssize_t obex_get_non_header_data(struct obex_session *os, + const uint8_t **data); /* Just a thin wrapper around memcmp to deal with NULL values */ int memncmp0(const void *a, size_t na, const void *b, size_t nb); -- cgit v1.2.1