Commit Graph

152 Commits

Author SHA1 Message Date
Mark Spanbroek 8422282203 Read packet number from short packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek b8832cc6d8 Read destination id from short packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 6e56d16c0d Read spin bit and key phase from short packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 10b69064ee Write payload of short packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek c9534fcd61 Write destination and packet number for short packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek acfe147dea Introduce PacketShort for short packet specific fields 2020-09-30 09:20:32 +02:00
Mark Spanbroek 21589b99d6 Write key phase for short packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 1d250c9715 Write reserved bits for short header 2020-09-30 09:20:32 +02:00
Mark Spanbroek 77e3a39e2f Write spin bit for short packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 8211ab03ea Rename: Header* -> Packet* 2020-09-30 09:20:32 +02:00
Mark Spanbroek 2cb6762c98 Determines length of an initial packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 349588c9ac Read packet number and payload for initial packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 0f6488b457 Read token from initial packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 23b99d1256 Write packet number and payload for initial packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek bd41269179 Write token for initial packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 2039a8d66e Determines length of 0-RTT packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek df51a50181 Read packet number and payload for 0-RTT packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek ae5646ffb2 Write packet number and payload for 0-RTT packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 62422a610e Determines length of a handshake packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek ccb590032c Write handshake payload 2020-09-30 09:20:32 +02:00
Mark Spanbroek 8cdf0c7a0b Extract PacketWriter to separate file 2020-09-30 09:20:32 +02:00
Mark Spanbroek 5d35c54cc5 Extract PacketReader to separate file 2020-09-30 09:20:32 +02:00
Mark Spanbroek e01ee2314b Construct packet inside PacketReader 2020-09-30 09:20:32 +02:00
Mark Spanbroek 04fc7da084 Packet numbers can be at most 4 bytes in a packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek f7db532ed5 Introduce reader state 2020-09-30 09:20:32 +02:00
Mark Spanbroek 43a6ef3639 Replace repeated offset calculations with writer state 2020-09-30 09:20:32 +02:00
Mark Spanbroek 0ebb0dad4d Extract proc that converts packet numbers to bytes 2020-09-30 09:20:32 +02:00
Mark Spanbroek 356b8fd8a9 Write packet number for handshake packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek e8c3d2083e Fix typo 2020-09-30 09:20:32 +02:00
Mark Spanbroek 81a904b5f0 Read payload from handshake packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek fa70844b51 Read packet number for handshake packets 2020-09-30 09:20:32 +02:00
Mark Spanbroek 3fcccb1362 Remove duplication 2020-09-30 09:20:32 +02:00
Mark Spanbroek ac3e79f24b Read token and integrity tag from retry packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 81fe228e69 Writes retry integrity tag 2020-09-30 09:20:32 +02:00
Mark Spanbroek eab9253a87 Slice assignment for openarrays 2020-09-30 09:20:32 +02:00
Mark Spanbroek 0ca1440bd8 Writes retry token 2020-09-30 09:20:32 +02:00
Mark Spanbroek 37d2e0364b Determines length of a retry packet 2020-09-30 09:20:32 +02:00
Mark Spanbroek 1e748a4719 Decoding of variable length integers 2020-09-30 09:20:32 +02:00
Mark Spanbroek 5f94cf733b Variable length encoding of integers 2020-09-30 09:20:32 +02:00
Mark Spanbroek 60af5afb2e Rename: packetLength -> len 2020-09-30 09:20:32 +02:00
Mark Spanbroek 0f7d8e1a26 Writes supported version 2020-09-30 09:20:32 +02:00
Mark Spanbroek a2d0be717f Write source and destination id 2020-09-30 09:20:32 +02:00
Mark Spanbroek 1c20c08f55 Restructure tests to fit the restructured implementation 2020-09-23 15:04:49 +02:00
Mark Spanbroek afcf424e47 Rename: header -> packet 2020-09-23 15:04:49 +02:00
Mark Spanbroek be3074f739 Split packets.nim into several files 2020-09-23 15:04:49 +02:00
Mark Spanbroek df754f0ee3 Replace byte indexing by stews/endians2 2020-09-23 15:04:49 +02:00
Mark Spanbroek d035339aae Avoid exceptions in packet handling
This ensures that compilation fails when we accidentally
introduce a proc that raises an exception.
2020-09-23 15:04:49 +02:00
Mark Spanbroek ccd3ebd4a7 Use doAssert instead of assert
Ensures that the assert happens in all compile modes
2020-09-23 15:04:49 +02:00
Mark Spanbroek 78a9b4c9de Remove unnecessary use of 'result' variable 2020-09-23 15:04:49 +02:00
Mark Spanbroek c92c076dca Use openArray[byte] instead of seq[byte] for datagrams 2020-09-23 15:04:49 +02:00