sync

Backup service to store encrypted wallet databases (experimental)
Log | Files | Refs | Submodules | README | LICENSE

sync-httpd_backup.h (2534B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2014, 2015, 2016 GNUnet e.V.
      4 
      5   TALER is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file sync-httpd_backup.h
     18  * @brief functions to handle incoming requests on /backup/
     19  * @author Christian Grothoff
     20  */
     21 #ifndef SYNC_HTTPD_BACKUP_H
     22 #define SYNC_HTTPD_BACKUP_H
     23 #include <microhttpd.h>
     24 
     25 /**
     26  * Service is shutting down, resume all MHD connections NOW.
     27  */
     28 void
     29 SH_resume_all_bc (void);
     30 
     31 
     32 /**
     33  * Return the current backup of @a account on @a connection
     34  * using @a default_http_status on success.
     35  *
     36  * @param connection MHD connection to use
     37  * @param account account to query
     38  * @param default_http_status HTTP status to queue response
     39  *  with on success (#MHD_HTTP_OK or #MHD_HTTP_CONFLICT)
     40  * @return MHD result code
     41  */
     42 enum MHD_Result
     43 SH_return_backup (struct MHD_Connection *connection,
     44                   const struct SYNC_AccountPublicKeyP *account,
     45                   unsigned int default_http_status);
     46 
     47 
     48 /**
     49  * Handle request on @a connection for retrieval of the latest
     50  * backup of @a account.
     51  *
     52  * @param connection the MHD connection to handle
     53  * @param account public key of the account the request is for
     54  * @return MHD result code
     55  */
     56 enum MHD_Result
     57 SH_backup_get (struct MHD_Connection *connection,
     58                const struct SYNC_AccountPublicKeyP *account);
     59 
     60 
     61 /**
     62  * Handle POST /backup requests.
     63  *
     64  * @param connection the MHD connection to handle
     65  * @param[in,out] con_cls the connection's closure (can be updated)
     66  * @param account public key of the account the request is for
     67  * @param upload_data upload data
     68  * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
     69  * @return MHD result code
     70  */
     71 enum MHD_Result
     72 SH_backup_post (struct MHD_Connection *connection,
     73                 void **con_cls,
     74                 const struct SYNC_AccountPublicKeyP *account,
     75                 const char *upload_data,
     76                 size_t *upload_data_size);
     77 
     78 
     79 #endif