aboutsummaryrefslogtreecommitdiff
path: root/gnu/gnunet/nse
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-02-10 18:24:29 +0100
committerMaxime Devos <maximedevos@telenet.be>2021-09-21 12:08:35 +0200
commit66286858b7f677bf6cdfcd97be5b02e322842013 (patch)
treea44fa285697a472e9e32d007fd50284cad54f41b /gnu/gnunet/nse
parent8cc99691c6a832da125f4e50d98c67e29eff5497 (diff)
downloadgnunet-scheme-66286858b7f677bf6cdfcd97be5b02e322842013.tar.gz
gnunet-scheme-66286858b7f677bf6cdfcd97be5b02e322842013.zip
nse: define network structures.
* gnu/gnunet/nse/struct.scm: new module, defining some NSE network structures. * Makefile.am (modules): compile it.
Diffstat (limited to 'gnu/gnunet/nse')
-rw-r--r--gnu/gnunet/nse/struct.scm74
1 files changed, 74 insertions, 0 deletions
diff --git a/gnu/gnunet/nse/struct.scm b/gnu/gnunet/nse/struct.scm
new file mode 100644
index 0000000..7ecd8c9
--- /dev/null
+++ b/gnu/gnunet/nse/struct.scm
@@ -0,0 +1,74 @@
1;; This file is part of scheme-GNUnet
2;; Copyright (C) 2001-2011 GNUnet e.V.
3;; Copyright (C) 2021 Maxime Devos
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
20;; Author (GNUnet): Nathan Evans
21;; File (GNUnet): nse/nse.h
22;;
23;; Brief: Common type definitions for the network size estimation
24;; service and API.
25
26(define-library (gnu gnunet nse struct (0 0))
27 (export /:msg:nse:estimate
28 /:msg:nse:flood)
29 (import (only (rnrs base)
30 define-syntax begin)
31 (gnu gnunet utils netstruct)
32 (gnu gnunet hashcode struct)
33 (gnu gnunet util struct))
34 (begin
35 ;; Network size estimate sent from the service
36 ;; to clients. Contains the current size estimate
37 ;; (or 0 if none has been calculated) and the
38 ;; standard deviation of known estimates.
39 (define-syntax /:msg:nse:estimate
40 (structure/packed
41 ;; Type: msg:nse:estimate
42 ("header" /message-header)
43 ("reserved" u32/big)
44 ("timestamp" /time-absolute)
45 ("size-estimate" ieee-double/big)
46 ("std-deviation" ieee-double/big)))
47
48 ;; Network size estimate reply; sent when "this"
49 ;; peer's timer has run out before receiving a
50 ;; valid reply from another peer.
51 (define-syntax /:msg:nse:flood
52 (structure/packed
53 ;; Type: msg:nse:flood
54 ("header" /message-header)
55 ;; Number of hops this message has taken so far.
56 ("hop-count" u32/big)
57 ;; Purpose.
58 ("purpose" /ecc-signature-purpose)
59 ;; The current timestamp value (which all
60 ;; peers should agree on).
61 ("timestamp" /time-absolute)
62 ;; Number of matching bits between the hash
63 ;; of timestamp and the initiator's public
64 ;; key.
65 ;; XXX add to (gnu gnunet util struct)
66 ("matching-bits" u32/big)
67 ;; Public key of the originator.
68 ("origin" /peer-identity)
69 ;; Proof of work, causing leading zeros when hashed with pkey.
70 ("proof-of-work" u64/big)
71 ;; Signature (over range specified in purpose).
72 ("signature" /eddsa-signature)))))
73
74