hxing
[oweals/gnunet.git] / src / fs / fs.h
1 /*
2      This file is part of GNUnet.
3      (C) 2003, 2004, 2005, 2006, 2007, 2008, 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 /**
22  * @file fs/fs.h
23  * @brief definitions for the entire fs module
24  * @author Igor Wronsky, Christian Grothoff
25  */
26 #ifndef FS_H
27 #define FS_H
28
29 /**
30  * @brief content hash key
31  */
32 struct ContentHashKey 
33 {
34   GNUNET_HashCode key;
35   GNUNET_HashCode query;
36 };
37
38
39 /**
40  * @brief complete information needed
41  * to download a file.
42  */
43 struct FileIdentifier
44 {
45
46   /**
47    * Total size of the file in bytes. (network byte order (!))
48    */
49   unsigned long long file_length;
50
51   /**
52    * Query and key of the top GNUNET_EC_IBlock.
53    */
54   struct ContentHashKey chk;
55
56 };
57
58
59 /**
60  * Information about a file and its location
61  * (peer claiming to share the file).
62  */
63 struct Location
64 {
65   /**
66    * Information about the shared file.
67    */
68   struct FileIdentifier fi;
69
70   /**
71    * Identity of the peer sharing the file.
72    */
73   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
74
75   /**
76    * Time when this location URI expires.
77    */
78   struct GNUNET_TIME_Absolute expirationTime;
79
80   /**
81    * RSA signature over the GNUNET_EC_FileIdentifier,
82    * GNUNET_hash of the peer and expiration time.
83    */
84   struct GNUNET_CRYPTO_RsaSignature contentSignature;
85
86 };
87
88 enum uri_types
89 { chk, sks, ksk, loc };
90
91 /**
92  * A Universal Resource Identifier (URI), opaque.
93  */
94 struct GNUNET_FS_Uri
95 {
96   enum uri_types type;
97   union
98   {
99     struct
100     {
101       /**
102        * Keywords start with a '+' if they are
103        * mandatory (in which case the '+' is NOT
104        * part of the keyword) and with a
105        * simple space if they are optional
106        * (in which case the space is ALSO not
107        * part of the actual keyword).
108        *
109        * Double-quotes to protect spaces and
110        * %-encoding are NOT used internally
111        * (only in URI-strings).
112        */
113       char **keywords;
114       unsigned int keywordCount;
115     } ksk;
116     struct
117     {
118       GNUNET_HashCode namespace;
119       char *identifier;
120     } sks;
121     struct FileIdentifier chk;
122     struct Location loc;
123   } data;
124
125 };
126
127 #endif