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

Version byte #4

Open
jdonszelmann opened this issue May 18, 2019 · 4 comments
Open

Version byte #4

jdonszelmann opened this issue May 18, 2019 · 4 comments
Assignees

Comments

@jdonszelmann
Copy link
Contributor

We have a couple of options for the first byte in the ipv8 packet.

Right now the header looks like
0x00 0x02 where as far as we know 0x02 is the version and the first byte is hardcoded to 0.

There are a few logical options for a new header:

  • Option 1: extend the scheme
    • 0x00 0x03 for rust-ipv8 messages
  • Option 2: reduce the byte count. start the message with
    • 0x01and everything after will be new rust-ipv8 messages with slightly different architecture.
  • Option 3:
    • Use a proper magic byte like 0b00101010.

Advantages of this kind of proper magic byte is that few other protocols use it so it is very easily detectable. If this is actually an advantage is debatable.

We should decide upon this soon as this it is rather important to distinguish the two kinds of messages. By then legacy py-ipv8 messages will be interpreted by rust and converted to a rust-readable standard.

@ichorid
Copy link

ichorid commented May 19, 2019

The proper way to do this is to use 4 magic bytes at the beginning. One byte is not enough to uniquely distinguish the protocol for, say, Wireshark analysis. Also, a single byte is a little bit less efficient in parsing than 4 bytes because of alignment issues. It is always a good idea to put longer-aligned scalar fields first.

Please, look into best practices on this.

@NULLx76
Copy link
Member

NULLx76 commented May 21, 2019

We (@jonay2000, @dsluijk and I) think that 0x20f57c03 is a good candidate for the magic byte. It is as far as we know unique. The trailing 03 signifies the version of the protocol.

@dsluijk dsluijk transferred this issue from ip-v8/rust-ipv8 May 21, 2019
@dsluijk
Copy link

dsluijk commented May 21, 2019

Transferring, as this is more about the protocol definition

@jdonszelmann
Copy link
Contributor Author

sources for choices made to get to the number: https://tools.ietf.org/html/draft-main-magic-00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants