ng_protonum: Initial import of protocol number defines#2455
Merged
OlegHahm merged 1 commit intoRIOT-OS:masterfrom Feb 17, 2015
Merged
ng_protonum: Initial import of protocol number defines#2455OlegHahm merged 1 commit intoRIOT-OS:masterfrom
OlegHahm merged 1 commit intoRIOT-OS:masterfrom
Conversation
Member
|
Did you copy the list from somewhere or write it down yourself? |
Member
Author
|
I generated it from the IANA's CSV file with a quick-hacked Python script and adapted the result to my liking (renamed e.g. |
Member
There was a problem hiding this comment.
Please include "Last Updated 2015-01-06"
Member
|
@authmillenon: Would you mind to share this script somehow so people might use it to update the list later? |
Member
Author
|
It's not that sophisticated and requires a lot of extra work later on, to achieve the list I created: import csv
import re
with open("protocol-numbers-1.csv") as csvfile:
r = csv.DictReader(csvfile, delimiter=",")
for row in r:
if (len(row["Keyword"].strip()) == 0):
continue
ext = ""
if row["IPv6 Extension Header"] == "Y":
ext = "IPV6_EXT_"
macro = "NG_PROTNUM_" + ext + re.sub("[^A-Z0-9_]", "_", row["Keyword"].upper()).strip("_")
comment = row["Protocol"]
if len(comment) == 0:
comment = row["Keyword"]
print("#define " + macro + ((32 - len(macro)) * " ") + ("(%3d)" % int(row["Decimal"])) + " /**< " + comment + " */")I think for updates it is just best to add the new values by hand. Or does the IANA updates this list in bulk? |
Member
|
To be honest: no clue. But let's see... |
Member
|
ACK |
Member
|
but no beer for this one. |
Member
|
@authmillenon please squash |
1f9d8da to
c4e6504
Compare
Member
Author
|
Done |
OlegHahm
added a commit
that referenced
this pull request
Feb 17, 2015
ng_protonum: Initial import of protocol number defines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imports protocol numbers as they are needed for IPv4 and IPv6.