diff options
author | Florian Dold <florian.dold@gmail.com> | 2014-01-20 21:40:51 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2014-01-20 21:40:51 +0000 |
commit | 3a2a1606212735771bed822807495214ca780ea0 (patch) | |
tree | af057cdd8165435c9da60fbf6f7efa07cc7b3c13 /src/main/java/org/gnunet/gns/GnsRecord.java | |
parent | 43153f4399d72bf75c9434fe65dac09666dc5d73 (diff) | |
download | gnunet-java-3a2a1606212735771bed822807495214ca780ea0.tar.gz gnunet-java-3a2a1606212735771bed822807495214ca780ea0.zip |
- rudimentary support for GNS
- issues
Diffstat (limited to 'src/main/java/org/gnunet/gns/GnsRecord.java')
-rw-r--r-- | src/main/java/org/gnunet/gns/GnsRecord.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/gns/GnsRecord.java b/src/main/java/org/gnunet/gns/GnsRecord.java new file mode 100644 index 0000000..431ef07 --- /dev/null +++ b/src/main/java/org/gnunet/gns/GnsRecord.java | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2012, 2013 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 3, 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 | package org.gnunet.gns; | ||
22 | |||
23 | import org.gnunet.construct.Message; | ||
24 | import org.gnunet.construct.UInt32; | ||
25 | import org.gnunet.construct.UInt64; | ||
26 | import org.gnunet.construct.VariableSizeIntegerArray; | ||
27 | |||
28 | /** | ||
29 | * A GNS record. | ||
30 | */ | ||
31 | public class GnsRecord implements Message { | ||
32 | /** | ||
33 | * No special options. | ||
34 | */ | ||
35 | public static final int FLAG_NONE = 0; | ||
36 | /** | ||
37 | * No special options. | ||
38 | */ | ||
39 | public static final int FLAG_PRIVATE = 2; | ||
40 | /** | ||
41 | * This record was added automatically by the system | ||
42 | * and is pending user confimation. | ||
43 | */ | ||
44 | public static final int FLAG_PENDING = 4; | ||
45 | /** | ||
46 | * This expiration time of the record is a relative | ||
47 | * time (not an absolute time). | ||
48 | */ | ||
49 | public static final int FLAG_RELATIVE_EXPIRATION = 8; | ||
50 | /** | ||
51 | * This record should not be used unless all (other) records with an absolute | ||
52 | * expiration time have expired. | ||
53 | */ | ||
54 | public static final int FLAG_SHADOW_RECOD = 8; | ||
55 | /** | ||
56 | * Either absolute or relative expiration time, | ||
57 | * depending on 'flags'. | ||
58 | */ | ||
59 | @UInt64 | ||
60 | public long expirationTime; | ||
61 | |||
62 | /** | ||
63 | * Size of the record data. | ||
64 | */ | ||
65 | @UInt32 | ||
66 | public int dataSize; | ||
67 | |||
68 | /** | ||
69 | * Type of the record. | ||
70 | */ | ||
71 | @UInt32 | ||
72 | public int recordType; | ||
73 | |||
74 | /** | ||
75 | * Flags for the record. | ||
76 | */ | ||
77 | @UInt32 | ||
78 | int flags; | ||
79 | |||
80 | /** | ||
81 | * Binary value stored in the GNS record. | ||
82 | */ | ||
83 | @VariableSizeIntegerArray(lengthField = "dataSize", bitSize = 8, signed = false) | ||
84 | byte[] data; | ||
85 | |||
86 | } | ||