[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] 29/324: Define meta data structures systematically
From: |
gnunet |
Subject: |
[gnunet-scheme] 29/324: Define meta data structures systematically |
Date: |
Tue, 21 Sep 2021 13:21:09 +0200 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
commit ba4cc591482d92c91517048333c8df417b152d4f
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Nov 18 22:28:29 2020 +0100
Define meta data structures systematically
TODO wrap-reader-setter
---
gnu/gnunet/metadata/struct.scm | 78 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/gnu/gnunet/metadata/struct.scm b/gnu/gnunet/metadata/struct.scm
new file mode 100644
index 0000000..7d8c420
--- /dev/null
+++ b/gnu/gnunet/metadata/struct.scm
@@ -0,0 +1,78 @@
+;; This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
+;; Adapted from an iteration of (gnu gnunet metadata)
+;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 GNUnet e.V.
+;; Copyright (C) 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
+;;
+;; GNUnet is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU Affero General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+;;
+;; GNUnet is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; Affero General Public License for more details.
+;;
+;; You should have received a copy of the GNU Affero General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;;
+;; SPDX-License-Identifier: AGPL-3.0-or-later
+;;
+;; As a special exception to the GNU Affero General Public License,
+;; the file may be relicensed under any license used for
+;; most source code of GNUnet 0.13.1, or later versions, as published by
+;; GNUnet e.V.
+
+;; Scheme port author: Maxime Devos
+;; Scheme module: (gnu gnunet metadata struct)
+;; Brief: meta data structure definitions
+(library (gnu gnunet metadata struct)
+ (export MetaDataHeader MetaDataEntry
+ MetaType MetaFormat)
+ (import (only (gnu gnunet utils netstruct)
+ structure/packed u32/big
+ sizeof wrap-reader-setter)
+ (only (gnu extractor metaformats)
+ integer->meta-format meta-format->integer)
+ (only (gnu extractor metatypes)
+ integer->meta-type meta-type->integer)
+ (only (rnrs base) define-syntax assert =))
+
+ (define-syntax MetaDataHeader
+ (structure/packed
+ ;; The version of the MD serialization. The highest bit is used to
+ ;; indicate compression.
+ ;;
+ ;; Version 0 is traditional (pre-0.9) meta data (unsupported)
+ ;; Version is 1 for a NULL pointer
+ ;; Version 2 is for 0.9.x (and possibly higher)
+ ;; Other version numbers are not yet defined.
+ (version u32/big)
+ ;; How many MD entries are there?
+ (entries u32/big)
+ ;; Number of bytes of meta data
+ (size u32/big)))
+
+ (assert (= (sizeof MetaDataHeader ()) 12))
+
+ (define-syntax MetaType
+ (wrap-reader-setter u32/big integer->meta-type meta-type->integer))
+ (define-syntax MetaFormat
+ (wrap-reader-setter u32/big integer->meta-format meta-format->integer))
+
+ (define-syntax MetaDataEntry
+ (structure/packed
+ ;; Meta data type
+ (type MetaType)
+ ;; Meta data format (UTF8, binary, ...)
+ (format MetaFormat)
+ ;; Number of bytes in meta data.
+ (data-size u32/big)
+ ;; Number of bytes in the plugin name including 0-terminator.
+ ;; 0 for no plugin name.
+ (plugin-name-length u32/big)
+ ;; Number of bytes in the mime type including 0-terminator.
+ ;; 0 for NULL.
+ (mime-type-length u32/big)))
+
+ (assert (= (sizeof MetaDataEntry ()) 20)))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet-scheme] 27/324: Define bytevector slices, (continued)
- [gnunet-scheme] 27/324: Define bytevector slices, gnunet, 2021/09/21
- [gnunet-scheme] 09/324: Fix libextractor imports, gnunet, 2021/09/21
- [gnunet-scheme] 11/324: Fix some imports and exports, gnunet, 2021/09/21
- [gnunet-scheme] 17/324: Fix libextractor imports, gnunet, 2021/09/21
- [gnunet-scheme] 20/324: Define missing constants, gnunet, 2021/09/21
- [gnunet-scheme] 23/324: Correct variable reference, gnunet, 2021/09/21
- [gnunet-scheme] 24/324: Regularise naming convention, gnunet, 2021/09/21
- [gnunet-scheme] 25/324: Extend let^, gnunet, 2021/09/21
- [gnunet-scheme] 30/324: Correct maximum in metaformats.scm and metatypes.scm, gnunet, 2021/09/21
- [gnunet-scheme] 26/324: Port meta-data-serialize/uncached, gnunet, 2021/09/21
- [gnunet-scheme] 29/324: Define meta data structures systematically,
gnunet <=
- [gnunet-scheme] 31/324: fix netstruct, and implement wrap-reader-setter, gnunet, 2021/09/21
- [gnunet-scheme] 28/324: Define library for structures, gnunet, 2021/09/21
- [gnunet-scheme] 34/324: scripts: add incomplete script for publishing a store item, gnunet, 2021/09/21
- [gnunet-scheme] 33/324: include some notes on reverse-engineering GNUdirs, gnunet, 2021/09/21
- [gnunet-scheme] 36/324: scripts: publish-store: eliminate add-name, gnunet, 2021/09/21
- [gnunet-scheme] 32/324: remove some uses of old accessors, gnunet, 2021/09/21
- [gnunet-scheme] 41/324: scripts: publish-store: fix predicate of --format option, gnunet, 2021/09/21
- [gnunet-scheme] 38/324: scripts: publish-store: publish whole trees, gnunet, 2021/09/21
- [gnunet-scheme] 37/324: scripts: publish-store: publish individual files, gnunet, 2021/09/21
- [gnunet-scheme] 40/324: scripts: publish-store: allow setting all options, gnunet, 2021/09/21