summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2023-07-24 21:59:54 +0200
committerMaxime Devos <maximedevos@telenet.be>2023-07-24 21:59:54 +0200
commit17a79576a63b3baa7927a5b720874db4c8616727 (patch)
tree85ef0117cb3ce8a19c8cd8b755595895318190d5
parent0c753bb8b5db5e680c21f95e9800e47e86bb83ad (diff)
doc: Propose how to write (gnu gnunet ... struct) modules.HEADmaster
* doc/network-structures.tm ("Writing new (gnu gnunet ... struct) modules, converted from C"): Propose it!
-rw-r--r--doc/network-structures.tm33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/network-structures.tm b/doc/network-structures.tm
index 3f65c93..113062d 100644
--- a/doc/network-structures.tm
+++ b/doc/network-structures.tm
@@ -320,6 +320,39 @@
In contrast to C structures, Scheme-GNUnet network structures are always
packed \V there are no \<#2018\>gaps\<#2019\> between fields.
+
+ <section|Writing new (gnu gnunet <text-dots> struct) modules, converted
+ from C<index|(gnu gnunet <text-dots> struct)>>
+
+ In Scheme-GNUnet, the message types for a service are defined in a module
+ named <scm|(gnu gnunet ... struct)>, where <scm|...> is a symbol
+ representing the service. If you want to port a service from the C
+ implementation to Scheme, the following approach is recommended
+
+ <\enumerate>
+ <item>Download the source code of the C implementation.
+
+ <item>Go to the directory containing the implementation of the service.
+
+ <item>Search for <cpp|struct GNUNET_MessageHeader header;>, e.g. with
+ <code*|git grep -F GNUNET_MessageHeader>. C structures containing this
+ field are usually network messages that need a Scheme definition.
+
+ <item>Write the Scheme equivalent of these C structures.
+
+ <item>While you're at it, try clarifying the comments (which in Scheme
+ become \<#2018\>synopsis\<#2019\> and \<#2018\>description\<#2019\>) \U
+ if you read the description, do you understand when then message should
+ be sent and when it can received? Are there request-response pairs? \U
+ You don't have to make a literal copy of the C comments.
+
+ To better understand the message types, you can read the C implementation
+ or the \<#2018\>developer manual' \U at time of writing, GANA does not
+ have specifications of the client-service protocol.
+
+ The information you learn along the way will most likely be useful for
+ completing the port.
+ </enumerate>
</body>
<\initial>