GNUnet  0.19.4
gnunet_fs_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2004--2013 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
36 #ifndef GNUNET_FS_LIB_H
37 #define GNUNET_FS_LIB_H
38 
39 
40 #include "gnunet_common.h"
41 #include "gnunet_util_lib.h"
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #if 0 /* keep Emacsens' auto-indent happy */
47 }
48 #endif
49 #endif
50 
72 #define GNUNET_FS_VERSION 0x00090300
73 
74 #if GNUNET_FS_EXTRACTOR_ENABLED
75 
76 #include <extractor.h>
77 
78 #else
79 
80 /* definitions from extractor.h we need for the build */
81 
86 enum EXTRACTOR_MetaType
87 {
88  EXTRACTOR_METATYPE_RESERVED = 0,
89  EXTRACTOR_METATYPE_MIMETYPE = 1,
90  EXTRACTOR_METATYPE_FILENAME = 2,
91  EXTRACTOR_METATYPE_COMMENT = 3,
92  EXTRACTOR_METATYPE_TITLE = 4,
93  EXTRACTOR_METATYPE_BOOK_TITLE = 5,
94  EXTRACTOR_METATYPE_JOURNAL_NAME = 8,
95  EXTRACTOR_METATYPE_AUTHOR_NAME = 13,
96  EXTRACTOR_METATYPE_PUBLICATION_DATE = 24,
97  EXTRACTOR_METATYPE_URL = 29,
98  EXTRACTOR_METATYPE_URI = 30,
99  EXTRACTOR_METATYPE_ISRC = 31,
100  EXTRACTOR_METATYPE_UNKNOWN = 45,
101  EXTRACTOR_METATYPE_DESCRIPTION = 46,
102  EXTRACTOR_METATYPE_KEYWORDS = 49,
103  EXTRACTOR_METATYPE_SUBJECT = 52,
104  EXTRACTOR_METATYPE_PACKAGE_NAME = 69,
105  EXTRACTOR_METATYPE_THUMBNAIL = 114,
106  EXTRACTOR_METATYPE_ALBUM = 129,
107  EXTRACTOR_METATYPE_ARTIST = 130,
108  EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162,
109  EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174,
111 };
112 
116 enum EXTRACTOR_MetaFormat
117 {
121  EXTRACTOR_METAFORMAT_UNKNOWN = 0,
122 
127  EXTRACTOR_METAFORMAT_UTF8 = 1,
128 
132  EXTRACTOR_METAFORMAT_BINARY = 2,
133 
138  EXTRACTOR_METAFORMAT_C_STRING = 3
139 };
140 
141 
159 typedef int (*EXTRACTOR_MetaDataProcessor) (void *cls,
160  const char *plugin_name,
161  enum EXTRACTOR_MetaType type,
162  enum EXTRACTOR_MetaFormat format,
163  const char *data_mime_type,
164  const char *data,
165  size_t data_len);
166 
167 #endif
168 
169 #ifndef EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME
170 /* hack for LE < 0.6.3 */
171 #define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180
172 #endif
173 
174 
175 /* ******************** URI API *********************** */
176 
177 #define GNUNET_FS_URI_PREFIX "gnunet://fs/"
178 #define GNUNET_FS_URI_KSK_INFIX "ksk/"
179 #define GNUNET_FS_URI_SKS_INFIX "sks/"
180 #define GNUNET_FS_URI_CHK_INFIX "chk/"
181 #define GNUNET_FS_URI_LOC_INFIX "loc/"
182 
183 
188 #define GNUNET_FS_PROBE_UPDATE_FREQUENCY GNUNET_TIME_relative_multiply ( \
189  GNUNET_TIME_UNIT_MILLISECONDS, 250)
190 
194 struct GNUNET_FS_Uri;
195 
200 struct GNUNET_FS_MetaData;
201 
202 
211 typedef int
212 (*GNUNET_FS_KeywordIterator) (void *cls,
213  const char *keyword,
214  int is_mandatory);
215 
216 
225 int
226 GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
227  struct GNUNET_HashCode *key);
228 
229 
236 char *
238 
239 
247 char *
249 
250 
259 void
261  const char *keyword,
262  int is_mandatory);
263 
264 
272 void
274  const char *keyword);
275 
276 
284 struct GNUNET_FS_Uri *
285 GNUNET_FS_uri_parse (const char *uri,
286  char **emsg);
287 
288 
294 void
296 
297 
304 unsigned int
306 
307 
317 int
320  void *iterator_cls);
321 
322 
330 int
332  struct GNUNET_PeerIdentity *peer);
333 
334 
341 struct GNUNET_FS_Uri *
343 
344 
353 
354 
367 struct GNUNET_FS_Uri *
368 GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *base_uri,
369  const struct GNUNET_CRYPTO_EddsaPrivateKey *sign_key,
370  struct GNUNET_TIME_Absolute expiration_time);
371 
372 
380 struct GNUNET_FS_Uri *
381 GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1,
382  const struct GNUNET_FS_Uri *u2);
383 
384 
391 struct GNUNET_FS_Uri *
392 GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri);
393 
394 
412 struct GNUNET_FS_Uri *
414  char **emsg);
415 
416 
434 struct GNUNET_FS_Uri *
435 GNUNET_FS_uri_ksk_create_from_args (unsigned int argc,
436  const char **argv);
437 
438 
446 int
447 GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1,
448  const struct GNUNET_FS_Uri *u2);
449 
450 
457 int
459 
460 
468 struct GNUNET_FS_Uri *
470  const char *id);
471 
472 
481 int
484 
485 
492 char *
494 
495 
502 int
504 
505 
512 int
514 
515 
523 uint64_t
525 
526 
533 int
535 
536 
545 struct GNUNET_FS_Uri *
547  *md);
548 
549 
550 /* ******************** command-line option parsing API *********************** */
551 
563  const char *name,
564  const char *argumentHelp,
565  const char *description,
566  struct GNUNET_FS_Uri **topKeywords);
567 
579  const char *name,
580  const char *argumentHelp,
581  const char *description,
582  struct GNUNET_FS_MetaData **meta);
583 
596 int
599  void *scls,
600  const char *option,
601  const char *value);
602 
603 
604 /* ************************* sharing API ***************** */
605 
606 
619 {
624 
629 
634 
639 
646 
653 
660 
665 
670 
675 
680 
685 
692 
698 
704 
710 
718 
725 
732 
738 
745 
750 
755 
761 
766 
771 
776 
782 
788 
795 
800 
805 
810 
815 
821 
827 
833 
838 };
839 
840 
845 
846 
851 
852 
857 
858 
865 
866 
871 
872 
879 
880 
886 {
890  union
891  {
895  struct GNUNET_FS_PublishStatusEvent
896  {
901 
906 
911  void *cctx;
912 
917  void *pctx;
918 
922  const char *filename;
923 
930  uint64_t size;
931 
937  struct GNUNET_TIME_Relative eta;
938 
944 
948  uint64_t completed;
949 
953  uint32_t anonymity;
954 
958  union
959  {
964  struct GNUNET_FS_PublishProgressEvent
965  {
969  const void *data;
970 
974  uint64_t offset;
975 
979  uint64_t data_len;
980 
985  unsigned int depth;
987 
992  struct GNUNET_FS_PublishProgressDirectoryEvent
993  {
997  uint64_t completed;
998 
1002  uint64_t total;
1003 
1010  struct GNUNET_TIME_Relative eta;
1012 
1017  struct GNUNET_FS_PublishResumeEvent
1018  {
1022  const char *message;
1023 
1027  const struct GNUNET_FS_Uri *chk_uri;
1028 
1032  const struct GNUNET_FS_Uri *sks_uri;
1034 
1039  struct GNUNET_FS_PublishCompletedEvent
1040  {
1044  const struct GNUNET_FS_Uri *chk_uri;
1045 
1049  const struct GNUNET_FS_Uri *sks_uri;
1051 
1056  struct GNUNET_FS_PublishErrorEvent
1057  {
1061  const char *message;
1065 
1066 
1070  struct GNUNET_FS_DownloadStatusEvent
1071  {
1076 
1082  void *cctx;
1083 
1088  void *pctx;
1089 
1096  void *sctx;
1097 
1101  const struct GNUNET_FS_Uri *uri;
1102 
1106  const char *filename;
1107 
1113  uint64_t size;
1114 
1120  struct GNUNET_TIME_Relative eta;
1121 
1126 
1130  uint64_t completed;
1131 
1135  uint32_t anonymity;
1136 
1141 
1145  union
1146  {
1151  struct GNUNET_FS_DownloadProgressEvent
1152  {
1159  const void *data;
1160 
1164  uint64_t offset;
1165 
1169  uint64_t data_len;
1170 
1176 
1181  unsigned int depth;
1182 
1190 
1199 
1204  struct GNUNET_FS_DownloadStartEvent
1205  {
1209  const struct GNUNET_FS_MetaData *meta;
1211 
1216  struct GNUNET_FS_DownloadResumeEvent
1217  {
1221  const struct GNUNET_FS_MetaData *meta;
1222 
1226  const char *message;
1228 
1233  struct GNUNET_FS_DownloadErrorEvent
1234  {
1238  const char *message;
1242 
1246  struct GNUNET_FS_SearchStatusEvent
1247  {
1255 
1263  void *cctx;
1264 
1272  void *pctx;
1273 
1278  const struct GNUNET_FS_Uri *query;
1279 
1286 
1290  uint32_t anonymity;
1291 
1295  union
1296  {
1301  struct GNUNET_FS_SearchResultEvent
1302  {
1306  const struct GNUNET_FS_MetaData *meta;
1307 
1311  const struct GNUNET_FS_Uri *uri;
1312 
1317 
1324 
1329  struct GNUNET_FS_SearchResumeResultEvent
1330  {
1334  const struct GNUNET_FS_MetaData *meta;
1335 
1339  const struct GNUNET_FS_Uri *uri;
1340 
1345 
1351 
1357 
1363  uint32_t applicability_rank;
1365 
1370  struct GNUNET_FS_SearchUpdateEvent
1371  {
1376  void *cctx;
1377 
1381  const struct GNUNET_FS_MetaData *meta;
1382 
1386  const struct GNUNET_FS_Uri *uri;
1387 
1392  int32_t availability_rank;
1393 
1398  uint32_t availability_certainty;
1399 
1406 
1412 
1422  struct GNUNET_FS_SearchSuspendResultEvent
1423  {
1428  void *cctx;
1429 
1433  const struct GNUNET_FS_MetaData *meta;
1434 
1438  const struct GNUNET_FS_Uri *uri;
1440 
1450  struct GNUNET_FS_SearchStoppedResultEvent
1451  {
1456  void *cctx;
1457 
1461  const struct GNUNET_FS_MetaData *meta;
1462 
1466  const struct GNUNET_FS_Uri *uri;
1468 
1473  struct GNUNET_GS_SearchResumeEvent
1474  {
1478  const char *message;
1479 
1485 
1490  struct GNUNET_FS_SearchErrorEvent
1491  {
1495  const char *message;
1497 
1501  struct GNUNET_GS_SearchResultNamespaceEvent
1502  {
1506  const char *name;
1507 
1511  const char *root;
1512 
1516  const struct GNUNET_FS_MetaData *meta;
1517 
1522  } ns;
1525 
1529  struct GNUNET_FS_UnindexEvent
1530  {
1535 
1541  void *cctx;
1542 
1546  const char *filename;
1547 
1551  uint64_t size;
1552 
1558  struct GNUNET_TIME_Relative eta;
1559 
1565 
1569  uint64_t completed;
1570 
1574  union
1575  {
1580  struct GNUNET_FS_UnindexProgressEvent
1581  {
1585  const void *data;
1586 
1590  uint64_t offset;
1591 
1595  uint64_t data_len;
1596 
1601  unsigned int depth;
1603 
1608  struct GNUNET_FS_UnindexResumeEvent
1609  {
1613  const char *message;
1615 
1620  struct GNUNET_FS_UnindexErrorEvent
1621  {
1625  const char *message;
1630 
1634  enum GNUNET_FS_Status status;
1635 
1640 };
1641 
1642 
1658 typedef void *
1659 (*GNUNET_FS_ProgressCallback) (void *cls,
1660  const struct GNUNET_FS_ProgressInfo *info);
1661 
1662 
1667 {
1672 
1678 
1685 };
1686 
1687 
1692 {
1697 
1704 
1712 };
1713 
1714 
1720 {
1729 
1735 
1742 
1755 };
1756 
1757 
1761 struct GNUNET_FS_Handle;
1762 
1763 
1775 struct GNUNET_FS_Handle *
1777  const char *client_name,
1779  void *upcb_cls,
1780  enum GNUNET_FS_Flags flags,
1781  ...);
1782 
1783 
1793 void
1795 
1796 
1812 typedef int
1814  struct GNUNET_FS_FileInformation *fi,
1815  uint64_t length,
1816  struct GNUNET_FS_MetaData *meta,
1817  struct GNUNET_FS_Uri **uri,
1818  struct GNUNET_FS_BlockOptions *bo,
1819  int *do_index,
1820  void **client_info);
1821 
1822 
1832 const char *
1834 
1835 
1842 const char *
1845 
1846 
1855 void
1857  const char *filename);
1858 
1859 
1876  void *client_info,
1877  const char *filename,
1878  const struct
1880  const struct
1882  int do_index,
1883  const struct
1885 
1886 
1905  void *client_info,
1906  uint64_t length,
1907  void *data,
1908  const struct
1910  const struct
1912  int do_index,
1913  const struct
1915 
1916 
1937 typedef size_t
1938 (*GNUNET_FS_DataReader) (void *cls,
1939  uint64_t offset,
1940  size_t max,
1941  void *buf,
1942  char **emsg);
1943 
1944 
1963  void *client_info,
1964  uint64_t length,
1966  void *reader_cls,
1967  const struct GNUNET_FS_Uri
1968  *keywords,
1969  const struct
1971  int do_index,
1972  const struct
1974 
1975 
1990  void *client_info,
1991  const struct GNUNET_FS_Uri
1992  *keywords,
1993  const struct
1995  *meta,
1996  const struct
1998  const char *filename);
1999 
2000 
2007 int
2009  *ent);
2010 
2011 
2023 int
2025  struct GNUNET_FS_FileInformation *ent);
2026 
2027 
2042 void
2045  void *proc_cls);
2046 
2047 
2058 void
2061  void *cleaner_cls);
2062 
2063 
2069 {
2074 
2080 };
2081 
2082 
2096 struct GNUNET_FS_PublishContext *
2098  struct GNUNET_FS_FileInformation *fi,
2099  const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
2100  const char *nid,
2101  const char *nuid,
2103 
2104 
2113 void
2115 
2116 
2125 typedef void
2126 (*GNUNET_FS_PublishContinuation) (void *cls,
2127  const struct GNUNET_FS_Uri *uri,
2128  const char *emsg);
2129 
2130 
2135 
2136 
2152  const struct GNUNET_FS_Uri *ksk_uri,
2153  const struct GNUNET_FS_MetaData *meta,
2154  const struct GNUNET_FS_Uri *uri,
2155  const struct GNUNET_FS_BlockOptions *bo,
2158 
2159 
2165 void
2167 
2168 
2173 
2174 
2192  const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns,
2193  const char *identifier,
2194  const char *update,
2195  const struct GNUNET_FS_MetaData *meta,
2196  const struct GNUNET_FS_Uri *uri,
2197  const struct GNUNET_FS_BlockOptions *bo,
2200 
2201 
2207 void
2209 
2210 
2219 typedef int
2220 (*GNUNET_FS_IndexedFileProcessor) (void *cls,
2221  const char *filename,
2222  const struct GNUNET_HashCode *file_id);
2223 
2224 
2229 
2230 
2242  void *iterator_cls);
2243 
2244 
2250 void
2252 
2253 
2262 struct GNUNET_FS_UnindexContext *
2264  const char *filename,
2265  void *cctx);
2266 
2267 
2273 void
2275 
2276 
2286 typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls,
2287  const char *last_id,
2288  const struct
2289  GNUNET_FS_Uri *last_uri,
2290  const struct
2292  last_meta,
2293  const char *next_id);
2294 
2295 
2317 void
2319  const struct
2321  const char *next_id,
2323  void *ip_cls);
2324 
2325 
2331 {
2336 
2341 };
2342 
2343 
2355 struct GNUNET_FS_SearchContext *
2357  const struct GNUNET_FS_Uri *uri, uint32_t anonymity,
2358  enum GNUNET_FS_SearchOptions options, void *cctx);
2359 
2360 
2366 void
2368 
2369 
2375 void
2377 
2378 
2384 void
2386 
2387 
2398 struct GNUNET_FS_SearchResult *
2400  const struct GNUNET_FS_Uri *uri,
2401  const struct GNUNET_FS_MetaData *meta,
2402  void *client_info,
2403  uint32_t anonymity);
2404 
2405 
2413 void *
2415 
2416 
2422 {
2427 
2432 
2438 
2444 
2452  GNUNET_FS_DOWNLOAD_IS_PROBE = (1 << 31)
2453 };
2454 
2455 
2488  const struct GNUNET_FS_Uri *uri,
2489  const struct GNUNET_FS_MetaData *meta,
2490  const char *filename, const char *tempname,
2491  uint64_t offset, uint64_t length, uint32_t anonymity,
2492  enum GNUNET_FS_DownloadOptions options, void *cctx,
2494 
2495 
2532  struct GNUNET_FS_SearchResult *sr,
2533  const char *filename,
2534  const char *tempname, uint64_t offset,
2535  uint64_t length, uint32_t anonymity,
2537  void *cctx);
2538 
2539 
2546 void
2547 GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete);
2548 
2549 
2555 void
2557 
2558 
2564 void
2566 
2567 
2568 /* ******************** Directory API *********************** */
2569 
2570 
2571 #define GNUNET_FS_DIRECTORY_MIME "application/gnunet-directory"
2572 #define GNUNET_FS_DIRECTORY_MAGIC "\211GND\r\n\032\n"
2573 #define GNUNET_FS_DIRECTORY_EXT ".gnd"
2574 
2582 int
2584  *md);
2585 
2586 
2593 void
2595 
2596 
2603 char *
2605  GNUNET_FS_MetaData *md);
2606 
2607 
2623 typedef void (*GNUNET_FS_DirectoryEntryProcessor) (void *cls,
2624  const char *filename,
2625  const struct GNUNET_FS_Uri *
2626  uri,
2627  const struct
2629  meta, size_t length,
2630  const void *data);
2631 
2632 
2652 int
2653 GNUNET_FS_directory_list_contents (size_t size, const void *data,
2654  uint64_t offset,
2656  void *dep_cls);
2657 
2658 
2663 
2664 
2672  *mdir);
2673 
2674 
2685 void
2687  const struct GNUNET_FS_Uri *uri,
2688  const struct GNUNET_FS_MetaData *md,
2689  const void *data);
2690 
2691 
2702 int
2704  size_t *rsize, void **rdata);
2705 
2706 
2707 /* ******************** DirScanner API *********************** */
2708 
2713 {
2718 
2724 
2729 
2734 
2740 
2745 };
2746 
2747 
2759 typedef void (*GNUNET_FS_DirScannerProgressCallback) (void *cls,
2760  const char *filename,
2761  int is_directory,
2762  enum
2764  reason);
2765 
2766 
2771 {
2776 
2781 
2787 
2793 
2799 
2804 
2809 
2813  char *filename;
2814 
2819 
2824 };
2825 
2826 
2830 struct GNUNET_FS_DirScanner;
2831 
2832 
2844 struct GNUNET_FS_DirScanner *
2846  int disable_extractor,
2847  const char *ex,
2849  void *cb_cls);
2850 
2851 
2858 void
2860 
2861 
2870 struct GNUNET_FS_ShareTreeItem *
2872 
2873 
2880 void
2882 
2883 
2889 void
2891 
2899 /* ****************** metadata ******************* */
2900 
2901 
2908 struct GNUNET_FS_MetaData *
2910 
2911 
2919 struct GNUNET_FS_MetaData *
2921  const struct GNUNET_FS_MetaData *md);
2922 
2923 
2930 void
2932 
2933 
2945 int
2947  const struct GNUNET_FS_MetaData *md1,
2948  const struct GNUNET_FS_MetaData *md2);
2949 
2950 
2969 int
2971  const char *plugin_name,
2972  enum EXTRACTOR_MetaType type,
2973  enum EXTRACTOR_MetaFormat format,
2974  const char *data_mime_type,
2975  const char *data,
2976  size_t data_size);
2977 
2978 
2987 void
2989  const struct GNUNET_FS_MetaData *in);
2990 
2991 
3003 int
3005  enum EXTRACTOR_MetaType type,
3006  const char *data,
3007  size_t data_size);
3008 
3009 
3016 void
3018 
3019 
3027 void
3029  struct GNUNET_FS_MetaData *md);
3030 
3031 
3042 int
3044  EXTRACTOR_MetaDataProcessor iter,
3045  void *iter_cls);
3046 
3047 
3059 char *
3061  const struct GNUNET_FS_MetaData *md,
3062  enum EXTRACTOR_MetaType type);
3063 
3064 
3077 char *
3079  const struct GNUNET_FS_MetaData *md,
3080  ...);
3081 
3092 size_t
3094  const struct GNUNET_FS_MetaData *md,
3095  unsigned char **thumb);
3096 
3097 
3103 {
3109 
3116 
3122 };
3123 
3124 
3140 ssize_t
3142  const struct GNUNET_FS_MetaData *md,
3143  char **target,
3144  size_t max,
3146 
3147 
3155 ssize_t
3157  const struct GNUNET_FS_MetaData *md);
3158 
3159 
3169 struct GNUNET_FS_MetaData *
3170 GNUNET_FS_meta_data_deserialize (const char *input, size_t size);
3171 
3182  const char *what,
3183  const struct GNUNET_FS_MetaData *m);
3184 
3192 struct GNUNET_BIO_ReadSpec
3193 GNUNET_FS_read_spec_meta_data (const char *what,
3194  struct GNUNET_FS_MetaData **result);
3195 
3196 
3197 
3205 struct GNUNET_BIO_WriteSpec
3207  const struct GNUNET_FS_MetaData *m);
3208 
3219  const char *what,
3220  struct GNUNET_FS_MetaData **result);
3221 
3222 
3223 #if 0 /* keep Emacsens' auto-indent happy */
3224 {
3225 #endif
3226 #ifdef __cplusplus
3227 }
3228 #endif
3229 
3230 #endif
3231  /* end of group */
3233  /* end of group addition */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
Definition: gnunet-abd.c:41
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:104
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static char * dir
Set to the directory where runtime files are stored.
Definition: gnunet-arm.c:89
static int disable_extractor
Disable extractor option to use for publishing.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int anonymity
static struct GNUNET_FS_DownloadContext * dc
static char * filename
static struct GNUNET_FS_GetIndexedContext * gic
Handle for the index listing operation.
Definition: gnunet-fs.c:42
uint32_t data
The data value.
static char * value
Value of the record to add/remove.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static struct GNUNET_FS_DirScanner * ds
Handle to the directory scanner (for recursive insertions).
static struct GNUNET_FS_MetaData * meta
Meta-data provided via command-line option.
static char * pseudonym
Command-line option identifying the pseudonym to use for the publication.
static struct GNUNET_FS_BlockOptions bo
Options we set for published blocks.
static char * next_id
Command-line option for namespace publishing: identifier for updates to this publication.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
static struct GNUNET_FS_Uri * topKeywords
Keywords provided via command-line option.
static int result
Global testing status.
#define info
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
static char * plugin_name
Name of our plugin.
static char buf[2048]
static struct GNUNET_FS_UnindexContext * uc
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
struct GNUNET_FS_SearchResult * GNUNET_FS_probe(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, void *client_info, uint32_t anonymity)
Start download probes for the given search result.
Definition: fs_search.c:489
#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME
GNUNET_FS_Flags
General (global) option flags for file-sharing.
GNUNET_FS_SearchOptions
Options for searching.
char * GNUNET_FS_uri_ksk_to_string_fancy(const struct GNUNET_FS_Uri *uri)
Convert keyword URI to a human readable format (i.e.
Definition: fs_uri.c:148
void GNUNET_FS_share_tree_free(struct GNUNET_FS_ShareTreeItem *toplevel)
Release memory of a share item tree.
Definition: fs_sharetree.c:437
struct GNUNET_TIME_Absolute GNUNET_FS_uri_loc_get_expiration(const struct GNUNET_FS_Uri *uri)
Obtain the expiration of the LOC URI.
Definition: fs_uri.c:829
char * GNUNET_FS_uri_sks_get_content_id(const struct GNUNET_FS_Uri *uri)
Get the content identifier of an SKS URI.
Definition: fs_uri.c:1306
int(* GNUNET_FS_KeywordIterator)(void *cls, const char *keyword, int is_mandatory)
Iterator over keywords.
char * GNUNET_FS_meta_data_suggest_filename(const struct GNUNET_FS_MetaData *md)
Suggest a filename based on given metadata.
Definition: fs_misc.c:39
enum GNUNET_GenericReturnValue GNUNET_FS_write_meta_data(struct GNUNET_BIO_WriteHandle *h, const char *what, const struct GNUNET_FS_MetaData *m)
Write a metadata container.
Definition: meta_data.c:1112
struct GNUNET_FS_Uri * GNUNET_FS_uri_parse(const char *uri, char **emsg)
Convert a UTF-8 String to a URI.
Definition: fs_uri.c:637
GNUNET_FS_DownloadOptions
Options for downloading.
int(* GNUNET_FS_FileInformationProcessor)(void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info)
Function called on entries in a struct GNUNET_FS_FileInformation iteration.
void GNUNET_FS_meta_data_make_directory(struct GNUNET_FS_MetaData *md)
Set the MIMETYPE information for the given metadata to "application/gnunet-directory".
Definition: fs_directory.c:81
int GNUNET_FS_directory_list_contents(size_t size, const void *data, uint64_t offset, GNUNET_FS_DirectoryEntryProcessor dep, void *dep_cls)
Iterate over all entries in a directory.
Definition: fs_directory.c:182
void *(* GNUNET_FS_ProgressCallback)(void *cls, const struct GNUNET_FS_ProgressInfo *info)
Notification of FS to a client about the progress of an operation.
int GNUNET_FS_directory_builder_finish(struct GNUNET_FS_DirectoryBuilder *bld, size_t *rsize, void **rdata)
Finish building the directory.
Definition: fs_directory.c:578
void GNUNET_FS_uri_ksk_remove_keyword(struct GNUNET_FS_Uri *uri, const char *keyword)
Remove the given keyword from the set of keywords represented by the URI.
Definition: fs_uri.c:780
void GNUNET_FS_publish_ksk_cancel(struct GNUNET_FS_PublishKskContext *pkc)
Abort the KSK publishing operation.
void GNUNET_FS_search_continue(struct GNUNET_FS_SearchContext *sc)
Continue paused search.
Definition: fs_search.c:1658
void GNUNET_FS_namespace_list_updateable(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls)
List all of the identifiers in the namespace for which we could produce an update.
Definition: fs_namespace.c:667
uint64_t GNUNET_FS_uri_chk_get_file_size(const struct GNUNET_FS_Uri *uri)
What is the size of the file that this URI refers to?
Definition: fs_uri.c:1360
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_file(struct GNUNET_FS_Handle *h, void *client_info, const char *filename, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo)
Create an entry for a file in a publish-structure.
int GNUNET_FS_uri_test_ksk(const struct GNUNET_FS_Uri *uri)
Is this a keyword URI?
Definition: fs_uri.c:1324
void * GNUNET_FS_probe_stop(struct GNUNET_FS_SearchResult *sr)
Stop probe activity.
Definition: fs_search.c:540
GNUNET_FS_OPTIONS
Options specified in the VARARGs portion of GNUNET_FS_start.
GNUNET_FS_Status
Possible status codes used in the callback for the various file-sharing operations.
size_t(* GNUNET_FS_DataReader)(void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
Function that provides data.
void GNUNET_FS_get_indexed_files_cancel(struct GNUNET_FS_GetIndexedContext *gic)
Cancel iteration over all indexed files.
int(* GNUNET_FS_IndexedFileProcessor)(void *cls, const char *filename, const struct GNUNET_HashCode *file_id)
Type of a function called by GNUNET_FS_get_indexed_files.
struct GNUNET_FS_DirectoryBuilder * GNUNET_FS_directory_builder_create(const struct GNUNET_FS_MetaData *mdir)
Create a directory builder.
Definition: fs_directory.c:366
int GNUNET_FS_file_information_add(struct GNUNET_FS_FileInformation *dir, struct GNUNET_FS_FileInformation *ent)
Add an entry to a directory in a publish-structure.
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_create(const struct GNUNET_FS_Uri *base_uri, const struct GNUNET_CRYPTO_EddsaPrivateKey *sign_key, struct GNUNET_TIME_Absolute expiration_time)
Construct a location URI (this peer will be used for the location).
Definition: fs_uri.c:869
int GNUNET_FS_uri_test_equal(const struct GNUNET_FS_Uri *u1, const struct GNUNET_FS_Uri *u2)
Test if two URIs are equal.
Definition: fs_uri.c:1201
void GNUNET_FS_file_information_inspect(struct GNUNET_FS_FileInformation *dir, GNUNET_FS_FileInformationProcessor proc, void *proc_cls)
Inspect a file or directory in a publish-structure.
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create_from_args(unsigned int argc, const char **argv)
Create an FS URI from a user-supplied command line of keywords.
Definition: fs_uri.c:1144
enum GNUNET_GenericReturnValue GNUNET_FS_read_meta_data(struct GNUNET_BIO_ReadHandle *h, const char *what, struct GNUNET_FS_MetaData **result)
Read a metadata container.
Definition: meta_data.c:1054
void GNUNET_FS_unindex_stop(struct GNUNET_FS_UnindexContext *uc)
Clean up after completion of an unindex operation.
Definition: fs_unindex.c:838
int GNUNET_FS_uri_test_loc(const struct GNUNET_FS_Uri *uri)
Is this a location URI?
Definition: fs_uri.c:1384
void(* GNUNET_FS_DirectoryEntryProcessor)(void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, size_t length, const void *data)
Function used to process entries in a directory.
GNUNET_FS_PublishOptions
Options for publishing.
void GNUNET_FS_download_resume(struct GNUNET_FS_DownloadContext *dc)
Resume a suspended download.
Definition: fs_download.c:2227
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create(const char *keywords, char **emsg)
Create an FS URI from a single user-supplied string of keywords.
Definition: fs_uri.c:1049
struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls)
Publish an SBlock on GNUnet.
Definition: fs_namespace.c:428
char * GNUNET_FS_uri_to_string(const struct GNUNET_FS_Uri *uri)
Convert a URI to a UTF-8 String.
Definition: fs_uri.c:2017
void GNUNET_FS_search_stop(struct GNUNET_FS_SearchContext *sc)
Stop search for content.
Definition: fs_search.c:1766
const char * GNUNET_FS_file_information_get_id(struct GNUNET_FS_FileInformation *s)
Obtain the name under which this file information structure is stored on disk.
int GNUNET_FS_uri_ksk_get_keywords(const struct GNUNET_FS_Uri *uri, GNUNET_FS_KeywordIterator iterator, void *iterator_cls)
Iterate over all keywords in this keyword URI.
Definition: fs_uri.c:720
struct GNUNET_FS_PublishContext * GNUNET_FS_publish_start(struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options)
Publish a file or directory.
Definition: fs_publish.c:1443
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
Definition: fs_uri.c:677
struct GNUNET_FS_DownloadContext * GNUNET_FS_download_start(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, const char *filename, const char *tempname, uint64_t offset, uint64_t length, uint32_t anonymity, enum GNUNET_FS_DownloadOptions options, void *cctx, struct GNUNET_FS_DownloadContext *parent)
Download parts of a file.
Definition: fs_download.c:2100
int GNUNET_FS_uri_sks_get_namespace(const struct GNUNET_FS_Uri *uri, struct GNUNET_CRYPTO_EcdsaPublicKey *pseudonym)
Get the public key of a namespace from the given namespace URI.
Definition: fs_uri.c:1286
int GNUNET_FS_uri_test_sks(const struct GNUNET_FS_Uri *uri)
Is this a namespace URI?
Definition: fs_uri.c:1271
const char * GNUNET_FS_file_information_get_filename(const struct GNUNET_FS_FileInformation *s)
Obtain the filename from the file information structure.
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
Definition: fs_uri.c:987
void GNUNET_FS_file_information_set_filename(struct GNUNET_FS_FileInformation *s, const char *filename)
Set the filename in the file information structure.
int GNUNET_FS_getopt_set_metadata(struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value)
Command-line option parser function that allows the user to specify one or more '-m' options with met...
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_reader(struct GNUNET_FS_Handle *h, void *client_info, uint64_t length, GNUNET_FS_DataReader reader, void *reader_cls, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo)
Create an entry for a file in a publish-structure.
void GNUNET_FS_download_stop(struct GNUNET_FS_DownloadContext *dc, int do_delete)
Stop a download (aborts if download is incomplete).
Definition: fs_download.c:2254
GNUNET_FS_DirScannerProgressUpdateReason
Progress reasons of the directory scanner.
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_merge(const struct GNUNET_FS_Uri *u1, const struct GNUNET_FS_Uri *u2)
Merge the sets of keywords from two KSK URIs.
Definition: fs_uri.c:931
struct GNUNET_FS_Handle * GNUNET_FS_start(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *client_name, GNUNET_FS_ProgressCallback upcb, void *upcb_cls, enum GNUNET_FS_Flags flags,...)
Setup a connection to the file-sharing service.
Definition: fs_api.c:3244
struct GNUNET_FS_Uri * GNUNET_FS_uri_sks_create(const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *id)
Create an SKS URI from a namespace ID and an identifier.
Definition: fs_uri.c:908
int GNUNET_FS_meta_data_test_for_directory(const struct GNUNET_FS_MetaData *md)
Does the meta-data claim that this is a directory? Checks if the mime-type is that of a GNUnet direct...
Definition: fs_directory.c:55
void(* GNUNET_FS_PublishContinuation)(void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
Signature of a function called as the continuation of a KBlock or SBlock publication.
int GNUNET_FS_uri_test_chk(const struct GNUNET_FS_Uri *uri)
Is this a file (or directory) URI?
Definition: fs_uri.c:1346
void(* GNUNET_FS_IdentifierProcessor)(void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri, const struct GNUNET_FS_MetaData *last_meta, const char *next_id)
Function called on updateable identifiers.
void GNUNET_FS_stop(struct GNUNET_FS_Handle *h)
Close our connection with the file-sharing service.
Definition: fs_api.c:3310
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_get_uri(const struct GNUNET_FS_Uri *uri)
Obtain the URI of the content itself.
Definition: fs_uri.c:843
unsigned int GNUNET_FS_uri_ksk_get_keyword_count(const struct GNUNET_FS_Uri *uri)
How many keywords are ANDed in this keyword URI?
Definition: fs_uri.c:711
struct GNUNET_FS_PublishKskContext * GNUNET_FS_publish_ksk(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *ksk_uri, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls)
Publish a KBlock on GNUnet.
int GNUNET_FS_file_information_is_directory(const struct GNUNET_FS_FileInformation *ent)
Test if a given entry represents a directory.
struct GNUNET_FS_DownloadContext * GNUNET_FS_download_start_from_search(struct GNUNET_FS_Handle *h, struct GNUNET_FS_SearchResult *sr, const char *filename, const char *tempname, uint64_t offset, uint64_t length, uint32_t anonymity, enum GNUNET_FS_DownloadOptions options, void *cctx)
Download parts of a file based on a search result.
Definition: fs_download.c:2137
struct GNUNET_FS_GetIndexedContext * GNUNET_FS_get_indexed_files(struct GNUNET_FS_Handle *h, GNUNET_FS_IndexedFileProcessor iterator, void *iterator_cls)
Iterate over all indexed files.
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create_from_meta_data(const struct GNUNET_FS_MetaData *md)
Construct a keyword-URI from meta-data (take all entries in the meta-data and construct one large key...
Definition: fs_uri.c:1771
struct GNUNET_FS_UnindexContext * GNUNET_FS_unindex_start(struct GNUNET_FS_Handle *h, const char *filename, void *cctx)
Unindex a file.
Definition: fs_unindex.c:796
struct GNUNET_GETOPT_CommandLineOption GNUNET_FS_GETOPT_METADATA(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_FS_MetaData **meta)
Allow user to specify metadata.
Definition: fs_getopt.c:254
struct GNUNET_BIO_ReadSpec GNUNET_FS_read_spec_meta_data(const char *what, struct GNUNET_FS_MetaData **result)
Create the specification to read a metadata container.
Definition: meta_data.c:1180
void GNUNET_FS_publish_stop(struct GNUNET_FS_PublishContext *pc)
Stop a publication.
Definition: fs_publish.c:1571
void GNUNET_FS_search_pause(struct GNUNET_FS_SearchContext *sc)
Pause search.
Definition: fs_search.c:1627
struct GNUNET_BIO_WriteSpec GNUNET_FS_write_spec_meta_data(const char *what, const struct GNUNET_FS_MetaData *m)
Create the specification to write a metadata container.
Definition: meta_data.c:1217
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_empty_directory(struct GNUNET_FS_Handle *h, void *client_info, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_BlockOptions *bo, const char *filename)
Create an entry for an empty directory in a publish-structure.
int GNUNET_FS_uri_to_key(const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode *key)
Get a unique key from a URI.
Definition: fs_uri.c:96
void GNUNET_FS_directory_scan_abort(struct GNUNET_FS_DirScanner *ds)
Abort the scan.
struct GNUNET_FS_ShareTreeItem * GNUNET_FS_directory_scan_get_result(struct GNUNET_FS_DirScanner *ds)
Obtain the result of the scan after the scan has signalled completion.
void GNUNET_FS_file_information_destroy(struct GNUNET_FS_FileInformation *fi, GNUNET_FS_FileInformationProcessor cleaner, void *cleaner_cls)
Destroy publish-structure.
void GNUNET_FS_download_suspend(struct GNUNET_FS_DownloadContext *dc)
Suspend a download.
Definition: fs_download.c:2215
void GNUNET_FS_share_tree_trim(struct GNUNET_FS_ShareTreeItem *toplevel)
Process a share item tree, moving frequent keywords up and copying frequent metadata up.
Definition: fs_sharetree.c:417
struct GNUNET_FS_SearchContext * GNUNET_FS_search_start(struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, uint32_t anonymity, enum GNUNET_FS_SearchOptions options, void *cctx)
Start search for content.
Definition: fs_search.c:1607
struct GNUNET_GETOPT_CommandLineOption GNUNET_FS_GETOPT_KEYWORDS(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_FS_Uri **topKeywords)
Allow user to specify keywords.
Definition: fs_getopt.c:129
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_data(struct GNUNET_FS_Handle *h, void *client_info, uint64_t length, void *data, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo)
Create an entry for a file in a publish-structure.
void GNUNET_FS_directory_builder_add(struct GNUNET_FS_DirectoryBuilder *bld, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *md, const void *data)
Add an entry to a directory.
Definition: fs_directory.c:392
int GNUNET_FS_uri_loc_get_peer_identity(const struct GNUNET_FS_Uri *uri, struct GNUNET_PeerIdentity *peer)
Obtain the identity of the peer offering the data.
Definition: fs_uri.c:812
void GNUNET_FS_publish_sks_cancel(struct GNUNET_FS_PublishSksContext *psc)
Abort the SKS publishing operation.
Definition: fs_namespace.c:491
void(* GNUNET_FS_DirScannerProgressCallback)(void *cls, const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason)
Function called over time as the directory scanner makes progress on the job at hand.
struct GNUNET_FS_DirScanner * GNUNET_FS_directory_scan_start(const char *filename, int disable_extractor, const char *ex, GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls)
Start a directory scanner.
void GNUNET_FS_uri_ksk_add_keyword(struct GNUNET_FS_Uri *uri, const char *keyword, int is_mandatory)
Add the given keyword to the set of keywords represented by the URI.
Definition: fs_uri.c:752
@ GNUNET_FS_FLAGS_PERSISTENCE
Is persistence of operations desired? (will create SUSPEND/RESUME events).
@ GNUNET_FS_FLAGS_DO_PROBES
Should we automatically trigger probes for search results to determine availability?...
@ GNUNET_FS_FLAGS_NONE
No special flags set.
@ GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY
Only search the local host, do not search remote systems (no P2P)
@ GNUNET_FS_SEARCH_OPTION_NONE
No options (use defaults for everything).
@ GNUNET_FS_DOWNLOAD_OPTION_NONE
No options (use defaults for everything).
@ GNUNET_FS_DOWNLOAD_IS_PROBE
Internal option used to flag this download as a 'probe' for a search result.
@ GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE
Do a recursive download (that is, automatically trigger the download of files in directories).
@ GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY
Only download from the local host, do not access remote systems (no P2P)
@ GNUNET_FS_DOWNLOAD_NO_TEMPORARIES
Do not append temporary data to the target file (for the IBlocks).
@ GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM
Select the desired amount of parallelism (this option should be followed by an "unsigned int" giving ...
@ GNUNET_FS_OPTIONS_END
Last option in the VARARG list.
@ GNUNET_FS_OPTIONS_REQUEST_PARALLELISM
Maximum number of requests that should be pending at a given point in time (invidivual downloads may ...
@ GNUNET_FS_STATUS_UNINDEX_PROGRESS
Notification that we made progress unindexing a file.
@ GNUNET_FS_STATUS_SEARCH_UPDATE
We have additional data about the quality or availability of a search result.
@ GNUNET_FS_STATUS_DOWNLOAD_INACTIVE
Notification that this download is no longer actively being pursued (back in the queue).
@ GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE
We have discovered a new namespace.
@ GNUNET_FS_STATUS_UNINDEX_RESUME
Notification that we resumed unindexing of a file.
@ GNUNET_FS_STATUS_DOWNLOAD_ERROR
Notification that this download encountered an error.
@ GNUNET_FS_STATUS_SEARCH_ERROR
Signals a problem with this search.
@ GNUNET_FS_STATUS_DOWNLOAD_COMPLETED
Notification that this download completed.
@ GNUNET_FS_STATUS_DOWNLOAD_RESUME
Notification that this download is being resumed.
@ GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED
Event generated for each search result when the respective search is stopped.
@ GNUNET_FS_STATUS_UNINDEX_START
Notification that we started to unindex a file.
@ GNUNET_FS_STATUS_SEARCH_SUSPEND
Last event when a search is being suspended; note that "GNUNET_FS_SEARCH_STOPPED" will not be generat...
@ GNUNET_FS_STATUS_SEARCH_RESUME
Last event when a search is being resumed; note that "GNUNET_FS_SEARCH_START" will not be generated i...
@ GNUNET_FS_STATUS_SEARCH_RESUME_RESULT
Event generated for each search result when the respective search is resumed.
@ GNUNET_FS_STATUS_PUBLISH_STOPPED
Notification that we have stopped the process of uploading a file structure; no further events will b...
@ GNUNET_FS_STATUS_PUBLISH_ERROR
Notification that an error was encountered sharing a file structure.
@ GNUNET_FS_STATUS_UNINDEX_STOPPED
Notification that the unindexing of this file was stopped (final event for this action).
@ GNUNET_FS_STATUS_DOWNLOAD_SUSPEND
Notification that this download was suspended.
@ GNUNET_FS_STATUS_SEARCH_RESULT
This search has yielded a result.
@ GNUNET_FS_STATUS_PUBLISH_SUSPEND
Notification that we have suspended sharing a file structure.
@ GNUNET_FS_STATUS_SEARCH_CONTINUED
Signals that this search was continued (unpaused).
@ GNUNET_FS_STATUS_PUBLISH_PROGRESS
Notification that we are making progress sharing a file structure.
@ GNUNET_FS_STATUS_DOWNLOAD_START
Notification that we have started this download.
@ GNUNET_FS_STATUS_UNINDEX_COMPLETED
Notification that the unindexing of this file was completed.
@ GNUNET_FS_STATUS_SEARCH_PAUSED
Signals that this search was paused.
@ GNUNET_FS_STATUS_DOWNLOAD_PROGRESS
Notification about progress with this download.
@ GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT
Notification that this download is no longer part of a recursive download or search but now a 'stand-...
@ GNUNET_FS_STATUS_UNINDEX_SUSPEND
Notification that we suspended unindexing a file.
@ GNUNET_FS_STATUS_UNINDEX_ERROR
Notification that we encountered an error unindexing a file.
@ GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY
Notification that we are making progress sharing a directory.
@ GNUNET_FS_STATUS_PUBLISH_START
Notification that we have started to publish a file structure.
@ GNUNET_FS_STATUS_PUBLISH_COMPLETED
Notification that we completed sharing a file structure.
@ GNUNET_FS_STATUS_PUBLISH_RESUME
Notification that we have resumed sharing a file structure.
@ GNUNET_FS_STATUS_SEARCH_START
First event generated when a client requests a search to begin or when a namespace result automatical...
@ GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND
Event generated for each search result when the respective search is suspended.
@ GNUNET_FS_STATUS_DOWNLOAD_ACTIVE
Notification that this download is now actively being pursued (as opposed to waiting in the queue).
@ GNUNET_FS_STATUS_DOWNLOAD_STOPPED
Notification that this download was stopped (final event with respect to this action).
@ GNUNET_FS_STATUS_SEARCH_STOPPED
Last message from a search; this signals that there will be no further events associated with this se...
@ GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY
Simulate publishing.
@ GNUNET_FS_PUBLISH_OPTION_NONE
No options (use defaults for everything).
@ GNUNET_FS_DIRSCANNER_INTERNAL_ERROR
There was an internal error.
@ GNUNET_FS_DIRSCANNER_FILE_IGNORED
We're having trouble accessing a file (soft-error); it will be ignored.
@ GNUNET_FS_DIRSCANNER_FINISHED
Last call to the progress function: we have finished scanning the directory.
@ GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED
We've finished extracting meta data from a file.
@ GNUNET_FS_DIRSCANNER_ALL_COUNTED
We've found all files (in the pre-pass).
@ GNUNET_FS_DIRSCANNER_FILE_START
We've started processing a file or directory.
static int iterator(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Iterator over hash map entries.
GNUNET_GenericReturnValue
Named constants for return values.
int GNUNET_FS_meta_data_iterate(const struct GNUNET_FS_MetaData *md, EXTRACTOR_MetaDataProcessor iter, void *iter_cls)
Iterate over MD entries.
Definition: meta_data.c:422
void GNUNET_FS_meta_data_add_publication_date(struct GNUNET_FS_MetaData *md)
Add the current time as the publication date to the meta-data.
Definition: meta_data.c:395
ssize_t GNUNET_FS_meta_data_get_serialized_size(const struct GNUNET_FS_MetaData *md)
Get the size of the full meta-data in serialized form.
Definition: meta_data.c:862
size_t GNUNET_FS_meta_data_get_thumbnail(const struct GNUNET_FS_MetaData *md, unsigned char **thumb)
Get a thumbnail from the meta-data (if present).
Definition: meta_data.c:494
GNUNET_FS_MetaDataSerializationOptions
Options for metadata serialization.
ssize_t GNUNET_FS_meta_data_serialize(const struct GNUNET_FS_MetaData *md, char **target, size_t max, enum GNUNET_FS_MetaDataSerializationOptions opt)
Serialize meta-data to target.
Definition: meta_data.c:641
void GNUNET_FS_meta_data_merge(struct GNUNET_FS_MetaData *md, const struct GNUNET_FS_MetaData *in)
Extend metadata.
Definition: meta_data.c:360
struct GNUNET_FS_MetaData * GNUNET_FS_meta_data_create(void)
Create a fresh meta data container.
Definition: meta_data.c:131
char * GNUNET_FS_meta_data_get_by_type(const struct GNUNET_FS_MetaData *md, enum EXTRACTOR_MetaType type)
Get the first MD entry of the given type.
Definition: meta_data.c:442
struct GNUNET_FS_MetaData * GNUNET_FS_meta_data_duplicate(const struct GNUNET_FS_MetaData *md)
Duplicate a MetaData token.
Definition: meta_data.c:531
int GNUNET_FS_meta_data_insert(struct GNUNET_FS_MetaData *md, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_size)
Extend metadata.
Definition: meta_data.c:258
void GNUNET_FS_meta_data_destroy(struct GNUNET_FS_MetaData *md)
Free meta data.
Definition: meta_data.c:170
int GNUNET_FS_meta_data_test_equal(const struct GNUNET_FS_MetaData *md1, const struct GNUNET_FS_MetaData *md2)
Test if two MDs are equal.
Definition: meta_data.c:204
void GNUNET_FS_meta_data_clear(struct GNUNET_FS_MetaData *md)
Remove all items in the container.
Definition: meta_data.c:187
int GNUNET_FS_meta_data_delete(struct GNUNET_FS_MetaData *md, enum EXTRACTOR_MetaType type, const char *data, size_t data_size)
Remove an item.
Definition: meta_data.c:368
struct GNUNET_FS_MetaData * GNUNET_FS_meta_data_deserialize(const char *input, size_t size)
Deserialize meta-data.
Definition: meta_data.c:889
char * GNUNET_FS_meta_data_get_first_by_types(const struct GNUNET_FS_MetaData *md,...)
Get the first matching MD entry of the given types.
Definition: meta_data.c:460
@ GNUNET_FS_META_DATA_SERIALIZE_FULL
Serialize all of the data.
@ GNUNET_FS_META_DATA_SERIALIZE_PART
If not enough space is available, it is acceptable to only serialize some of the metadata.
@ GNUNET_FS_META_DATA_SERIALIZE_NO_COMPRESS
Speed is of the essence, do not allow compression.
#define max(x, y)
static unsigned int size
Size of the "table".
Definition: peer.c:68
const char * name
Handle for buffered reading.
Definition: bio.c:69
Structure specifying a reading operation on an IO handle.
const char * what
What is being read (for error message creation)
Handle for buffered writing.
Definition: bio.c:466
Structure specifying a writing operation on an IO handle.
const char * what
What is being read (for error message creation)
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
Private ECC key encoded for transmission.
Settings for publishing a block (which may of course also apply to an entire directory or file).
uint32_t anonymity_level
At which anonymity level should the block be shared? (0: no anonymity, 1: normal GAP,...
uint32_t content_priority
How important is it for us to store the block? If we run out of space, the highest-priority,...
uint32_t replication_level
How often should we try to migrate the block to other peers? Only used if "CONTENT_PUSHING" is set to...
struct GNUNET_TIME_Absolute expiration_time
At what time should the block expire? Data blocks (DBLOCKS and IBLOCKS) may still be used even if the...
An opaque structure a pointer to which is returned to the caller to be used to control the scanner.
Internal state of a directory builder.
Definition: fs_directory.c:342
Context for controlling a download.
Definition: fs_api.h:1744
uint64_t offset
What is the first offset that we're interested in?
Definition: fs_api.h:1878
uint64_t length
How many bytes starting from offset are desired? This is NOT the overall length of the file!
Definition: fs_api.h:1884
struct GNUNET_FS_DownloadContext * parent
Parent download (used when downloading files in directories).
Definition: fs_api.h:1764
Information for a file or directory that is about to be published.
Definition: fs_api.h:228
struct GNUNET_FS_Uri * keywords
Keywords to use for KBlocks.
Definition: fs_api.h:258
GNUNET_FS_DataReader reader
Function that can be used to read the data for the file.
Definition: fs_api.h:317
char * emsg
Error message (non-NULL if this operation failed).
Definition: fs_api.h:297
void * client_info
Pointer kept for the client.
Definition: fs_api.h:248
int do_index
Should the file be indexed or inserted?
Definition: fs_api.h:339
void * reader_cls
Closure for reader.
Definition: fs_api.h:322
Context for GNUNET_FS_get_indexed_files().
void * iterator_cls
Closure for iterator.
Master context for most FS operations.
Definition: fs_api.h:1070
enum GNUNET_FS_Flags flags
General flags.
Definition: fs_api.h:1162
char * client_name
Name of our client.
Definition: fs_api.h:1079
void * upcb_cls
Closure for upcb.
Definition: fs_api.h:1089
GNUNET_FS_ProgressCallback upcb
Function to call with updates on our progress.
Definition: fs_api.h:1084
Meta data to associate with a file, directory or namespace.
Definition: meta_data.c:96
Argument given to the progress callback with information about what is going on.
union GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26 specifics
Additional values for specific events.
struct GNUNET_FS_PublishContext * pc
Context for controlling the upload.
const char * root
Root identifier for the namespace, can be NULL.
void * cctx
Client context pointer (set the last time by the client for this operation; initially NULL on START/R...
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_DownloadStatusEvent download
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26::GNUNET_FS_PublishResumeEvent resume
unsigned int depth
Depth of the given block in the tree; 0 would be the lowest level (DBLOCKs).
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent::@28::GNUNET_GS_SearchResultNamespaceEvent ns
union GNUNET_FS_ProgressInfo::@25 value
Values that depend on the event type.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26::GNUNET_FS_PublishProgressDirectoryEvent progress_directory
int is_paused
Is this search currently paused?
const struct GNUNET_FS_MetaData * meta
Known metadata for the download.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent::@28::GNUNET_FS_SearchUpdateEvent update
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent search
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent::@28::GNUNET_FS_SearchResumeResultEvent resume_result
struct GNUNET_FS_Handle * fsh
File-sharing handle that generated the event.
enum GNUNET_FS_Status status
Specific status code (determines the event type).
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent publish
struct GNUNET_CRYPTO_EcdsaPublicKey pseudonym
Public key of the namespace.
struct GNUNET_TIME_Relative duration
How long has this upload been actively running (excludes times where the upload was suspended).
const void * data
Data block we just published.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26::GNUNET_FS_PublishProgressEvent progress
void * sctx
Client context pointer for the associated search operation (specifically, context pointer for the spe...
void * pctx
Client context pointer for the parent operation (if this is a file in a directory or a subdirectory).
struct GNUNET_TIME_Relative eta
At what time do we expect to finish the upload? (will be a value in the past for completed uploads).
uint32_t anonymity
What anonymity level is used for this upload?
int32_t availability_rank
Current availability rank (negative: unavailable, positive: available)
uint32_t availability_certainty
On how many total queries is the given availability_rank based?
const char * filename
Name of the file being published; can be NULL.
uint64_t size
How large is the file overall? For directories, this is only the size of the directory itself,...
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent::@28::GNUNET_FS_SearchSuspendResultEvent result_suspend
uint32_t num_transmissions
How often did we transmit the request? (estimate, because we might have the same request pending for ...
const struct GNUNET_FS_Uri * uri
URI used for this download.
const char * name
Short, human-readable name of the namespace.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_DownloadStatusEvent::@27::GNUNET_FS_DownloadStartEvent start
uint64_t offset
At what offset in the file is "data"?
struct GNUNET_FS_DownloadContext * dc
Context for controlling the download.
struct GNUNET_FS_SearchContext * sc
Context for controlling the search, NULL for searches that were not explicitly triggered by the clien...
const struct GNUNET_FS_Uri * query
What query is used for this search (list of keywords or SKS identifier).
const char * message
Error message, NULL if no error was encountered so far.
struct GNUNET_TIME_Relative block_download_duration
How much time passed between us asking for this block and actually getting it? GNUNET_TIME_UNIT_FOREV...
int is_active
Is the download currently active.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_UnindexEvent unindex
uint64_t data_len
Length of the data block.
uint32_t applicability_rank
Applicability rank (the larger, the better the result fits the search criteria).
uint64_t completed
How many bytes have we completed?
struct GNUNET_TIME_Relative current_probe_time
How long has the current probe been active?
const struct GNUNET_FS_FileInformation * fi
Information about the file that is being published.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26::GNUNET_FS_PublishErrorEvent error
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_SearchStatusEvent::@28::GNUNET_FS_SearchStoppedResultEvent result_stopped
uint64_t total
How big do we estimate the entire directory to be?
struct GNUNET_FS_UnindexContext * uc
Context for controlling the unindexing.
const struct GNUNET_FS_Uri * chk_uri
URI of the file (if the download had been completed)
struct GNUNET_FS_SearchResult * result
Handle to the result (for starting downloads).
const struct GNUNET_FS_Uri * sks_uri
SKS URI of the file (if the download had been completed)
uint32_t respect_offered
How much respect did we offer for downloading this block? (estimate, because we might have the same r...
Handle for controlling a publication process.
Definition: fs_api.h:1180
char * nuid
ID for future updates, NULL if we have no namespace or no updates.
Definition: fs_api.h:1209
struct GNUNET_FS_FileInformation * fi
File-structure that is being shared.
Definition: fs_api.h:1194
char * nid
ID of the content in the namespace, NULL if we have no namespace.
Definition: fs_api.h:1204
Context for the KSK publication.
struct GNUNET_FS_Uri * ksk_uri
Keywords to use.
void * cont_cls
Closure for cont.
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
Context for the SKS publication.
Definition: fs_namespace.c:345
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
Definition: fs_namespace.c:375
void * cont_cls
Closure for cont.
Definition: fs_namespace.c:380
Handle for controlling a search.
Definition: fs_api.h:1511
Information we store for each search result.
Definition: fs_api.h:499
void * client_info
Client info for this search result.
Definition: fs_api.h:534
A node of a directory tree (produced by dirscanner)
int is_directory
GNUNET_YES if this is a directory
struct GNUNET_FS_ShareTreeItem * parent
This is a doubly-linked tree NULL for top-level entries.
struct GNUNET_FS_ShareTreeItem * prev
This is a doubly-linked list.
struct GNUNET_FS_Uri * ksk_uri
Keywords for this file or directory (derived from metadata).
char * short_filename
Base name of the file/directory.
struct GNUNET_FS_ShareTreeItem * next
This is a doubly-linked list.
struct GNUNET_FS_ShareTreeItem * children_head
This is a doubly-linked tree NULL for files and empty directories.
struct GNUNET_FS_MetaData * meta
Metadata for this file or directory.
char * filename
Name of the file/directory.
struct GNUNET_FS_ShareTreeItem * children_tail
This is a doubly-linked tree NULL for files and empty directories.
Handle for controlling an unindexing operation.
Definition: fs_api.h:1351
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:167
char ** keywords
Keywords start with a '+' if they are mandatory (in which case the '+' is NOT part of the keyword) an...
Definition: fs_api.h:186
Definition of a command line option.
const char * description
Help text for the option (description)
const char * argumentHelp
Name of the argument for the user in help text.
const char shortName
Short name of the option.
General context for command line processors.
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.