Code Monkey home page Code Monkey logo

go-hdlc's People

Contributors

samherrmann avatar zaninime avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

go-hdlc's Issues

Do not escape/remove octet with value less than 0x20 if not flagged in ACCM

Relevant code

  • decoder.go, L61:

    } else if b < 0x20 {
      // skip byte introduced by DCE
    }
  • encoder.go, L65

    if (b) < 0x20 || ((b)&0x7f) == 0x7d || ((b)&0x7f) == 0x7e {
      // ...
    }

Relevant Documentation

  • RFC 1662, section 4.2 Transparency:

    After FCS computation, the transmitter examines the entire frame
    between the two Flag Sequences. Each Flag Sequence, Control Escape
    octet, and any octet which is flagged in the sending Async-Control-
    Character-Map (ACCM)
    , is replaced by a two octet sequence consisting
    of the Control Escape octet followed by the original octet
    exclusive-or'd with hexadecimal 0x20.

    On reception, prior to FCS computation, each octet with value less
    than hexadecimal 0x20 is checked. If it is flagged in the receiving
    ACCM, it is simply removed
    (it may have been inserted by intervening
    data communications equipment). Each Control Escape octet is also
    removed, and the following octet is exclusive-or'd with hexadecimal
    0x20, unless it is the Flag Sequence (which aborts a frame).

  • pppd man page:

    If no asyncmap option is given, the default is zero, so pppd will ask the peer not to escape any control characters.

Add decoding with bit shifting

Add decoding of flags when the frame shifted n bits. There are situations when a frame is not a multiple of a byte and the flag is shifted by several bits.
like this:
[]byte{0x3F, 0x81, 0x84, 0x00, 0xF8, 0xE0, 0x6B, 0xFD, 0xFC}
0x3F and 0xFC - HDLC Flags

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.