www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAoC 2022] QUIC Protocol : Milestone 1, Part 1

reply Vlad =?UTF-8?B?Q2hpY2/ImQ==?= <vladut.chicos gmail.com> writes:
Hi!

During SAOC I will work on implementing the QUIC protocol in D. 
The first step in achieving this is to obtain a successful 
handshake between my implementation and another compliant 
implementation. This week I wrote a "quic.crypto" module that 
contains encryption methods needed both for the handshake phase 
and the latter communication. You can see it here : 
https://github.com/dlang-community/quic-d/blob/devel/src/quic/crypto.d.
Unittests were added to make sure that my code stays compliant with the spec as
I progress.

The next task on my list is to add the required packet frames for 
a successful handshake. Converting an array of bytes into usable 
data structures is an interesting problem as both the size of the 
fields and their number can vary.

References :

https://datatracker.ietf.org/doc/html/rfc9000
https://datatracker.ietf.org/doc/html/rfc9001

Suggestions are welcome :).
Thank you!
Sep 25 2022
parent Adam D Ruppe <destructionator gmail.com> writes:
On Sunday, 25 September 2022 at 20:51:49 UTC, Vlad ChicoČ™ wrote:
 Converting an array of bytes into usable data structures is an 
 interesting problem as both the size of the fields and their 
 number can vary.
You probably want to treat it like deserializing a stream instead of trying to paint the struct directly over the content. If there's just a few possibilities, you might express it as a union and button that up behind some property getters to keep it consistent... but really having a simple struct with the work done in a "loadFromPacket" kind of function is less likely to have bugs.
Sep 25 2022