IMPL4.md (937B)
1 # IMPL4: Recoverable partial framing 2 3 ## Steps 4 1) Define a result ADT, e.g.: 5 data FrameResult = NeedMore !Int 6 | FrameOk !ByteString !ByteString !Session 7 | FrameError !Error 8 2) Add a new function (decrypt_frame_partial) that returns FrameResult. 9 - If buffer < 18, return NeedMore (18 - len). 10 - If length decrypt fails due to short buffer, return NeedMore. 11 - If buffer < 18 + len + 16, return NeedMore (needed bytes). 12 - MAC/parse failures return FrameError. 13 3) Keep decrypt_frame strict or re-implement it as a wrapper that 14 converts NeedMore into InvalidLength. 15 4) Add tests: 16 - Buffer smaller than 18 returns NeedMore. 17 - Buffer with full length header but short body returns NeedMore. 18 - Full frame returns FrameOk with remainder. 19 5) Update Haddocks to describe partial behavior. 20 21 ## Notes 22 - Use a new ADT to avoid breaking existing Error semantics. 23 - No new dependencies.