All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Adamek <adamek.kuba@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jakub Adamek <adamek.kuba@gmail.com>
Subject: [PATCH obexd v2 07/11] Add functions for async requests w a_header list
Date: Wed, 22 Jun 2011 00:24:21 +0200	[thread overview]
Message-ID: <1308695065-3784-8-git-send-email-adamek.kuba@gmail.com> (raw)
In-Reply-To: <1308695065-3784-1-git-send-email-adamek.kuba@gmail.com>

These are to be used by client for performing async get or put
operations with sending additional headers.
---
 gwobex/gw-obex.h   |   32 ++++++++++++++++++++++++++++++++
 gwobex/obex-xfer.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/gwobex/gw-obex.h b/gwobex/gw-obex.h
index 0638f45..238d695 100644
--- a/gwobex/gw-obex.h
+++ b/gwobex/gw-obex.h
@@ -510,6 +510,24 @@ gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
 GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
                               gint size, time_t time, gint *error);
 
+/** Start a PUT operation asynchronously with additional headers
+ *
+ * @param ctx   Pointer returned by gw_obex_setup()
+ * @param name  Name of the object (null terminated UTF-8)
+ * @param type  Type of the object (null terminated UTF-8), or NULL
+ * @param apparam      Application parameters of the object
+ * @param apparam_size Application paramters' size
+ * @param aheaders      List of additional headers
+ * @param size  Size of the object (GW_OBEX_UNKNOWN_LENGTH if not known)
+ * @param time  Last modification time of the object (-1 if not known)
+ * @param error Place to store error code on failure (NULL if not interested)
+ *
+ * @returns a new GwObexXfer object on success, NULL on failure
+ */
+GwObexXfer *gw_obex_put_async_with_aheaders(GwObex *ctx, const char *name, const char *type,
+                              const guint8 *apparam, gint apparam_size,
+                              const GSList *aheaders,
+                              gint size, time_t time, gint *error);
 
 /** Start a GET operation asynchronously
  *
@@ -537,6 +555,20 @@ GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, g
 GwObexXfer *gw_obex_get_async_with_apparam(GwObex *ctx, const char *name, const char *type,
 		const guint8  *apparam, gint apparam_size, gint *error);
 
+/** Start a GET operation asynchronously with additional headers
+ *
+ * @param ctx   Pointer returned by gw_obex_setup()
+ * @param name  Name of the object (null terminated UTF-8)
+ * @param type  Type of the object (null terminated UTF-8), or NULL
+ * @param aheaders      List of additional headers
+ * @param error Place to store error code on failure (NULL if not interested)
+ *
+ * @returns a new GwObexXfer object on success, NULL on failure
+ */
+
+GwObexXfer *gw_obex_get_async_with_aheaders(GwObex *ctx, const char *name, const char *type,
+        const guint8 *apparam, gint apparam_size,
+        const GSList *aheaders, gint *error);
 
 /** Set a callback function for a GwObexXfer object
  * The callback function will be called in the following situations:
diff --git a/gwobex/obex-xfer.c b/gwobex/obex-xfer.c
index 55ea842..fc85fbf 100644
--- a/gwobex/obex-xfer.c
+++ b/gwobex/obex-xfer.c
@@ -124,6 +124,20 @@ GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
     return ret ? ctx->xfer : NULL;
 }
 
+GwObexXfer *gw_obex_put_async_with_aheaders(GwObex *ctx, const char *name,
+        const char *type, const guint8 *apparam, gint apparam_size,
+        const GSList *aheaders, gint size, time_t time, gint *error) {
+    gboolean ret;
+    GW_OBEX_LOCK(ctx);
+    CHECK_DISCONNECT(NULL, error, ctx);
+    ret = gw_obex_put_with_aheaders(ctx, NULL, name, type, apparam, apparam_size,
+                                    aheaders, NULL, size, time, -1, TRUE);
+    if (ret == FALSE)
+        gw_obex_get_error(ctx, error);
+    GW_OBEX_UNLOCK(ctx);
+    return ret ? ctx->xfer : NULL;
+}
+
 GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error) {
     gboolean ret;
     GW_OBEX_LOCK(ctx);
@@ -147,6 +161,20 @@ GwObexXfer *gw_obex_get_async_with_apparam(GwObex *ctx, const char *name, const
     return ret ? ctx->xfer : NULL;
 }
 
+GwObexXfer *gw_obex_get_async_with_aheaders(GwObex *ctx, const char *name,
+        const char *type, const guint8 *apparam, gint apparam_size,
+        const GSList *aheaders, gint *error) {
+    gboolean ret;
+    GW_OBEX_LOCK(ctx);
+    CHECK_DISCONNECT(NULL, error, ctx);
+    ret = gw_obex_get_with_aheaders(ctx, NULL, name, type, apparam, apparam_size,
+                                    aheaders, NULL, NULL, -1, TRUE);
+    if (ret == FALSE)
+        gw_obex_get_error(ctx, error);
+    GW_OBEX_UNLOCK(ctx);
+    return ret ? ctx->xfer : NULL;
+}
+
 static gboolean gw_obex_put_idle(GwObexXfer *xfer) {
     struct gw_obex *ctx = xfer->ctx;
 
-- 
1.7.0.4


  parent reply	other threads:[~2011-06-21 22:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 22:24 [PATCH obexd v2 00/11] Support user defined headers in gwobex Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 01/11] Add a_header struct for additional header data Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 02/11] Add list to store received headers Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 03/11] Add function to create fresh a_header Jakub Adamek
2011-06-22  7:05   ` Luiz Augusto von Dentz
2011-06-21 22:24 ` [PATCH obexd v2 04/11] Store received headers in gw_obex_xfer object Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 05/11] Add functions to get, put w. a_header list Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 06/11] Parse headers in a PUT response packet Jakub Adamek
2011-06-21 22:24 ` Jakub Adamek [this message]
2011-06-21 22:24 ` [PATCH obexd v2 08/11] Reorder headers to conform to BIP's requirements Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 09/11] Handle partial content response from server Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 10/11] Convenience method to make deep copy of a_header Jakub Adamek
2011-06-21 22:24 ` [PATCH obexd v2 11/11] Add func for fetching header by id from list Jakub Adamek
2011-06-22  7:33 ` [PATCH obexd v2 00/11] Support user defined headers in gwobex Luiz Augusto von Dentz
2011-06-22  7:35   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308695065-3784-8-git-send-email-adamek.kuba@gmail.com \
    --to=adamek.kuba@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.