[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-sync] branch master updated: lib skeleton
From: |
gnunet |
Subject: |
[taler-sync] branch master updated: lib skeleton |
Date: |
Sun, 24 Nov 2019 17:44:09 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository sync.
The following commit(s) were added to refs/heads/master by this push:
new c4b5ac2 lib skeleton
c4b5ac2 is described below
commit c4b5ac29367dd1d845c19851504784bdbdbc1fd5
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Nov 24 17:44:06 2019 +0100
lib skeleton
---
src/include/sync_service.h | 3 +
src/lib/Makefile.am | 3 +-
src/lib/{sync_api_upload.c => sync_api_download.c} | 56 ++++++++++++++--
src/lib/sync_api_upload.c | 74 +++++++++++++++++++++-
src/sync/sync-httpd.c | 1 -
5 files changed, 127 insertions(+), 10 deletions(-)
diff --git a/src/include/sync_service.h b/src/include/sync_service.h
index 627be51..47dfdb4 100644
--- a/src/include/sync_service.h
+++ b/src/include/sync_service.h
@@ -318,4 +318,7 @@ void
SYNC_download_cancel (struct SYNC_DownloadOperation *download);
+/* TODO: API for /terms! */
+
+
#endif /* SYNC_SERVICE_H */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 5f05c26..b1b1d92 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -14,7 +14,8 @@ libsync_la_LDFLAGS = \
-no-undefined
libsync_la_SOURCES = \
- sync_api_upload.c
+ sync_api_download.c \
+ sync_api_upload.c
libsync_la_LIBADD = \
-lgnunetcurl \
diff --git a/src/lib/sync_api_upload.c b/src/lib/sync_api_download.c
similarity index 51%
copy from src/lib/sync_api_upload.c
copy to src/lib/sync_api_download.c
index b09b01d..e9780e1 100644
--- a/src/lib/sync_api_upload.c
+++ b/src/lib/sync_api_download.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 GNUnet e.V. and INRIA
+ Copyright (C) 2014-2019 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -18,8 +18,8 @@
*/
/**
- * @file lib/sync_api_upload.c
- * @brief Implementation of the upload POST
+ * @file lib/sync_api_download.c
+ * @brief Implementation of the download
* @author Christian Grothoff
*/
#include "platform.h"
@@ -32,9 +32,9 @@
/**
- * @brief
+ * @brief Handle for a download operation.
*/
-struct SYNC_UploadOperation
+struct SYNC_DownloadOperation
{
/**
@@ -52,6 +52,50 @@ struct SYNC_UploadOperation
*/
struct GNUNET_CURL_Context *ctx;
+ /**
+ * Function to call with the result.
+ */
+ SYNC_DownloadCallback cb;
+
+ /**
+ * Closure for @e cb.
+ */
+ void *cb_cls;
+
};
-/* end of sync_api_upload.c */
+
+/**
+ * Download the latest version of a backup for account @a pub.
+ *
+ * @param ctx for HTTP client request processing
+ * @param base_url base URL of the Sync server
+ * @param pub account public key
+ * @param cb function to call with the backup
+ * @param cb_cls closure for @a cb
+ * @return handle for the operation
+ */
+struct SYNC_DownloadOperation *
+SYNC_download (struct GNUNET_CURL_Context *ctx,
+ const char *base_url,
+ const struct SYNC_AccountPublicKeyP *pub,
+ SYNC_DownloadCallback cb,
+ void *cb_cls)
+{
+ GNUNET_break (0);
+ return NULL;
+}
+
+
+/**
+ * Cancel the download.
+ *
+ * @param do operation to cancel.
+ */
+void
+SYNC_download_cancel (struct SYNC_DownloadOperation *download)
+{
+}
+
+
+/* end of sync_api_download.c */
diff --git a/src/lib/sync_api_upload.c b/src/lib/sync_api_upload.c
index b09b01d..84be034 100644
--- a/src/lib/sync_api_upload.c
+++ b/src/lib/sync_api_upload.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 GNUnet e.V. and INRIA
+ Copyright (C) 2014-2019 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -32,7 +32,7 @@
/**
- * @brief
+ * @brief Handle for an upload operation.
*/
struct SYNC_UploadOperation
{
@@ -52,6 +52,76 @@ struct SYNC_UploadOperation
*/
struct GNUNET_CURL_Context *ctx;
+ /**
+ * Function to call with the result.
+ */
+ SYNC_UploadCallback cb;
+
+ /**
+ * Closure for @e cb.
+ */
+ void *cb_cls;
+
};
+
+/**
+ * Upload a @a backup to a Sync server. Note that @a backup must
+ * have already been compressed, padded and encrypted by the
+ * client.
+ *
+ * While @a pub is theoretically protected by the HTTPS protocol and
+ * required to access the backup, it should be assumed that an
+ * adversary might be able to download the backups from the Sync
+ * server -- or even run the Sync server. Thus, strong encryption
+ * is essential and NOT implemented by this function.
+ *
+ * The use of Anastasis to safely store the Sync encryption keys and
+ * @a pub is recommended. Storing @a priv in Anastasis depends on
+ * your priorities: without @a priv, further updates to the backup are
+ * not possible, and the user would have to pay for another
+ * account. OTOH, without @a priv an adversary that compromised
+ * Anastasis can only read the backups, but not alter or destroy them.
+ *
+ * @param ctx for HTTP client request processing
+ * @param base_url base URL of the Sync server
+ * @param priv private key of an account with the server
+ * @param prev_backup_hash hash of the previous backup, NULL for the first
upload ever
+ * @param backup_size number of bytes in @a backup
+ * @param payment_requested #GNUNET_YES if the client wants to pay more for
the account now
+ * @param paid_order_id order ID of a recent payment made, or NULL for none
+ * @param cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return handle for the operation
+ */
+struct SYNC_UploadOperation *
+SYNC_upload (struct GNUNET_CURL_Context *ctx,
+ const char *base_url,
+ struct SYNC_AccountPrivateKeyP *priv,
+ const struct GNUNET_HashCode *prev_backup_hash,
+ size_t backup_size,
+ const void *backup,
+ int payment_requested,
+ const char *paid_order_id,
+ SYNC_UploadCallback cb,
+ void *cb_cls)
+{
+ GNUNET_break (0);
+ return NULL;
+}
+
+
+/**
+ * Cancel the upload. Note that aborting an upload does NOT guarantee
+ * that it did not complete, it is possible that the server did
+ * receive the full request before the upload is aborted.
+ *
+ * @param uo operation to cancel.
+ */
+void
+SYNC_upload_cancel (struct SYNC_UploadOperation *uo)
+{
+}
+
+
/* end of sync_api_upload.c */
diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c
index 1918d42..982a317 100644
--- a/src/sync/sync-httpd.c
+++ b/src/sync/sync-httpd.c
@@ -33,7 +33,6 @@
#define UNIX_BACKLOG 500
-
/**
* Should a "Connection: close" header be added to each HTTP response?
*/
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-sync] branch master updated: lib skeleton,
gnunet <=