-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ng_protonum: Initial import of protocol number defines #2455
Conversation
Did you copy the list from somewhere or write it down yourself? |
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. |
* @ingroup net | ||
* @brief Defines for the Protocol Numbers as they are used in the | ||
* IPv4 protocol field and the IPv6 next header field | ||
* (ng_ipv6_hdr_t::nh). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include "Last Updated 2015-01-06"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (s. l 18)
@authmillenon: Would you mind to share this script somehow so people might use it to update the list later? |
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? |
To be honest: no clue. But let's see... |
ACK |
but no beer for this one. |
@authmillenon please squash |
1f9d8da
to
c4e6504
Compare
Done |
ng_protonum: Initial import of protocol number defines
Imports protocol numbers as they are needed for IPv4 and IPv6.