aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO12
-rw-r--r--doc/man/Makefile.am1
-rw-r--r--doc/man/gnunet-publish.1166
-rw-r--r--src/fs/Makefile.am13
-rw-r--r--src/fs/fs.h4
-rw-r--r--src/fs/fs_directory.c59
-rw-r--r--src/fs/fs_getopt.c4
-rw-r--r--src/fs/fs_publish.c111
-rw-r--r--src/fs/gnunet-publish.c556
-rw-r--r--src/include/gnunet_connection_lib.h6
-rw-r--r--src/include/gnunet_container_lib.h46
-rw-r--r--src/include/gnunet_fs_service.h8
-rw-r--r--src/include/gnunet_network_lib.h13
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/container_meta_data.c4
-rw-r--r--src/util/network_socket.c (renamed from src/util/sock.c)2
16 files changed, 924 insertions, 83 deletions
diff --git a/TODO b/TODO
index 3a7b8e50b..78b932630 100644
--- a/TODO
+++ b/TODO
@@ -44,20 +44,18 @@ PHASE #2: (Goal: recover basic file-sharing functionality)
44 + persistence mechanism (design done) 44 + persistence mechanism (design done)
45 + sharing API 45 + sharing API
46 ~ file-information (needs testing) 46 ~ file-information (needs testing)
47 ~ directory: implement new directory builder! 47 ~ directory (needs testing)
48 ~ insert: close, need directory builder first! 48 ~ publish (work in progress...)
49 ~ unindex & list indexed!!! 49 ~ unindex & list indexed!!! (need publish to be done)
50 ~ search 50 ~ search (need publish to be done)
51 ~ download 51 ~ download (need publish/search to be done)
52 ~ namespaces 52 ~ namespaces
53 ~ collection 53 ~ collection
54 - design network structs (P2P) 54 - design network structs (P2P)
55 - datastore request queueing mechanism 55 - datastore request queueing mechanism
56 - implement FS service (needs DHT) 56 - implement FS service (needs DHT)
57 + insert
58 + download 57 + download
59 + search 58 + search
60 + unindex
61 - implement testcases 59 - implement testcases
62 + URI API 60 + URI API
63 + getopt API 61 + getopt API
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 734fc9c85..b5af700e0 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -1,6 +1,7 @@
1man_MANS = \ 1man_MANS = \
2 gnunet-arm.1 \ 2 gnunet-arm.1 \
3 gnunet-peerinfo.1 \ 3 gnunet-peerinfo.1 \
4 gnunet-publish.1 \
4 gnunet-statistics.1 \ 5 gnunet-statistics.1 \
5 gnunet-transport.c 6 gnunet-transport.c
6 7
diff --git a/doc/man/gnunet-publish.1 b/doc/man/gnunet-publish.1
new file mode 100644
index 000000000..4926295cf
--- /dev/null
+++ b/doc/man/gnunet-publish.1
@@ -0,0 +1,166 @@
1.TH GNUNET-PUBLISH "1" "27 Aug 2009" "GNUnet"
2.SH NAME
3gnunet\-publish \- a command line interface for publishing new content into GNUnet
4.SH SYNOPSIS
5.B gnunet\-publish
6[\fIOPTIONS\fR] FILENAME
7.SH DESCRIPTION
8.PP
9In order to share files with other GNUnet users, the files must first be made available to GNUnet. GNUnet does not automatically share all files from a certain directory. In fact, even files that are downloaded are not automatically shared.
10.PP
11In order to start sharing files, the files must be added either using gnunet\-publish or a graphical interface such as gnunet\-gtk. The command line tool gnunet\-publish is more useful if many files are supposed to be added. gnunet\-publish can automatically publish batches of files, recursively publish directories, create directories that can be browsed within GNUnet and publish file lists in a namespace. When run on a directory, gnunet\-publish will always recursively publish all of the files in the directory.
12.PP
13gnunet\-publish can automatically extract keywords from the files that are shared. Users that want to download files from GNUnet use keywords to search for the appropriate content. You can disable keyword extraction with the \-D option. You can manually add keywords using the \-k option. The keywords are case\-sensitive. (However, keyword normalization can also be used.)
14.PP
15You can use automatic meta\-data extraction (based on libextractor) or the command\-line option \-m to specify meta-data. For the \-m option you need to use the form keyword\-type:value. For example, use "\-m os:Linux" to specify that the operating system is Linux. Common meta\-data types are "author", "title" , "mimetype", "filename", "language", "subject" and "keywords". A full list can be obtained from the extract tool using the option \-\-list. The meta\-data is used to help users in searching for files on the network.
16.PP
17In addition to searching for files by keyword, GNUnet allows organizing files into directories. With directories, the user only needs to find the directory in order to be able to download any of the files listed in the directory. Directories can contain pointers to other directories.
18.PP
19With gnunet\-publish, it is easy to create new directories simultaneously when adding the files. Simply pass the name of a directory instead of a file.
20.PP
21Since keywords can be spammed (any user can add any content under any keyword), GNUnet supports namespaces. A namespace is a subset of the searchspace into which only the holder of a certain pseudonym can add content. Any GNUnet user can create any number of pseudonyms using \fBgnunet\-pseudonym\fR. Pseudonyms are stored in the user's GNUnet directory. While pseudonyms are locally identified with an arbitrary string that the user selects when the pseudonym is created, the namespace is globally known only under the hash of the public key of the pseudonym. Since only the owner of the pseudonym can add content to the namespace, it is impossible for other users to pollute the namespace. gnunet\-publish automatically publishs the top\-directory (or the only file if only one file is specified) into the namespace if a pseudonym is specified.
22.PP
23It is possible to update content in GNUnet if that content was placed and obtained from a particular namespace. Updates are only possible for content in namespaces since this is the only way to assure that a malicious party can not supply counterfeited updates. Note that an update with GNUnet does not make the old content unavailable, GNUnet merely allows the publisher to point users to more recent versions. You can use the \-N option to specify the future identifier of an update. When using this option, a GNUnet client that finds the current (\-t) identifier will automatically begin a search for the update (\-N) identifier. If you later publish an update under the (\-N) identifier, both results will be given to the user.
24.PP
25You can use automatic meta\-data extraction (based on libextractor) or the command\-line option \-m to specify meta-data. For the \-m option you need to use the form keyword\-type:value. For example, use "\-m os:Linux" to specify that the operating system is Linux. Common meta\-data types are "author", "title" , "mimetype", "filename", "language", "subject" and "keywords". A full list can be obtained from the extract tool using the option \-\-list. The meta\-data is used to help users in searching for files on the network. The keywords are case\-sensitive.
26.PP
27GNUnet supports two styles of publishing files on the network. Publishing a file means that a copy of the file is made in the local (!) database of the node. Indexing a file means that an index is added to the local (!) database with symbolic links to the file itself. The links will use the SHA-512 hash of the entire file as the filename. Indexing is generally significantly more efficient and the default choice. However, indexing only works if the indexed file can be read (using the same absolute path) by gnunetd. If this is not the case, indexing will fail (and gnunet\-publish will automatically revert to publishing instead). Regardless of which method is used to publish the file, the file will be slowly (depending on how often it is requested and on how much bandwidth is available) dispersed into the network. If you publish or index a file and then leave the network, it will almost always NOT be available anymore.
28
29\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
30Use alternate config file (if this option is not specified, the default is ~/.gnunet/gnunet.conf).
31
32.TP
33\fB\-D\fR, \fB\-\-disable\-extractor\fR
34Disable use of GNU libextractor for finding additional keywords and metadata.
35
36.TP
37\fB\-e\fR, \fB\-\-extract\fR
38Print the list of keywords that will be used for each file given the current options. Do not perform any indexing or publishing.
39
40.TP
41\fB\-h\fR, \fB\-\-help\fR
42Print a brief help page with all the options.
43
44.TP
45\fB\-H \fIHOSTNAME\fR, \fB\-\-host=\fIHOSTNAME\fR
46on which host is gnunetd running (default: localhost). You can also specify a port using the syntax HOSTNAME:PORT. The default port is 2087.
47.TP
48\fB\-k \fIKEYWORD\fR, \fB\-\-key=KEYWORD\fR
49additional key to index the content with (to add multiple keys, specify multiple times). Each additional key is case\-sensitive. Can be specified multiple times. The keyword is only applied to the top\-level file or directory.
50
51.TP
52\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=\fILOGLEVEL\fR
53Change the loglevel. Possible values for LOGLEVEL are NOTHING, FATAL,
54ERROR, WARNING, INFO, STATUS and DEBUG. Note that options in the
55configuration file take precedence over this option (the argument
56will be ignored in that case).
57
58.TP
59\fB\-m \fITYPE:VALUE\fR, \fB\-\-meta=\fITYPE:VALUE\fR
60For the main file (or directory), set the metadata of the given TYPE to the given VALUE. Note that this will not add the respective VALUE to the set of keywords under which the file can be found.
61
62.TP
63\fB\-n\fR, \fB\-\-noindex\fR
64Executive summary: You probably don't need it.
65
66Do not index, full publishion. Note that directories, RBlocks, SBlocks and IBlocks are always published (even without this option). With this option, every block of the actual files is stored in encrypted form in the block database of the local peer. While this adds security if the local node is compromised (the adversary snags your machine), it is significantly less efficient compared to on\-demand encryption and is definitely not recommended for large files.
67
68.TP
69\fB\-N \fIID\fR, \fB\-\-next=\fIID\fR
70Specifies the next ID of a future version of the SBlock. This option is only valid together with the \-P option. This option can be used to specify what the identifier of an updated version will look like. Note that specifying \-i and \-N without \-t is not allowed.
71
72.TP
73\fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR
74Executive summary: You probably don't need it.
75
76Set the priority of the published content (default: 365). If the local database is full, GNUnet will discard the content with the lowest ranking. Note that ranks change over time depending on popularity. The default should be high enough to preserve the locally published content in favor of content that migrates from other peers.
77
78.TP
79\fB\-P \fINAME\fR, \fB\-\-pseudonym=\fINAME\fR
80For the top\-level directory or file, create an SBlock that places the file into the namespace specified by the pseudonym NAME.
81
82.TP
83\fB\-s\fR, \fB\-\-simulate-only\fR
84When this option is used, gnunet\-publish will not actually publish the file but just simulate what would be done. This can be used to compute the GNUnet URI for a file without actually sharing it.
85
86.TP
87\fB\-t \fIID\fR, \fB\-\-this=\fIID\fR
88Specifies the ID of the SBlock. This option is only valid together with the\ \-s option.
89
90.TP
91\fB\-u \fIURI\fR, \fB\-\-uri=\fIURI\fR
92This option can be used to specify the URI of a file instead of a filename (this is the only case where the otherwise mandatory filename argument must be omitted). Instead of publishing a file or directory and using the corresponding URI, gnunet\-publish will use this URI and perform the selected namespace or keyword operations. This can be used to add additional keywords to a file that has already been shared or to add files to a namespace for which the URI is known but the content is not locally available.
93
94.TP
95\fB\-v\fR, \fB\-\-version\fR
96Print the version number.
97
98.TP
99\fB\-V\fR, \fB\-\-verbose\fR
100Be verbose. Using this option causes gnunet\-publish to print progress information and at the end the file identification that can be used to download the file from GNUnet.
101
102
103.SH EXAMPLES
104.PP
105
106\fBBasic examples\fR
107
108Index a file COPYING:
109
110 # gnunet\-publish COPYING
111
112Publish a file COPYING:
113
114 # gnunet\-publish \-n COPYING
115
116Index a file COPYING with the keywords \fBgpl\fR and \fBtest\fR:
117
118 # gnunet\-publish \-k gpl \-k test COPYING
119
120Index a file COPYING with description "GNU License", mime-type "text/plain" and keywords \fBgpl\fR and \fBtest\fR:
121
122 # gnunet\-publish \-m "description:GNU License" \-k gpl \-k test -m "mimetype:text/plain" COPYING
123
124\fBUsing directories\fR
125
126Index the files COPYING and AUTHORS with keyword \fBtest\fR and build a directory containing the two files. Make the directory itself available under keyword \fBgnu\fR and disable keyword extraction using libextractor:
127
128 # mkdir gnu
129 # mv COPYING AUTHORS gnu/
130 # gnunet\-publish \-K test \-k gnu \-D gnu/
131
132Neatly publish an image gallery in \fBkittendir/\fR and its subdirs with keyword \fBkittens\fR for the directory but no keywords for the individual files or subdirs (\-n). Force description for all files:
133
134 # gnunet\-publish \-n \-m "description:Kitten collection" \-k kittens kittendir/
135
136\fBSecure publishing with namespaces\fR
137
138Publish file COPYING with pseudonym RIAA-2 (\-P) and with identifier \fBgpl\fR (\-t) and no updates:
139
140 # gnunet\-publish \-P RIAA-2 \-t gpl COPYING
141
142Recursively index /home/ogg and build a matching directory structure. Publish the top\-level directory into the namespace under the pseudonym RIAA-2 (\-P) under identifier 'MUSIC' (\-t) and promise to provide an update with identifier 'VIDEOS' (\-N):
143
144 # gnunet\-publish \-P RIAA-2 \-t MUSIC \-N VIDEOS /home/ogg
145
146Recursively publish (\-n) /var/lib/mysql and build a matching directory structure, but disable the use of libextractor to extract keywords (\-n). Print the file identifiers (\-V) that can be used to retrieve the files. This will store a copy of the MySQL database in GNUnet but without adding any keywords to search for it. Thus only people that have been told the secret file identifiers printed with the \-V option can retrieve the (secret?) files:
147
148 # gnunet\-publish \-nV /var/lib/mysql
149
150Create a namespace entry 'root' in namespace MPAA-1 and announce that the next update will be called 'next':
151
152 # gnunet\-publish \-P MPAA-1 -t root \-N next noise.mp3
153
154Update the previous entry, do not allow any future updates:
155
156 # gnunet\-publish \-P MPAA-1 \-t next noise_updated.mp3
157
158
159.SH FILES
160.TP
161~/.gnunet/gnunet.conf
162GNUnet configuration file
163.SH "REPORTING BUGS"
164Report bugs by using mantis <https://gnunet.org/mantis/> or by sending electronic mail to <gnunet\-developers@gnu.org>
165.SH "SEE ALSO"
166\fBgnunet\-auto\-share\fP(1), \fBgnunet\-gtk\fP(1), \fBgnunet\-pseudonym\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1), \fBextract\fP(1)
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 5aca42ac2..f1bc64784 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -26,6 +26,7 @@ libgnunetfs_la_SOURCES = \
26 fs_uri.c 26 fs_uri.c
27 27
28libgnunetfs_la_LIBADD = \ 28libgnunetfs_la_LIBADD = \
29 $(top_builddir)/src/datastore/libgnunetdatastore.la \
29 $(top_builddir)/src/util/libgnunetutil.la \ 30 $(top_builddir)/src/util/libgnunetutil.la \
30 -lextractor \ 31 -lextractor \
31 $(GN_LIBINTL) $(XLIB) 32 $(GN_LIBINTL) $(XLIB)
@@ -35,11 +36,11 @@ libgnunetfs_la_LDFLAGS = \
35 -version-info 0:0:0 36 -version-info 0:0:0
36 37
37 38
38#bin_PROGRAMS = 39bin_PROGRAMS = \
40 gnunet-publish
39# gnunet-directory 41# gnunet-directory
40# gnunet-download 42# gnunet-download
41# gnunet-pseudonym 43# gnunet-pseudonym
42# gnunet-publish
43# gnunet-search 44# gnunet-search
44# gnunet-unindex 45# gnunet-unindex
45 46
@@ -51,6 +52,14 @@ libgnunetfs_la_LDFLAGS = \
51# $(GN_LIBINTL) 52# $(GN_LIBINTL)
52 53
53 54
55gnunet_publish_SOURCES = \
56 gnunet-publish.c
57gnunet_publish_LDADD = \
58 $(top_builddir)/src/fs/libgnunetfs.la \
59 $(top_builddir)/src/util/libgnunetutil.la \
60 $(GN_LIBINTL)
61
62
54check_PROGRAMS = \ 63check_PROGRAMS = \
55 test_fs_collection \ 64 test_fs_collection \
56 test_fs_directory \ 65 test_fs_directory \
diff --git a/src/fs/fs.h b/src/fs/fs.h
index c66249613..3c92b42ae 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -308,13 +308,13 @@ struct GNUNET_FS_FileInformation
308 * Size of the directory itself (in bytes); 0 if the 308 * Size of the directory itself (in bytes); 0 if the
309 * size has not yet been calculated. 309 * size has not yet been calculated.
310 */ 310 */
311 uint64_t dir_size; 311 size_t dir_size;
312 312
313 /** 313 /**
314 * Pointer to the data for the directory (or NULL if not 314 * Pointer to the data for the directory (or NULL if not
315 * available). 315 * available).
316 */ 316 */
317 char *dir_data; 317 void *dir_data;
318 318
319 } dir; 319 } dir;
320 320
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c
index e5a9f963f..489cf8f19 100644
--- a/src/fs/fs_directory.c
+++ b/src/fs/fs_directory.c
@@ -24,7 +24,6 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
26 * TODO: 26 * TODO:
27 * - add support for embedded file data (use padding room!)
28 * - modify directory builder API to support incremental 27 * - modify directory builder API to support incremental
29 * generation of directories (to allow directories that 28 * generation of directories (to allow directories that
30 * would not fit into memory to be created) 29 * would not fit into memory to be created)
@@ -42,6 +41,13 @@
42#endif 41#endif
43 42
44/** 43/**
44 * String that is used to indicate that a file
45 * is a GNUnet directory.
46 */
47#define GNUNET_DIRECTORY_MAGIC "\211GND\r\n\032\n"
48
49
50/**
45 * Does the meta-data claim that this is a directory? 51 * Does the meta-data claim that this is a directory?
46 * Checks if the mime-type is that of a GNUnet directory. 52 * Checks if the mime-type is that of a GNUnet directory.
47 * 53 *
@@ -118,6 +124,7 @@ GNUNET_FS_directory_list_contents (size_t size,
118 void *dep_cls) 124 void *dep_cls)
119{ 125{
120 const char *cdata = data; 126 const char *cdata = data;
127 char *file_data;
121 char *emsg; 128 char *emsg;
122 uint64_t pos; 129 uint64_t pos;
123 uint64_t align; 130 uint64_t align;
@@ -217,17 +224,18 @@ GNUNET_FS_directory_list_contents (size_t size,
217 return; /* malformed ! */ 224 return; /* malformed ! */
218 } 225 }
219 pos += mdSize; 226 pos += mdSize;
220 // EXTRACTOR_GNUNET_FULL_DATA
221 /* FIXME: add support for embedded data */
222 filename = GNUNET_CONTAINER_meta_data_get_by_type (md, 227 filename = GNUNET_CONTAINER_meta_data_get_by_type (md,
223 EXTRACTOR_FILENAME); 228 EXTRACTOR_FILENAME);
229 file_data = GNUNET_CONTAINER_meta_data_get_by_type (md,
230 EXTRACTOR_GNUNET_FULL_DATA);
224 if (dep != NULL) 231 if (dep != NULL)
225 dep (dep_cls, 232 dep (dep_cls,
226 filename, 233 filename,
227 uri, 234 uri,
228 md, 235 md,
229 0, 236 (file_data != NULL) ? strlen(file_data) : 0,
230 NULL); 237 file_data);
238 GNUNET_free_non_null (file_data);
231 GNUNET_free_non_null (filename); 239 GNUNET_free_non_null (filename);
232 GNUNET_CONTAINER_meta_data_destroy (md); 240 GNUNET_CONTAINER_meta_data_destroy (md);
233 GNUNET_FS_uri_destroy (uri); 241 GNUNET_FS_uri_destroy (uri);
@@ -308,6 +316,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
308 struct BuilderEntry *e; 316 struct BuilderEntry *e;
309 uint64_t fsize; 317 uint64_t fsize;
310 uint32_t big; 318 uint32_t big;
319 ssize_t ret;
311 size_t mds; 320 size_t mds;
312 size_t mdxs; 321 size_t mdxs;
313 char *uris; 322 char *uris;
@@ -316,12 +325,12 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
316 struct GNUNET_CONTAINER_MetaData *meta; 325 struct GNUNET_CONTAINER_MetaData *meta;
317 const struct GNUNET_CONTAINER_MetaData *meta_use; 326 const struct GNUNET_CONTAINER_MetaData *meta_use;
318 327
319 GNUNET_assert (! GNUNET_FS_uri_ksk_test (uri)); 328 GNUNET_assert (! GNUNET_FS_uri_test_ksk (uri));
320 if (NULL != data) 329 if (NULL != data)
321 if (GNUNET_FS_uri_chk_test (uri)) 330 if (GNUNET_FS_uri_test_chk (uri))
322 fsize = GNUNET_FS_uri_chk_get_size (uri); 331 fsize = GNUNET_FS_uri_chk_get_file_size (uri);
323 else 332 else
324 fsize = GNUNET_FS_uri_chk_get_size (GNUNET_FS_uri_loc_get_uri (uri)); 333 fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri (uri));
325 else 334 else
326 fsize = 0; /* not given */ 335 fsize = 0; /* not given */
327 if (fsize > GNUNET_FS_MAX_INLINE_SIZE) 336 if (fsize > GNUNET_FS_MAX_INLINE_SIZE)
@@ -500,8 +509,8 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
500 uint32_t big; 509 uint32_t big;
501 510
502 size = 8 + sizeof (uint32_t); 511 size = 8 + sizeof (uint32_t);
503 size += GNUNET_meta_data_get_serialized_size (bld->meta, 512 size += GNUNET_CONTAINER_meta_data_get_serialized_size (bld->meta,
504 GNUNET_SERIALIZE_FULL); 513 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
505 if (bld->count > 0) 514 if (bld->count > 0)
506 { 515 {
507 sizes = GNUNET_malloc (bld->count * sizeof (size_t)); 516 sizes = GNUNET_malloc (bld->count * sizeof (size_t));
@@ -512,7 +521,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
512 { 521 {
513 perm[i] = i; 522 perm[i] = i;
514 bes[i] = pos; 523 bes[i] = pos;
515 sizes[i] = pos->size; 524 sizes[i] = pos->len;
516 pos = pos->next; 525 pos = pos->next;
517 } 526 }
518 } 527 }
@@ -534,22 +543,22 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
534 memcpy (data, GNUNET_DIRECTORY_MAGIC, 8); 543 memcpy (data, GNUNET_DIRECTORY_MAGIC, 8);
535 off = 8; 544 off = 8;
536 545
537 ret = GNUNET_CONTAINER_meta_data_serialize (meta, 546 ret = GNUNET_CONTAINER_meta_data_serialize (bld->meta,
538 &(*data)[off + 547 &data[off +
539 sizeof (uint32_t)], 548 sizeof (uint32_t)],
540 size - pos - sizeof (uint32_t), 549 size - off - sizeof (uint32_t),
541 GNUNET_SERIALIZE_FULL); 550 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
542 GNUNET_assert (ret != -1); 551 GNUNET_assert (ret != -1);
543 big = htonl (ret); 552 big = htonl (ret);
544 memcpy (&(*data)[8], &big, sizeof (uint32_t)); 553 memcpy (&data[8], &big, sizeof (uint32_t));
545 pos += sizeof (uint32_t) + ret; 554 off += sizeof (uint32_t) + ret;
546 for (j = 0; j < count; j++) 555 for (j = 0; j < bld->count; j++)
547 { 556 {
548 i = perm[j]; 557 i = perm[j];
549 psize = pos; 558 psize = off;
550 pos += sizes[i]; 559 off += sizes[i];
551 pos = do_align (psize, pos); 560 off = do_align (psize, off);
552 memcpy (&data[pos - sizes[i]], 561 memcpy (&data[off - sizes[i]],
553 &(bes[i])[1], 562 &(bes[i])[1],
554 sizes[i]); 563 sizes[i]);
555 GNUNET_free (bes[i]); 564 GNUNET_free (bes[i]);
@@ -557,7 +566,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
557 GNUNET_free (sizes); 566 GNUNET_free (sizes);
558 GNUNET_free (perm); 567 GNUNET_free (perm);
559 GNUNET_free (bes); 568 GNUNET_free (bes);
560 GNUNET_assert (pos == size); 569 GNUNET_assert (off == size);
561 GNUNET_CONTAINER_meta_data_destroy (bld->meta); 570 GNUNET_CONTAINER_meta_data_destroy (bld->meta);
562 GNUNET_free (bld); 571 GNUNET_free (bld);
563} 572}
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c
index dfcc4fdc4..a0d232641 100644
--- a/src/fs/fs_getopt.c
+++ b/src/fs/fs_getopt.c
@@ -42,7 +42,7 @@
42 * @return GNUNET_OK on success 42 * @return GNUNET_OK on success
43 */ 43 */
44int 44int
45GNUNET_FS_getopt_configure_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, 45GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
46 void *scls, 46 void *scls,
47 const char *option, 47 const char *option,
48 const char *value) 48 const char *value)
@@ -124,7 +124,7 @@ GNUNET_FS_getopt_configure_set_keywords (struct GNUNET_GETOPT_CommandLineProcess
124 * @return GNUNET_OK on success 124 * @return GNUNET_OK on success
125 */ 125 */
126int 126int
127GNUNET_FS_getopt_configure_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, 127GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
128 void *scls, 128 void *scls,
129 const char *option, 129 const char *option,
130 const char *value) 130 const char *value)
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 0078d0d32..f5c2b4cdc 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -26,7 +26,6 @@
26 * @author Christian Grothoff 26 * @author Christian Grothoff
27 * 27 *
28 * TODO: 28 * TODO:
29 * - directory creation
30 * - KBlocks 29 * - KBlocks
31 * - SBlocks 30 * - SBlocks
32 * - indexing support 31 * - indexing support
@@ -119,6 +118,7 @@ ds_put_cont (void *cls,
119 * 118 *
120 * @param sc overall upload data 119 * @param sc overall upload data
121 * @param p file that the block belongs to (needed for options!) 120 * @param p file that the block belongs to (needed for options!)
121 * @param query what the block should be indexed under
122 * @param blk encoded block to publish 122 * @param blk encoded block to publish
123 * @param blk_size size of the block 123 * @param blk_size size of the block
124 * @param blk_type type of the block 124 * @param blk_type type of the block
@@ -127,15 +127,14 @@ ds_put_cont (void *cls,
127static void 127static void
128publish_block (struct GNUNET_FS_PublishContext *sc, 128publish_block (struct GNUNET_FS_PublishContext *sc,
129 struct GNUNET_FS_FileInformation *p, 129 struct GNUNET_FS_FileInformation *p,
130 const GNUNET_HashCode *query,
130 const void* blk, 131 const void* blk,
131 uint16_t blk_size, 132 uint16_t blk_size,
132 uint32_t blk_type, 133 uint32_t blk_type,
133 GNUNET_SCHEDULER_Task cont) 134 GNUNET_SCHEDULER_Task cont)
134{ 135{
135 struct GNUNET_HashCode key; 136 struct PutContCtx * dpc_cls;
136 137
137 // FIXME: GNUNET_FS_get_key (blk_type, blk, blk_size, &key);
138 // (or add "key" as argument to reduce hashing?)
139 dpc_cls = GNUNET_malloc(sizeof(struct PutContCtx)); 138 dpc_cls = GNUNET_malloc(sizeof(struct PutContCtx));
140 dpc_cls->cont = cont; 139 dpc_cls->cont = cont;
141 dpc_cls->sc = sc; 140 dpc_cls->sc = sc;
@@ -146,8 +145,9 @@ publish_block (struct GNUNET_FS_PublishContext *sc,
146 // a task ID! 145 // a task ID!
147 GNUNET_DATASTORE_put (sc->dsh, 146 GNUNET_DATASTORE_put (sc->dsh,
148 sc->rid, 147 sc->rid,
149 &key, 148 query,
150 blk_size, 149 blk_size,
150 blk,
151 blk_type, 151 blk_type,
152 p->priority, 152 p->priority,
153 p->anonymity, 153 p->anonymity,
@@ -280,7 +280,8 @@ compute_chk_offset (unsigned int height,
280 uint64_t offset) 280 uint64_t offset)
281{ 281{
282 uint64_t bds; 282 uint64_t bds;
283 unsigned int ret; 283 unsigned int ret;
284 unsigned int i;
284 285
285 bds = GNUNET_FS_DBLOCK_SIZE; /* number of bytes each CHK at level "i" 286 bds = GNUNET_FS_DBLOCK_SIZE; /* number of bytes each CHK at level "i"
286 corresponds to */ 287 corresponds to */
@@ -305,7 +306,7 @@ static void
305publish_content (struct GNUNET_FS_PublishContext *sc, 306publish_content (struct GNUNET_FS_PublishContext *sc,
306 struct GNUNET_FS_FileInformation *p) 307 struct GNUNET_FS_FileInformation *p)
307{ 308{
308 struct ContentHashKey *chk; 309 struct ContentHashKey *mychk;
309 const void *pt_block; 310 const void *pt_block;
310 uint16_t pt_size; 311 uint16_t pt_size;
311 char *emsg; 312 char *emsg;
@@ -315,6 +316,10 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
315 struct GNUNET_CRYPTO_AesInitializationVector iv; 316 struct GNUNET_CRYPTO_AesInitializationVector iv;
316 uint64_t size; 317 uint64_t size;
317 unsigned int off; 318 unsigned int off;
319 struct GNUNET_FS_DirectoryBuilder *db;
320 struct GNUNET_FS_FileInformation *dirpos;
321 void *raw_data;
322 char *dd;
318 323
319 // FIXME: figure out how to share this code 324 // FIXME: figure out how to share this code
320 // with unindex! 325 // with unindex!
@@ -323,14 +328,47 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
323 { 328 {
324 if (p->is_directory) 329 if (p->is_directory)
325 { 330 {
326 /* FIXME: create function to create directory 331 db = GNUNET_FS_directory_builder_create (p->meta);
327 and use that API here! */ 332 dirpos = p->data.dir.entries;
328 GNUNET_FS_directory_create (&p->data.dir.dir_size, 333 while (NULL != dirpos)
329 &p->data.dir.dir_data, 334 {
330 p->meta, 335 if (dirpos->is_directory)
331 &directory_entry_lister, 336 {
332 p->data.dir.entries); 337 raw_data = dirpos->data.dir.dir_data;
333 size = p->data.dir.data_size; 338 dirpos->data.dir.dir_data = NULL;
339 }
340 else
341 {
342 raw_data = NULL;
343 if ( (dirpos->data.file.file_size < GNUNET_FS_MAX_INLINE_SIZE) &&
344 (dirpos->data.file.file_size > 0) )
345 {
346 raw_data = GNUNET_malloc (dirpos->data.file.file_size);
347 emsg = NULL;
348 if (dirpos->data.file.file_size !=
349 dirpos->data.file.reader (dirpos->data.file.reader_cls,
350 0,
351 dirpos->data.file.file_size,
352 raw_data,
353 &emsg))
354 {
355 GNUNET_free_non_null (emsg);
356 GNUNET_free (raw_data);
357 raw_data = NULL;
358 }
359 }
360 }
361 GNUNET_FS_directory_builder_add (db,
362 dirpos->chk_uri,
363 dirpos->meta,
364 raw_data);
365 GNUNET_free_non_null (raw_data);
366 dirpos = dirpos->next;
367 }
368 GNUNET_FS_directory_builder_finish (db,
369 &p->data.dir.dir_size,
370 &p->data.dir.dir_data);
371 size = p->data.dir.dir_size;
334 } 372 }
335 p->chk_tree_depth = compute_depth (size); 373 p->chk_tree_depth = compute_depth (size);
336 p->chk_tree = GNUNET_malloc (p->chk_tree_depth * 374 p->chk_tree = GNUNET_malloc (p->chk_tree_depth *
@@ -344,17 +382,24 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
344 { 382 {
345 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE, 383 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE,
346 p->data.dir.dir_size - p->publish_offset); 384 p->data.dir.dir_size - p->publish_offset);
347 pt_block = &p->data.dir.dir_data[p->publish_offset]; 385 dd = p->data.dir.dir_data;
386 pt_block = &dd[p->publish_offset];
348 } 387 }
349 else 388 else
350 { 389 {
351 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE, 390 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE,
352 p->data.file.file_size - p->publish_offset); 391 p->data.file.file_size - p->publish_offset);
353 p->data.file.reader (p->data.file.reader_cls, 392 emsg = NULL;
354 p->publish_offset, 393 if (pt_size !=
355 pt_size, 394 p->data.file.reader (p->data.file.reader_cls,
356 iob, 395 p->publish_offset,
357 &emsg); 396 pt_size,
397 iob,
398 &emsg))
399 {
400 // FIXME: abort with error "emsg"
401 GNUNET_free (emsg);
402 }
358 pt_block = iob; 403 pt_block = iob;
359 } 404 }
360 } 405 }
@@ -367,9 +412,9 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
367 } 412 }
368 off = compute_chk_offset (p->chk_tree_depth - p->current_depth, 413 off = compute_chk_offset (p->chk_tree_depth - p->current_depth,
369 p->publish_offset); 414 p->publish_offset);
370 chk = &p->chk_tree[(p->current_depth-1)*GNUNET_FS_CHK_PER_INODE+off]; 415 mychk = &p->chk_tree[(p->current_depth-1)*GNUNET_FS_CHK_PER_INODE+off];
371 GNUNET_CRYPTO_hash (pt_block, pt_size, &chk->key); 416 GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key);
372 GNUNET_CRYPTO_hash_to_aes_key (&chk->key, &sk, &iv); 417 GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv);
373 GNUNET_CRYPTO_aes_encrypt (pt_block, 418 GNUNET_CRYPTO_aes_encrypt (pt_block,
374 pt_size, 419 pt_size,
375 &sk, 420 &sk,
@@ -379,13 +424,16 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
379 // between publish/unindex! Parameterize & move this code! 424 // between publish/unindex! Parameterize & move this code!
380 // FIXME: something around here would need to change 425 // FIXME: something around here would need to change
381 // for indexing! 426 // for indexing!
382 publish_block (sc, p, enc, pt_size, 427 publish_block (sc, p,
428 &mychk->query,
429 enc,
430 pt_size,
383 (p->current_depth == p->chk_tree_depth) 431 (p->current_depth == p->chk_tree_depth)
384 ? GNUNET_DATASTORE_BLOCKTYPE_DBLOCK 432 ? GNUNET_DATASTORE_BLOCKTYPE_DBLOCK
385 : GNUNET_DATASTORE_BLOCKTYPE_IBLOCK, 433 : GNUNET_DATASTORE_BLOCKTYPE_IBLOCK,
386 &do_upload); 434 &do_upload);
387 // FIXME: should call progress function somewhere here! 435 // FIXME: should call progress function somewhere here!
388 GNUNET_CRYPTO_hash (enc, pt_size, &chk->query); 436 GNUNET_CRYPTO_hash (enc, pt_size, &mychk->query);
389 if (p->current_depth == p->chk_tree_depth) 437 if (p->current_depth == p->chk_tree_depth)
390 { 438 {
391 p->publish_offset += pt_size; 439 p->publish_offset += pt_size;
@@ -404,9 +452,9 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
404 if (0 == p->current_depth) 452 if (0 == p->current_depth)
405 { 453 {
406 p->chk_uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); 454 p->chk_uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri));
407 p->chk_uri.type = chk; 455 p->chk_uri->type = chk;
408 p->chk_uri.data.chk.chk = p->chk_tree[0]; 456 p->chk_uri->data.chk.chk = p->chk_tree[0];
409 p->chk_uri.data.chk.file_length = size; 457 p->chk_uri->data.chk.file_length = size;
410 GNUNET_free (p->chk_tree); 458 GNUNET_free (p->chk_tree);
411 p->chk_tree = NULL; 459 p->chk_tree = NULL;
412 } 460 }
@@ -445,7 +493,8 @@ do_upload (void *cls,
445 publish_kblocks (sc, p); 493 publish_kblocks (sc, p);
446 return; 494 return;
447 } 495 }
448 if (p->do_index) 496 if ( (!p->is_directory) &&
497 (p->data.file.do_index) )
449 { 498 {
450 // FIXME: need to pre-compute hash over 499 // FIXME: need to pre-compute hash over
451 // the entire file and ask FS to prepare 500 // the entire file and ask FS to prepare
@@ -542,7 +591,7 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *sc)
542 GNUNET_FS_namespace_delete (sc->namespace, GNUNET_NO); 591 GNUNET_FS_namespace_delete (sc->namespace, GNUNET_NO);
543 GNUNET_free_non_null (sc->nid); 592 GNUNET_free_non_null (sc->nid);
544 GNUNET_free_non_null (sc->nuid); 593 GNUNET_free_non_null (sc->nuid);
545 GNUNET_DATASTORE_disconnect (sc->dsh); 594 GNUNET_DATASTORE_disconnect (sc->dsh, GNUNET_NO);
546 GNUNET_free (sc); 595 GNUNET_free (sc);
547} 596}
548 597
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
new file mode 100644
index 000000000..58885c234
--- /dev/null
+++ b/src/fs/gnunet-publish.c
@@ -0,0 +1,556 @@
1/*
2 This file is part of GNUnet.
3 (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20/**
21 * @file fs/gnunet-publish.c
22 * @brief publishing files on GNUnet
23 * @author Christian Grothoff
24 * @author Krista Bennett
25 * @author James Blackwell
26 * @author Igor Wronsky
27 *
28 * TODO:
29 * - support for some options is still missing (uri argument, simulate)
30 * - progress callbacks not implemented (and need verbosity option)
31 * - clean shutdown is not implemented (stop ctx, etc.)
32 */
33#include "platform.h"
34#include "gnunet_fs_service.h"
35
36#define DEFAULT_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 2)
37
38static int ret;
39
40static const struct GNUNET_CONFIGURATION_Handle *cfg;
41
42static struct GNUNET_FS_Handle *ctx;
43
44static struct GNUNET_FS_PublishContext *pc;
45
46static struct GNUNET_TIME_Absolute start_time;
47
48static struct GNUNET_CONTAINER_MetaData *meta;
49
50static struct GNUNET_FS_Uri *topKeywords;
51
52static unsigned int anonymity = 1;
53
54static unsigned int priority = 365;
55
56static char *uri_string;
57
58static char *next_id;
59
60static char *this_id;
61
62static char *pseudonym;
63
64static int do_insert;
65
66static int disable_extractor;
67
68static int do_simulate;
69
70static int extract_only;
71
72static int do_disable_creation_time;
73
74
75/**
76 * Called by FS client to give information about the progress of an
77 * operation.
78 *
79 * @param cls closure
80 * @param info details about the event, specifying the event type
81 * and various bits about the event
82 * @return client-context (for the next progress call
83 * for this operation; should be set to NULL for
84 * SUSPEND and STOPPED events). The value returned
85 * will be passed to future callbacks in the respective
86 * field in the GNUNET_FS_ProgressInfo struct.
87 */
88static void *
89progress_cb (void *cls,
90 const struct GNUNET_FS_ProgressInfo *info)
91{
92 return NULL;
93}
94
95
96/**
97 * Print metadata entries (except binary
98 * metadata and the filename).
99 *
100 * @param cls closure
101 * @param type type of the meta data
102 * @param data value of the meta data
103 * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
104 */
105static int
106meta_printer (void *cls,
107 EXTRACTOR_KeywordType type,
108 const char *data)
109{
110 if ( (type == EXTRACTOR_FILENAME) ||
111 (EXTRACTOR_isBinaryType (type)) )
112 return GNUNET_OK;
113 fprintf (stdout,
114 "%s - %s",
115 EXTRACTOR_getKeywordTypeAsString (type),
116 data);
117 return GNUNET_OK;
118}
119
120
121/**
122 * Merge metadata entries (except binary
123 * metadata).
124 *
125 * @param cls closure, target metadata structure
126 * @param type type of the meta data
127 * @param data value of the meta data
128 * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
129 */
130static int
131meta_merger (void *cls,
132 EXTRACTOR_KeywordType type,
133 const char *data)
134{
135 struct GNUNET_CONTAINER_MetaData *m = cls;
136 GNUNET_CONTAINER_meta_data_insert (m,
137 type,
138 data);
139 return GNUNET_OK;
140}
141
142
143/**
144 * Function called on all entries before the
145 * publication. This is where we perform
146 * modifications to the default based on
147 * command-line options.
148 *
149 * @param cls closure
150 * @param fi the entry in the publish-structure
151 * @param length length of the file or directory
152 * @param m metadata for the file or directory (can be modified)
153 * @param uri pointer to the keywords that will be used for this entry (can be modified)
154 * @param anonymity pointer to selected anonymity level (can be modified)
155 * @param priority pointer to selected priority (can be modified)
156 * @param expirationTime pointer to selected expiration time (can be modified)
157 * @param client_info pointer to client context set upon creation (can be modified)
158 * @return GNUNET_OK to continue, GNUNET_NO to remove
159 * this entry from the directory, GNUNET_SYSERR
160 * to abort the iteration
161 */
162static int
163publish_inspector (void *cls,
164 struct GNUNET_FS_FileInformation *fi,
165 uint64_t length,
166 struct GNUNET_CONTAINER_MetaData *m,
167 struct GNUNET_FS_Uri **uri,
168 unsigned int *anonymity,
169 unsigned int *priority,
170 struct GNUNET_TIME_Absolute *expirationTime,
171 void **client_info)
172{
173 char *fn;
174 char *fs;
175 struct GNUNET_FS_Uri *new_uri;
176
177 if (! do_disable_creation_time)
178 GNUNET_CONTAINER_meta_data_add_publication_date (meta);
179 if (NULL != topKeywords)
180 {
181 new_uri = GNUNET_FS_uri_ksk_merge (topKeywords,
182 *uri);
183 GNUNET_FS_uri_destroy (*uri);
184 *uri = new_uri;
185 GNUNET_FS_uri_destroy (topKeywords);
186 topKeywords = NULL;
187 }
188 if (NULL != meta)
189 {
190 GNUNET_CONTAINER_meta_data_get_contents (meta,
191 &meta_merger,
192 m);
193 GNUNET_CONTAINER_meta_data_destroy (meta);
194 meta = NULL;
195 }
196 if (extract_only)
197 {
198 fn = GNUNET_CONTAINER_meta_data_get_by_type (meta,
199 EXTRACTOR_FILENAME);
200 fs = GNUNET_STRINGS_byte_size_fancy (length);
201 fprintf (stdout,
202 _("Keywords for file `%s' (%s)\n"),
203 fn,
204 fs);
205 GNUNET_free (fn);
206 GNUNET_free (fs);
207 GNUNET_CONTAINER_meta_data_get_contents (meta,
208 &meta_printer,
209 NULL);
210 fprintf (stdout, "\n");
211 }
212 if (GNUNET_FS_meta_data_test_for_directory (meta))
213 GNUNET_FS_file_information_inspect (fi,
214 &publish_inspector,
215 NULL);
216 return GNUNET_OK;
217}
218
219
220/**
221 * Main function that will be run by the scheduler.
222 *
223 * @param cls closure
224 * @param sched the scheduler to use
225 * @param args remaining command-line arguments
226 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
227 * @param cfg configuration
228 */
229static void
230run (void *cls,
231 struct GNUNET_SCHEDULER_Handle *sched,
232 char *const *args,
233 const char *cfgfile,
234 const struct GNUNET_CONFIGURATION_Handle *c)
235{
236 struct GNUNET_FS_FileInformation *fi;
237 struct GNUNET_FS_Namespace *namespace;
238 EXTRACTOR_ExtractorList *l;
239 char *ex;
240 char *emsg;
241
242 /* check arguments */
243 if ( ( (uri_string == NULL) || (extract_only) )
244 && ( (args[0] == NULL) || (args[1] != NULL) ) )
245 {
246 printf (_
247 ("You must specify one and only one filename for insertion.\n"));
248 ret = -1;
249 return;
250 }
251 if ((uri_string != NULL) && (args[0] != NULL))
252 {
253 printf (_("You must NOT specify an URI and a filename.\n"));
254 ret = -1;
255 return;
256 }
257 if ((uri_string != NULL) && (extract_only))
258 {
259 printf (_("Cannot extract metadata from a URI!\n"));
260 ret = -1;
261 return;
262 }
263 if (pseudonym != NULL)
264 {
265 if (NULL == this_id)
266 {
267 fprintf (stderr,
268 _("Option `%s' is required when using option `%s'.\n"),
269 "-t", "-P");
270 ret = -1;
271 return;
272 }
273 }
274 else
275 { /* ordinary insertion checks */
276 if (NULL != next_id)
277 {
278 fprintf (stderr,
279 _("Option `%s' makes no sense without option `%s'.\n"),
280 "-N", "-P");
281 ret = -1;
282 return;
283 }
284 if (NULL != this_id)
285 {
286 fprintf (stderr,
287 _("Option `%s' makes no sense without option `%s'.\n"),
288 "-t", "-P");
289 ret = -1;
290 return;
291 }
292 }
293 if (args[0] == NULL)
294 {
295 fprintf (stderr,
296 _("Need the name of a file to publish!\n"));
297 ret = 1;
298 return;
299 }
300 cfg = c;
301 ctx = GNUNET_FS_start (sched,
302 cfg,
303 "gnunet-publish",
304 &progress_cb,
305 NULL);
306 if (NULL == ctx)
307 {
308 fprintf (stderr,
309 _("Could not initialize `%s' subsystem.\n"),
310 "FS");
311 ret = 1;
312 return;
313 }
314 namespace = NULL;
315 if (NULL != pseudonym)
316 {
317 namespace = GNUNET_FS_namespace_create (ctx,
318 pseudonym);
319 if (NULL == namespace)
320 {
321 fprintf (stderr,
322 _("Could not create namespace `%s'\n"),
323 pseudonym);
324 GNUNET_FS_stop (ctx);
325 ret = 1;
326 return;
327 }
328 }
329 if (NULL != uri_string)
330 {
331 // FIXME -- implement!
332 return;
333 }
334 start_time = GNUNET_TIME_absolute_get ();
335
336 l = NULL;
337 if (! disable_extractor)
338 {
339 l = EXTRACTOR_loadDefaultLibraries ();
340 if (GNUNET_OK ==
341 GNUNET_CONFIGURATION_get_value_string (cfg, "FS", "EXTRACTORS",
342 &ex))
343 {
344 if (strlen (ex) > 0)
345 l = EXTRACTOR_loadConfigLibraries (l, ex);
346 GNUNET_free (ex);
347 }
348 }
349 fi = GNUNET_FS_file_information_create_from_directory (NULL,
350 args[0],
351 &GNUNET_FS_directory_scanner_default,
352 l,
353 !do_insert,
354 anonymity,
355 priority,
356 GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
357 &emsg);
358 EXTRACTOR_removeAll (l);
359 if (fi == NULL)
360 {
361 fprintf (stderr,
362 _("Could not publish `%s': %s\n"),
363 args[0],
364 emsg);
365 GNUNET_free (emsg);
366 if (namespace != NULL)
367 GNUNET_FS_namespace_delete (namespace, GNUNET_NO);
368 GNUNET_FS_stop (ctx);
369 ret = 1;
370 return;
371 }
372 GNUNET_FS_file_information_inspect (fi,
373 &publish_inspector,
374 NULL);
375 if (extract_only)
376 {
377 if (namespace != NULL)
378 GNUNET_FS_namespace_delete (namespace, GNUNET_NO);
379 GNUNET_FS_file_information_destroy (fi, NULL, NULL);
380 GNUNET_FS_stop (ctx);
381 return;
382 }
383 pc = GNUNET_FS_publish_start (ctx,
384 NULL,
385 fi,
386 namespace,
387 this_id,
388 next_id);
389}
390
391
392/**
393 * gnunet-publish command line options
394 */
395static struct GNUNET_GETOPT_CommandLineOption options[] = {
396 {'a', "anonymity", "LEVEL",
397 gettext_noop ("set the desired LEVEL of sender-anonymity"),
398 1, &GNUNET_GETOPT_set_uint, &anonymity},
399 {'d', "disable-creation-time", NULL,
400 gettext_noop
401 ("disable adding the creation time to the metadata of the uploaded file"),
402 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time},
403 {'D', "disable-extractor", NULL,
404 gettext_noop
405 ("do not use libextractor to add keywords or metadata"),
406 0, &GNUNET_GETOPT_set_one, &disable_extractor},
407 {'e', "extract", NULL,
408 gettext_noop
409 ("print list of extracted keywords that would be used, but do not perform upload"),
410 0, &GNUNET_GETOPT_set_one, &extract_only},
411 {'k', "key", "KEYWORD",
412 gettext_noop
413 ("add an additional keyword for the top-level file or directory"
414 " (this option can be specified multiple times)"),
415 1, &GNUNET_FS_getopt_set_keywords, &topKeywords},
416 // *: option not yet used... (can handle in a pass over FI)
417 {'m', "meta", "TYPE:VALUE",
418 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
419 1, &GNUNET_FS_getopt_set_metadata, &meta},
420 {'n', "noindex", NULL,
421 gettext_noop ("do not index, perform full insertion (stores entire "
422 "file in encrypted form in GNUnet database)"),
423 0, &GNUNET_GETOPT_set_one, &do_insert},
424 {'N', "next", "ID",
425 gettext_noop
426 ("specify ID of an updated version to be published in the future"
427 " (for namespace insertions only)"),
428 1, &GNUNET_GETOPT_set_string, &next_id},
429 {'p', "priority", "PRIORITY",
430 gettext_noop ("specify the priority of the content"),
431 1, &GNUNET_GETOPT_set_uint, &priority},
432 {'P', "pseudonym", "NAME",
433 gettext_noop
434 ("publish the files under the pseudonym NAME (place file into namespace)"),
435 1, &GNUNET_GETOPT_set_string, &pseudonym},
436 // *: option not yet used... (need FS API support!)
437 {'s', "simulate-only", NULL,
438 gettext_noop ("only simulate the process but do not do any "
439 "actual publishing (useful to compute URIs)"),
440 0, &GNUNET_GETOPT_set_one, &do_simulate},
441 {'t', "this", "ID",
442 gettext_noop ("set the ID of this version of the publication"
443 " (for namespace insertions only)"),
444 1, &GNUNET_GETOPT_set_string, &this_id},
445 // *: option not yet used... (need FS API support!)
446 {'u', "uri", "URI",
447 gettext_noop ("URI to be published (can be used instead of passing a "
448 "file to add keywords to the file with the respective URI)"),
449 1, &GNUNET_GETOPT_set_string, &uri_string},
450 GNUNET_GETOPT_OPTION_END
451};
452
453
454/**
455 * The main function to publish content to GNUnet.
456 *
457 * @param argc number of arguments from the command line
458 * @param argv command line arguments
459 * @return 0 ok, 1 on error
460 */
461int
462main (int argc, char *const *argv)
463{
464 return (GNUNET_OK ==
465 GNUNET_PROGRAM_run (argc,
466 argv,
467 "gnunet-publish",
468 gettext_noop
469 ("Publish files on GNUnet."),
470 options, &run, NULL)) ? ret : 1;
471}
472
473/* end of gnunet-publish.c */
474
475////////////////////////////////////////////////////////////////
476
477
478/**
479 * Print progess message.
480 */
481static void *
482printstatus (void *ctx, const GNUNET_FSUI_Event * event)
483{
484 unsigned long long delta;
485 char *fstring;
486
487 switch (event->type)
488 {
489 case GNUNET_FSUI_upload_progress:
490 if (*verboselevel)
491 {
492 char *ret;
493 GNUNET_CronTime now;
494
495 now = GNUNET_get_time ();
496 delta = event->data.UploadProgress.eta - now;
497 if (event->data.UploadProgress.eta < now)
498 delta = 0;
499 ret = GNUNET_get_time_interval_as_fancy_string (delta);
500 PRINTF (_("%16llu of %16llu bytes inserted "
501 "(estimating %6s to completion) - %s\n"),
502 event->data.UploadProgress.completed,
503 event->data.UploadProgress.total,
504 ret, event->data.UploadProgress.filename);
505 GNUNET_free (ret);
506 }
507 break;
508 case GNUNET_FSUI_upload_completed:
509 if (*verboselevel)
510 {
511 delta = GNUNET_get_time () - start_time;
512 PRINTF (_("Upload of `%s' complete, "
513 "%llu bytes took %llu seconds (%8.3f KiB/s).\n"),
514 event->data.UploadCompleted.filename,
515 event->data.UploadCompleted.total,
516 delta / GNUNET_CRON_SECONDS,
517 (delta == 0)
518 ? (double) (-1.0)
519 : (double) (event->data.UploadCompleted.total
520 / 1024.0 * GNUNET_CRON_SECONDS / delta));
521 }
522 fstring = GNUNET_ECRS_uri_to_string (event->data.UploadCompleted.uri);
523 printf (_("File `%s' has URI: %s\n"),
524 event->data.UploadCompleted.filename, fstring);
525 GNUNET_free (fstring);
526 if (ul == event->data.UploadCompleted.uc.pos)
527 {
528 postProcess (event->data.UploadCompleted.uri);
529 errorCode = 0;
530 GNUNET_shutdown_initiate ();
531 }
532 break;
533 case GNUNET_FSUI_upload_aborted:
534 printf (_("\nUpload aborted.\n"));
535 errorCode = 2;
536 GNUNET_shutdown_initiate ();
537 break;
538 case GNUNET_FSUI_upload_error:
539 printf (_("\nError uploading file: %s"),
540 event->data.UploadError.message);
541 errorCode = 3;
542 GNUNET_shutdown_initiate ();
543 break;
544 case GNUNET_FSUI_upload_started:
545 case GNUNET_FSUI_upload_stopped:
546 break;
547 default:
548 printf (_("\nUnexpected event: %d\n"), event->type);
549 GNUNET_GE_BREAK (ectx, 0);
550 break;
551 }
552 return NULL;
553}
554#endif
555
556/* end of gnunet-publish.c */
diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h
index bc4aeea9b..69bd7d4a6 100644
--- a/src/include/gnunet_connection_lib.h
+++ b/src/include/gnunet_connection_lib.h
@@ -23,8 +23,8 @@
23 * @brief basic, low-level TCP networking interface 23 * @brief basic, low-level TCP networking interface
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_NETWORK_LIB_H 26#ifndef GNUNET_CONNECTION_LIB_H
27#define GNUNET_NETWORK_LIB_H 27#define GNUNET_CONNECTION_LIB_H
28 28
29#ifdef __cplusplus 29#ifdef __cplusplus
30extern "C" 30extern "C"
@@ -325,6 +325,6 @@ GNUNET_NETWORK_connection_notify_transmit_ready_cancel (struct
325#endif 325#endif
326 326
327 327
328/* ifndef GNUNET_NETWORK_LIB_H */ 328/* ifndef GNUNET_CONNECTION_LIB_H */
329#endif 329#endif
330/* end of gnunet_connection_lib.h */ 330/* end of gnunet_connection_lib.h */
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index e2a0787c8..1adae17b1 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Christian Grothoff (and other contributing authors) 3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -201,11 +201,16 @@ typedef int (*GNUNET_CONTAINER_MetaDataProcessor) (void *cls,
201 201
202/** 202/**
203 * Create a fresh MetaData token. 203 * Create a fresh MetaData token.
204 *
205 * @return empty meta-data container
204 */ 206 */
205struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_create (void); 207struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_create (void);
206 208
207/** 209/**
208 * Duplicate a MetaData token. 210 * Duplicate a MetaData token.
211 *
212 * @param meta what to duplicate
213 * @return duplicate meta-data container
209 */ 214 */
210struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_duplicate (const 215struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_duplicate (const
211 struct 216 struct
@@ -214,12 +219,18 @@ struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_duplicate (const
214 219
215/** 220/**
216 * Free meta data. 221 * Free meta data.
222 *
223 * @param md what to free
217 */ 224 */
218void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData 225void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData
219 *md); 226 *md);
220 227
221/** 228/**
222 * Test if two MDs are equal. 229 * Test if two MDs are equal.
230 *
231 * @param md1 first value to check
232 * @param md2 other value to check
233 * @return GNUNET_YES if they are equal
223 */ 234 */
224int GNUNET_CONTAINER_meta_data_test_equal (const struct 235int GNUNET_CONTAINER_meta_data_test_equal (const struct
225 GNUNET_CONTAINER_MetaData *md1, 236 GNUNET_CONTAINER_MetaData *md1,
@@ -229,6 +240,10 @@ int GNUNET_CONTAINER_meta_data_test_equal (const struct
229 240
230/** 241/**
231 * Extend metadata. 242 * Extend metadata.
243 *
244 * @param md metadata to extend
245 * @param type type of the new entry
246 * @param data value for the entry
232 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists 247 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
233 */ 248 */
234int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, 249int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
@@ -237,6 +252,10 @@ int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
237 252
238/** 253/**
239 * Remove an item. 254 * Remove an item.
255 *
256 * @param type type of the item to remove
257 * @param data specific value to remove, NULL to remove all
258 * entries of the given type
240 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md 259 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
241 */ 260 */
242int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, 261int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
@@ -246,6 +265,8 @@ int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
246/** 265/**
247 * Add the current time as the publication date 266 * Add the current time as the publication date
248 * to the meta-data. 267 * to the meta-data.
268 *
269 * @param md metadata to modify
249 */ 270 */
250void GNUNET_CONTAINER_meta_data_add_publication_date (struct 271void GNUNET_CONTAINER_meta_data_add_publication_date (struct
251 GNUNET_CONTAINER_MetaData 272 GNUNET_CONTAINER_MetaData
@@ -254,6 +275,9 @@ void GNUNET_CONTAINER_meta_data_add_publication_date (struct
254/** 275/**
255 * Iterate over MD entries, excluding thumbnails. 276 * Iterate over MD entries, excluding thumbnails.
256 * 277 *
278 * @param md metadata to inspect
279 * @param iterator function to call on each entry
280 * @param closure closure for iterator
257 * @return number of entries 281 * @return number of entries
258 */ 282 */
259int GNUNET_CONTAINER_meta_data_get_contents (const struct 283int GNUNET_CONTAINER_meta_data_get_contents (const struct
@@ -263,6 +287,9 @@ int GNUNET_CONTAINER_meta_data_get_contents (const struct
263 287
264/** 288/**
265 * Get the first MD entry of the given type. 289 * Get the first MD entry of the given type.
290 *
291 * @param md metadata to inspect
292 * @param type type to look for
266 * @return NULL if we do not have any such entry, 293 * @return NULL if we do not have any such entry,
267 * otherwise client is responsible for freeing the value! 294 * otherwise client is responsible for freeing the value!
268 */ 295 */
@@ -272,7 +299,9 @@ char *GNUNET_CONTAINER_meta_data_get_by_type (const struct
272 299
273/** 300/**
274 * Get the first matching MD entry of the given types. 301 * Get the first matching MD entry of the given types.
275 * @paarm ... -1-terminated list of types 302 *
303 * @param md metadata to inspect
304 * @param ... -1-terminated list of types
276 * @return NULL if we do not have any such entry, 305 * @return NULL if we do not have any such entry,
277 * otherwise client is responsible for freeing the value! 306 * otherwise client is responsible for freeing the value!
278 */ 307 */
@@ -283,6 +312,7 @@ char *GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
283/** 312/**
284 * Get a thumbnail from the meta-data (if present). 313 * Get a thumbnail from the meta-data (if present).
285 * 314 *
315 * @param md metadata to inspect
286 * @param thumb will be set to the thumbnail data. Must be 316 * @param thumb will be set to the thumbnail data. Must be
287 * freed by the caller! 317 * freed by the caller!
288 * @return number of bytes in thumbnail, 0 if not available 318 * @return number of bytes in thumbnail, 0 if not available
@@ -294,6 +324,9 @@ size_t GNUNET_CONTAINER_meta_data_get_thumbnail (const struct
294/** 324/**
295 * Extract meta-data from a file. 325 * Extract meta-data from a file.
296 * 326 *
327 * @param md metadata to set
328 * @param filename name of file to inspect
329 * @param extractors plugins to use
297 * @return GNUNET_SYSERR on error, otherwise the number 330 * @return GNUNET_SYSERR on error, otherwise the number
298 * of meta-data items obtained 331 * of meta-data items obtained
299 */ 332 */
@@ -315,12 +348,13 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions
315/** 348/**
316 * Serialize meta-data to target. 349 * Serialize meta-data to target.
317 * 350 *
351 * @param md metadata to serialize
318 * @param size maximum number of bytes available 352 * @param size maximum number of bytes available
319 * @param opt is it ok to just write SOME of the 353 * @param opt is it ok to just write SOME of the
320 * meta-data to match the size constraint, 354 * meta-data to match the size constraint,
321 * possibly discarding some data? 355 * possibly discarding some data?
322 * @return number of bytes written on success, 356 * @return number of bytes written on success,
323 * GNUNET_SYSERR on error (typically: not enough 357 * -1 on error (typically: not enough
324 * space) 358 * space)
325 */ 359 */
326ssize_t GNUNET_CONTAINER_meta_data_serialize (const struct 360ssize_t GNUNET_CONTAINER_meta_data_serialize (const struct
@@ -334,9 +368,12 @@ ssize_t GNUNET_CONTAINER_meta_data_serialize (const struct
334/** 368/**
335 * Compute size of the meta-data in 369 * Compute size of the meta-data in
336 * serialized form. 370 * serialized form.
371 *
372 * @param md metadata to inspect
337 * @param opt is it ok to just write SOME of the 373 * @param opt is it ok to just write SOME of the
338 * meta-data to match the size constraint, 374 * meta-data to match the size constraint,
339 * possibly discarding some data? 375 * possibly discarding some data?
376 * @return number of bytes needed for serialization, -1 on error
340 */ 377 */
341ssize_t GNUNET_CONTAINER_meta_data_get_serialized_size (const struct 378ssize_t GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
342 GNUNET_CONTAINER_MetaData 379 GNUNET_CONTAINER_MetaData
@@ -347,6 +384,8 @@ ssize_t GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
347 384
348/** 385/**
349 * Deserialize meta-data. Initializes md. 386 * Deserialize meta-data. Initializes md.
387 *
388 * @param input serialized meta-data.
350 * @param size number of bytes available 389 * @param size number of bytes available
351 * @return MD on success, NULL on error (i.e. 390 * @return MD on success, NULL on error (i.e.
352 * bad format) 391 * bad format)
@@ -359,6 +398,7 @@ struct GNUNET_CONTAINER_MetaData
359 * Does the meta-data claim that this is a directory? 398 * Does the meta-data claim that this is a directory?
360 * Checks if the mime-type is that of a GNUnet directory. 399 * Checks if the mime-type is that of a GNUnet directory.
361 * 400 *
401 * @param md metadata to inspect
362 * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if 402 * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if
363 * we have no mime-type information (treat as 'GNUNET_NO') 403 * we have no mime-type information (treat as 'GNUNET_NO')
364 */ 404 */
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index 3c71d40e7..f78ed51e5 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -21,6 +21,10 @@
21 * @file include/gnunet_fs_service.h 21 * @file include/gnunet_fs_service.h
22 * @brief API for file-sharing via GNUnet 22 * @brief API for file-sharing via GNUnet
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 *
25 * TODO:
26 * - extend API with support for publish simulation (-s)
27 * and URI-argument binding to keyword/namespace (-u)
24 */ 28 */
25#ifndef GNUNET_FS_LIB_H 29#ifndef GNUNET_FS_LIB_H
26#define GNUNET_FS_LIB_H 30#define GNUNET_FS_LIB_H
@@ -398,7 +402,7 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData
398 * @return GNUNET_OK on success 402 * @return GNUNET_OK on success
399 */ 403 */
400int 404int
401GNUNET_FS_getopt_configure_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, 405GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
402 void *scls, 406 void *scls,
403 const char *option, 407 const char *option,
404 const char *value); 408 const char *value);
@@ -417,7 +421,7 @@ GNUNET_FS_getopt_configure_set_keywords (struct GNUNET_GETOPT_CommandLineProcess
417 * @return GNUNET_OK on success 421 * @return GNUNET_OK on success
418 */ 422 */
419int 423int
420GNUNET_FS_getopt_configure_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, 424GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx,
421 void *scls, 425 void *scls,
422 const char *option, 426 const char *option,
423 const char *value); 427 const char *value);
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h
index baba3aba8..645353520 100644
--- a/src/include/gnunet_network_lib.h
+++ b/src/include/gnunet_network_lib.h
@@ -24,8 +24,8 @@
24 * @author Nils Durner 24 * @author Nils Durner
25 */ 25 */
26 26
27#ifndef GNUNET_NETWORK_LIB_H_ 27#ifndef GNUNET_NETWORK_LIB_H
28#define GNUNET_NETWORK_LIB_H_ 28#define GNUNET_NETWORK_LIB_H
29 29
30#ifdef __cplusplus 30#ifdef __cplusplus
31extern "C" 31extern "C"
@@ -54,6 +54,11 @@ struct GNUNET_NETWORK_Descriptor *GNUNET_NETWORK_socket_accept (const struct GNU
54 struct sockaddr *address, 54 struct sockaddr *address,
55 socklen_t *address_len); 55 socklen_t *address_len);
56 56
57int
58GNUNET_NETWORK_socket_set_inheritable (const struct GNUNET_NETWORK_Descriptor
59 *desc);
60
61
57int GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Descriptor *desc, 62int GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Descriptor *desc,
58 const struct sockaddr *address, socklen_t address_len); 63 const struct sockaddr *address, socklen_t address_len);
59 64
@@ -128,7 +133,7 @@ int GNUNET_NETWORK_fdset_handle_isset (const struct GNUNET_NETWORK_FDSet *fds,
128 133
129int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1, const struct GNUNET_NETWORK_FDSet *fds2); 134int GNUNET_NETWORK_fdset_overlap (const struct GNUNET_NETWORK_FDSet *fds1, const struct GNUNET_NETWORK_FDSet *fds2);
130 135
131struct GNUNET_NETWORK_FDSet *GNUNET_NETWORK_fdset_create (); 136struct GNUNET_NETWORK_FDSet *GNUNET_NETWORK_fdset_create (void);
132 137
133void GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds); 138void GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds);
134 139
@@ -140,4 +145,4 @@ void GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds);
140} 145}
141#endif 146#endif
142 147
143#endif /* GNUNET_NETWORK_LIB_H_ */ 148#endif /* GNUNET_NETWORK_LIB_H */
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index f6c1783a6..d58d80bac 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -37,6 +37,7 @@ libgnunetutil_la_SOURCES = \
37 getopt.c \ 37 getopt.c \
38 getopt_helpers.c \ 38 getopt_helpers.c \
39 network.c \ 39 network.c \
40 network_socket.c \
40 os_installation.c \ 41 os_installation.c \
41 os_load.c \ 42 os_load.c \
42 os_network.c \ 43 os_network.c \
@@ -49,7 +50,6 @@ libgnunetutil_la_SOURCES = \
49 server_tc.c \ 50 server_tc.c \
50 service.c \ 51 service.c \
51 signal.c \ 52 signal.c \
52 sock.c \
53 strings.c \ 53 strings.c \
54 time.c \ 54 time.c \
55 $(WINSRC) 55 $(WINSRC)
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index d80c5fd2b..4cb4ea148 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -689,6 +689,10 @@ FAILURE:
689 689
690/** 690/**
691 * Test if two MDs are equal. 691 * Test if two MDs are equal.
692 *
693 * @param md1 first value to check
694 * @param md2 other value to check
695 * @return GNUNET_YES if they are equal
692 */ 696 */
693int 697int
694GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData 698GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
diff --git a/src/util/sock.c b/src/util/network_socket.c
index 33b6df148..59afb7246 100644
--- a/src/util/sock.c
+++ b/src/util/network_socket.c
@@ -675,4 +675,4 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
675#endif 675#endif
676} 676}
677 677
678/* end of io.c */ 678/* end of sock.c */