Line data Source code
1 : /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 : /*
3 : * backend.c
4 : * This file is part of "Sauvegarde" project.
5 : *
6 : * (C) Copyright 2015 - 2016 Olivier Delhomme
7 : * e-mail : olivier.delhomme@free.fr
8 : *
9 : * "Sauvegarde" is free software: you can redistribute it and/or modify
10 : * it under the terms of the GNU General Public License as published by
11 : * the Free Software Foundation, either version 3 of the License, or
12 : * (at your option) any later version.
13 : *
14 : * "Sauvegarde" is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with "Sauvegarde". If not, see <http://www.gnu.org/licenses/>
21 : */
22 : /**
23 : * @file server/backend.c
24 : *
25 : * This file contains all the functions for the backend management of
26 : * cdpfglserver's server.
27 : */
28 :
29 : #include "server.h"
30 :
31 :
32 : /**
33 : * Inits the backend with the correct functions
34 : * @todo write some backends !
35 : * @param store_smeta a function to store server_meta_data_t structure
36 : * @param store_data a function to store data
37 : * @param init_backend a function to init the backend
38 : * @param build_needed_hash_list a function that must build a GSList * needed hash list
39 : * @param get_list_of_files gets the list of saved files
40 : * @param retrieve_data retrieves data from a specified hash.
41 : * @returns a newly created backend_t structure initialized to nothing !
42 : */
43 1 : backend_t *init_backend_structure(void *store_smeta, void *store_data, void *init_backend, void *build_needed_hash_list, void *get_list_of_files, void * retrieve_data)
44 : {
45 1 : backend_t *backend = NULL;
46 :
47 1 : backend = (backend_t *) g_malloc0(sizeof(backend_t));
48 :
49 1 : backend->user_data = NULL;
50 1 : backend->store_smeta = store_smeta;
51 1 : backend->store_data = store_data;
52 1 : backend->init_backend = init_backend;
53 1 : backend->build_needed_hash_list = build_needed_hash_list;
54 1 : backend->get_list_of_files = get_list_of_files;
55 1 : backend->retrieve_data = retrieve_data;
56 :
57 1 : return backend;
58 : }
59 :
60 :
|