File: map-pblock-types

package info (click to toggle)
libnet 1.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,820 kB
  • sloc: ansic: 19,531; makefile: 294; sh: 94; ruby: 8
file content (17 lines) | stat: -rwxr-xr-x 474 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/ruby -w
# This utility is used to maintain the pblock mapping to strings in
# src/libnet_internal.c, see the in-source comment in that file.

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