summaryrefslogtreecommitdiff
path: root/bin/map-pblock-types
diff options
context:
space:
mode:
Diffstat (limited to 'bin/map-pblock-types')
-rwxr-xr-xbin/map-pblock-types15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/map-pblock-types b/bin/map-pblock-types
new file mode 100755
index 0000000..35552be
--- /dev/null
+++ b/bin/map-pblock-types
@@ -0,0 +1,15 @@
+#!/usr/bin/ruby -w
+
+open("include/libnet/libnet-structures.h").each do |line|
+ #p line
+ next unless line =~ /^#define (LIBNET_PBLOCK_)(\S+).*/
+ #p [$1, $2]
+ type = $1+$2
+ name = $2.sub(/_H$/, "").downcase.inspect
+
+ next if type == "LIBNET_PBLOCK_DO_CHECKSUM"
+
+ puts " case #{type}:"
+ puts " return (#{name});"
+end
+