Skip to content
Snippets Groups Projects

Resolve "Encapsulation of messages"

Merged v-lafeychine requested to merge 1-encapsulation-of-messages into master
4 unresolved threads

Closes #1 (closed)

Merge request reports

Pipeline #12459 passed

Pipeline passed for 3a7824dd on 1-encapsulation-of-messages

Test coverage 25.00% from 1 job

Merged by v-lafeychinev-lafeychine 2 years ago (Feb 4, 2023 8:51pm UTC)

Loading

Pipeline #12481 passed

Pipeline passed for 03c64c4c on master

Test coverage 25.00% from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
src/error.rs 0 → 100644
3 use serde::{de, ser};
4
5 #[derive(Debug, PartialEq, Eq)]
6 pub enum Error {
7 Message(String),
8 }
9
10 impl std::error::Error for Error {}
11
12 impl Display for Error {
13 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14 match self {
15 Error::Message(msg) => write!(f, "Error : {}", msg),
16 }
17 }
18 }
  • 19 19
    20 20 clap = { version = "4.0", features = ["derive"] }
    21 21
    22 serde = "1.0.152"
  • src/messages.rs 0 → 100644
    19 }
    20
    21 /// MIRC message structure
    22 #[derive(Debug, PartialEq, Eq)]
    23 pub struct Message<'a> {
    24 /// Has to be equal to 95 to be correct
    25 pub magic: u8,
    26
    27 /// Has to be equal to 0
    28 pub version: u8,
    29
    30 /// List of TLV
    31 pub body: Body<'a>,
    32 }
    33
    34 pub type Body<'a> = Vec<TLV<'a>>;
  • Can you format + fix clippy issues, in order to get pipeline coverage report

    Edited by v-lafeychine
  • src/messages.rs 0 → 100644
    8
    9 use crate::{
    10 error::Error,
    11 serialization::ByteString,
    12 visitors::{SeqVisitor, U64Visitor, U8Visitor},
    13 };
    14
    15 /// Trait indicating that it is possible to obtain the length of its byte representation
    16 trait ByteLength {
    17 /// Return the length of its byte representation
    18 fn byte_length(&self) -> usize;
    19 }
    20
    21 /// MIRC message structure
    22 #[derive(Debug, PartialEq, Eq)]
    23 pub struct Message<'a> {
  • I think a little refactor has to be done.

    payload/mod.rs:

    trait ByteLength

    payload/serializer.rs

    payload/visitors.rs

    payload/message.rs:

    pub struct Message
    impl Default for Message<'_>
    impl<'_> Message<'_>
    impl Serialize for Message

    payload/tlv/mod.rs:

    pub enum TLV
    impl TLV<'_>
    impl Serialize for TLV<'_>
    impl Deserialize<'_> for TLV<'_>
    
    trait TLV: Serialize + Deserialize

    And, for each TLV t in message/tlv/t.rs:

    impl ByteLength for t
    
    impl Serialize for t
    impl Deserialize for t
    
    impl TLV for t
    Edited by v-lafeychine
  • pigeonmoelleux added 1 commit

    added 1 commit

    • ac0785b2 - feat: End of serialization/deserialization before refactor

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    • adad310c - fix: fixed linter and formatter

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    • c54d92c2 - fix: fixed decimal constants prefixed by 0

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    • fa32b56c - chore: Refactor in progress : complete for Pad1 and PadN

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    • 52d06759 - chore(refactor): added hello TLV

    Compare with previous version

  • pigeonmoelleux added 2 commits

    added 2 commits

    • 5bd32306 - chore(refactor): Refactor complete + unit tests added for each TLV
    • 78746991 - chore(refactor): Cleaned + add tests for Message

    Compare with previous version

  • pigeonmoelleux added 1 commit

    added 1 commit

    • 3a7824dd - feat: Add comments and unit tests

    Compare with previous version

  • v-lafeychine approved this merge request

    approved this merge request

  • merged

  • v-lafeychine mentioned in commit 03c64c4c

    mentioned in commit 03c64c4c

  • Please register or sign in to reply
    Loading