Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet structure diagrams #948

Open
PFigs opened this issue Sep 22, 2019 · 13 comments
Open

Packet structure diagrams #948

PFigs opened this issue Sep 22, 2019 · 13 comments
Labels
Contributor needed Status: Triage Needs to be verified, categorized, etc Type: New Diagram

Comments

@PFigs
Copy link

PFigs commented Sep 22, 2019

Is your feature request related to a problem? Please describe.
No, this is an idea for a new diagram type.

Describe the solution you'd like
Ideally the diagram definition would consist of a box identifier where the text and bit numbering would visible, eg:

PacketDiagram
M[0:32]: Address

Additional context
https://www.thegeekstuff.com/2012/03/ip-protocol-header/

@IOrlandoni IOrlandoni added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Sep 24, 2019
@barakplasma
Copy link

I checked the link provided, but I'm not sure which diagram you are referring to replicating.
Can you provide a wireframe or mock up of your idea?

@PFigs
Copy link
Author

PFigs commented Sep 25, 2019

Hi!

Thanks for taking a look!

I would be useful to build diagrams to depict memory and packet structures. This are basically identified by a box, length in bits and a label with the field name.

Here's an example:

packetDiagram

@IOrlandoni IOrlandoni added Status: Pending Is not to be executed as it currently is and removed Status: Triage Needs to be verified, categorized, etc labels Sep 25, 2019
@sesm
Copy link

sesm commented Sep 28, 2019

@PFigs very good idea!
Are you aware of any tool that generates this diagrams already? Or any commonly used textual representation of packet structure? That would be a good starting point for implementing this feature.

@PFigs
Copy link
Author

PFigs commented Sep 30, 2019

Hi!

I am not aware of any proper tool. I see a lot of people using word, visio, powerpoint or plain ascii tables for this purpose. Not ideal!

@barakplasma
Copy link

barakplasma commented Sep 30, 2019

@sesm @PFigs I was able to finda tool which generates an ASCII diagram for custom packet structures at https://github.com/luismartingarcia/protocol

Here's some example usage:
$ protocol "Field4:4,Field4:4,Field8:8,Field16:16,Field32:32,Field64:64?\ bits=16,numbers=y,startchar=*,endchar=*,evenchar=-,oddchar=-,sepchar=|"

     0                   1
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
    *-------------------------------*
    | Field4| Field4|     Field8    |
    *-------------------------------*
    |            Field16            |
    *-------------------------------*
    |                               |
    *            Field32            *
    |                               |
    *-------------------------------*
    |                               |
    *                               *
    |                               |
    *            Field64            *
    |                               |
    *                               *
    |                               |
    *-------------------------------*

Another example:
$ protocol "Source Port:16,Destination Port:16,Sequence Number:32,\ Acknowledgment Number:32,Offset:4,Res.:4,Flags:8,Window:16,Checksum:16,\ Urgent Pointer:16,Options:24,Padding:8"

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Source Port          |        Destination Port       |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                        Sequence Number                        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                     Acknowledgment Number                     |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Offset|  Res. |     Flags     |             Window            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |            Checksum           |         Urgent Pointer        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                    Options                    |    Padding    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

@PFigs
Copy link
Author

PFigs commented Sep 30, 2019

Wow quite cool 😎 thanks!

@knsv
Copy link
Collaborator

knsv commented Sep 30, 2019

Cool idea. How would you imagine the syntax?

@justyn
Copy link

justyn commented Jan 19, 2021

For hints on syntax, see also the extremely basic tool packetdiag

{
  colwidth = 32
  node_height = 72

  0-15: Source Port
  16-31: Destination Port
  32-63: Sequence Number
  64-95: Acknowledgment Number
  96-99: Data Offset
  100-105: Reserved
  106: URG [rotate = 270]
  107: ACK [rotate = 270]
  108: PSH [rotate = 270]
  109: RST [rotate = 270]
  110: SYN [rotate = 270]
  111: FIN [rotate = 270]
  112-127: Window
  128-143: Checksum
  144-159: Urgent Pointer
  160-191: (Options and Padding)
  192-223: data [colheight = 3]
}

image

@frehberg
Copy link

frehberg commented Dec 21, 2022

yes, I am missing this diagram type in mermaid as well, for example if I need to document protocol headers in communication protocols, or memory layout of operating systems

@jgreywolf jgreywolf added Status: Triage Needs to be verified, categorized, etc Type: New Diagram Contributor needed and removed Type: Enhancement New feature or request Status: Pending Is not to be executed as it currently is labels Jan 26, 2023
@harvester-software
Copy link

I'd like to pick this up - any objections?

@jgreywolf
Copy link
Contributor

@harvester-software None at all - If you are still interested lets get this assigned to you!

This was referenced Sep 14, 2023
@GilDev
Copy link

GilDev commented Oct 23, 2023

I see this is being added in #4839. Just for information, there’s also Bytefield that does this.

@jparrish88
Copy link

Hi, I was testing the #4839 , This is great work! I had a couple questions, that are thinly veiled features requests:

  • Can I change the column width?
    • My flash pages are a different size than 32.
  • Can you just use the size of the block/characteristic?
  • -If you use size you wouldn't have to change every line if a single characteristic needed to change position or change size.
  • -My assumption is that this would require a config change similar to the showBits config; like useSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor needed Status: Triage Needs to be verified, categorized, etc Type: New Diagram
Projects
None yet
Development

No branches or pull requests