Debian Codegraph @

src/memcache.h

raw symbols SCIP
1 /*
2 * HTTPDirFS - HTTP Directory Filesystem
3 *
4 * Copyright (C) 2020-2026 Fufu Fang <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * In addition, as a special exception, the copyright holders give
20 * permission to link the code of portions of this program with the OpenSSL
21 * library.
22 */
23
24 #ifndef MEMCACHE_H
25 #define MEMCACHE_H
26 /**
27 * \file memcache.h
28 * \brief Memory cache and data transfer definitions header
29 */
30
31
32 #include <stddef.h>
33
34 typedef struct Link Link;
35 typedef struct Cache Cache;
36
37
38 /**
39 * \brief specify the type of data transfer
40 */
41 typedef enum { FILESTAT = 's', DATA = 'd' } TransferType;
42
43 /**
44 * \brief For storing transfer data and metadata
45 */
46 typedef struct TransferStruct {
47 /** \brief The array to store the data */
48 char *data;
49 /** \brief The current size of the array */
50 size_t curr_size;
51 /** \brief The type of transfer being done */
52 TransferType type;
53 /** \brief Whether transfer is in progress */
54 volatile int transferring;
55 /** \brief The link associated with the transfer */
56 Link *link;
57 /** \brief The Cache structure associated with the transfer */
58 Cache *cache_ptr;
59 /** \brief The ActiveDownload structure associated with the transfer */
60 struct ActiveDownload *ad_ptr;
61 } TransferStruct;
62
63 /**
64 * \brief Callback function for file transfer
65 */
66 size_t write_memory_callback(void *recv_data, size_t size, size_t nmemb,
67 void *userp);
68
69 #endif