pcaprub 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -32,6 +32,7 @@ begin
32
32
  gem.authors = ["shadowbq"]
33
33
  gem.extensions = FileList['ext/**/extconf.rb']
34
34
  gem.rubyforge_project = 'pcaprub'
35
+ gem.version = PCAPRUB::VERSION::STRING
35
36
  gem.files.include('lib/pcaprub.*') # add native stuff
36
37
  gem.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'LICENSE*', 'FAQ*', 'USAGE*', 'ext/**/*.c']
37
38
  end
@@ -0,0 +1,151 @@
1
+ rb_define_const(rb_cPcap, "DLT_NULL", INT2NUM()); /* BSD loopback encapsulation */
2
+ rb_define_const(rb_cPcap, "DLT_EN10MB", INT2NUM()); /* Ethernet (10Mb) */
3
+ rb_define_const(rb_cPcap, "DLT_EN3MB", INT2NUM()); /* Experimental Ethernet (3Mb) */
4
+ rb_define_const(rb_cPcap, "DLT_AX25", INT2NUM()); /* Amateur Radio AX.25 */
5
+ rb_define_const(rb_cPcap, "DLT_PRONET", INT2NUM()); /* Proteon ProNET Token Ring */
6
+ rb_define_const(rb_cPcap, "DLT_CHAOS", INT2NUM()); /* Chaos */
7
+ rb_define_const(rb_cPcap, "DLT_IEEE802", INT2NUM()); /* 802.5 Token Ring */
8
+ rb_define_const(rb_cPcap, "DLT_ARCNET", INT2NUM()); /* ARCNET, with BSD-style header */
9
+ rb_define_const(rb_cPcap, "DLT_SLIP", INT2NUM()); /* Serial Line IP */
10
+ rb_define_const(rb_cPcap, "DLT_PPP", INT2NUM()); /* Point-to-point Protocol */
11
+ rb_define_const(rb_cPcap, "DLT_FDDI", INT2NUM()); /* FDDI */
12
+ rb_define_const(rb_cPcap, "DLT_ATM_RFC1483", INT2NUM()); /* LLC-encapsulated ATM */
13
+ rb_define_const(rb_cPcap, "DLT_RAW", INT2NUM()); /* raw IP */
14
+ rb_define_const(rb_cPcap, "DLT_RAW", INT2NUM()); /* raw IP */
15
+ rb_define_const(rb_cPcap, "DLT_SLIP_BSDOS", INT2NUM()); /* BSD/OS Serial Line IP */
16
+ rb_define_const(rb_cPcap, "DLT_PPP_BSDOS", INT2NUM()); /* BSD/OS Point-to-point Protocol */
17
+ rb_define_const(rb_cPcap, "DLT_SLIP_BSDOS", INT2NUM()); /* BSD/OS Serial Line IP */
18
+ rb_define_const(rb_cPcap, "DLT_PPP_BSDOS", INT2NUM()); /* BSD/OS Point-to-point Protocol */
19
+ rb_define_const(rb_cPcap, "DLT_ATM_CLIP", INT2NUM()); /* Linux Classical-IP over ATM */
20
+ rb_define_const(rb_cPcap, "DLT_REDBACK_SMARTEDGE", INT2NUM());
21
+ rb_define_const(rb_cPcap, "DLT_PPP_SERIAL", INT2NUM()); /* PPP over serial with HDLC encapsulation */
22
+ rb_define_const(rb_cPcap, "DLT_PPP_ETHER", INT2NUM()); /* PPP over Ethernet */
23
+ rb_define_const(rb_cPcap, "DLT_SYMANTEC_FIREWALL", INT2NUM());
24
+ rb_define_const(rb_cPcap, "DLT_C_HDLC", INT2NUM()); /* Cisco HDLC */
25
+ rb_define_const(rb_cPcap, "DLT_CHDLC", INT2NUM());
26
+ rb_define_const(rb_cPcap, "DLT_IEEE802_11", INT2NUM()); /* IEEE 802.11 wireless */
27
+ rb_define_const(rb_cPcap, "DLT_FRELAY", INT2NUM());
28
+ rb_define_const(rb_cPcap, "DLT_LOOP", INT2NUM());
29
+
30
+ rb_define_const(rb_cPcap, "DLT_ENC", INT2NUM());
31
+
32
+ rb_define_const(rb_cPcap, "DLT_LINUX_SLL", INT2NUM());
33
+ rb_define_const(rb_cPcap, "DLT_LTALK", INT2NUM());
34
+ rb_define_const(rb_cPcap, "DLT_ECONET", INT2NUM());
35
+ rb_define_const(rb_cPcap, "DLT_IPFILTER", INT2NUM());
36
+ rb_define_const(rb_cPcap, "DLT_OLD_PFLOG", INT2NUM());
37
+ rb_define_const(rb_cPcap, "DLT_PFSYNC", INT2NUM());
38
+ rb_define_const(rb_cPcap, "DLT_PFLOG", INT2NUM());
39
+ rb_define_const(rb_cPcap, "DLT_CISCO_IOS", INT2NUM());
40
+ rb_define_const(rb_cPcap, "DLT_PRISM_HEADER", INT2NUM());
41
+ rb_define_const(rb_cPcap, "DLT_AIRONET_HEADER", INT2NUM());
42
+ rb_define_const(rb_cPcap, "DLT_HHDLC", INT2NUM());
43
+ rb_define_const(rb_cPcap, "DLT_IP_OVER_FC", INT2NUM());
44
+ rb_define_const(rb_cPcap, "DLT_SUNATM", INT2NUM()); /* Solaris+SunATM */
45
+ rb_define_const(rb_cPcap, "DLT_RIO", INT2NUM()); /* RapidIO */
46
+ rb_define_const(rb_cPcap, "DLT_PCI_EXP", INT2NUM()); /* PCI Express */
47
+ rb_define_const(rb_cPcap, "DLT_AURORA", INT2NUM()); /* Xilinx Aurora link layer */
48
+ rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO", INT2NUM()); /* 802.11 plus radiotap radio header */
49
+ rb_define_const(rb_cPcap, "DLT_TZSP", INT2NUM()); /* Tazmen Sniffer Protocol */
50
+ rb_define_const(rb_cPcap, "DLT_ARCNET_LINUX", INT2NUM()); /* ARCNET */
51
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_MLPPP", INT2NUM());
52
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_MLFR", INT2NUM());
53
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ES", INT2NUM());
54
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_GGSN", INT2NUM());
55
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_MFR", INT2NUM());
56
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ATM2", INT2NUM());
57
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_SERVICES", INT2NUM());
58
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ATM1", INT2NUM());
59
+ rb_define_const(rb_cPcap, "DLT_APPLE_IP_OVER_IEEE1394", INT2NUM());
60
+ rb_define_const(rb_cPcap, "DLT_MTP2_WITH_PHDR", INT2NUM()); /* pseudo-header with various info, followed by MTP2 */
61
+ rb_define_const(rb_cPcap, "DLT_MTP2", INT2NUM()); /* MTP2, without pseudo-header */
62
+ rb_define_const(rb_cPcap, "DLT_MTP3", INT2NUM()); /* MTP3, without pseudo-header or MTP2 */
63
+ rb_define_const(rb_cPcap, "DLT_SCCP", INT2NUM()); /* SCCP, without pseudo-header or MTP2 or MTP3 */
64
+ rb_define_const(rb_cPcap, "DLT_DOCSIS", INT2NUM());
65
+ rb_define_const(rb_cPcap, "DLT_LINUX_IRDA", INT2NUM());
66
+ rb_define_const(rb_cPcap, "DLT_IBM_SP", INT2NUM());
67
+ rb_define_const(rb_cPcap, "DLT_IBM_SN", INT2NUM());
68
+ rb_define_const(rb_cPcap, "DLT_USER0", INT2NUM());
69
+ rb_define_const(rb_cPcap, "DLT_USER1", INT2NUM());
70
+ rb_define_const(rb_cPcap, "DLT_USER2", INT2NUM());
71
+ rb_define_const(rb_cPcap, "DLT_USER3", INT2NUM());
72
+ rb_define_const(rb_cPcap, "DLT_USER4", INT2NUM());
73
+ rb_define_const(rb_cPcap, "DLT_USER5", INT2NUM());
74
+ rb_define_const(rb_cPcap, "DLT_USER6", INT2NUM());
75
+ rb_define_const(rb_cPcap, "DLT_USER7", INT2NUM());
76
+ rb_define_const(rb_cPcap, "DLT_USER8", INT2NUM());
77
+ rb_define_const(rb_cPcap, "DLT_USER9", INT2NUM());
78
+ rb_define_const(rb_cPcap, "DLT_USER10", INT2NUM());
79
+ rb_define_const(rb_cPcap, "DLT_USER11", INT2NUM());
80
+ rb_define_const(rb_cPcap, "DLT_USER12", INT2NUM());
81
+ rb_define_const(rb_cPcap, "DLT_USER13", INT2NUM());
82
+ rb_define_const(rb_cPcap, "DLT_USER14", INT2NUM());
83
+ rb_define_const(rb_cPcap, "DLT_USER15", INT2NUM());
84
+ rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO_AVS", INT2NUM()); /* 802.11 plus AVS radio header */
85
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_MONITOR", INT2NUM());
86
+ rb_define_const(rb_cPcap, "DLT_BACNET_MS_TP", INT2NUM());
87
+ rb_define_const(rb_cPcap, "DLT_PPP_PPPD", INT2NUM());
88
+ rb_define_const(rb_cPcap, "DLT_PPP_WITH_DIRECTION", INT2NUM());
89
+ rb_define_const(rb_cPcap, "DLT_LINUX_PPP_WITHDIRECTION", INT2NUM());
90
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_PPPOE", INT2NUM());
91
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_PPPOE_ATM", INT2NUM());
92
+ rb_define_const(rb_cPcap, "DLT_GPRS_LLC", INT2NUM()); /* GPRS LLC */
93
+ rb_define_const(rb_cPcap, "DLT_GPF_T", INT2NUM()); /* GPF-T (ITU-T G.7041/Y.1303) */
94
+ rb_define_const(rb_cPcap, "DLT_GPF_F", INT2NUM()); /* GPF-F (ITU-T G.7041/Y.1303) */
95
+ rb_define_const(rb_cPcap, "DLT_GCOM_T1E1", INT2NUM());
96
+ rb_define_const(rb_cPcap, "DLT_GCOM_SERIAL", INT2NUM());
97
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_PIC_PEER", INT2NUM());
98
+ rb_define_const(rb_cPcap, "DLT_ERF_ETH", INT2NUM()); /* Ethernet */
99
+ rb_define_const(rb_cPcap, "DLT_ERF_POS", INT2NUM()); /* Packet-over-SONET */
100
+ rb_define_const(rb_cPcap, "DLT_LINUX_LAPD", INT2NUM());
101
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ETHER", INT2NUM());
102
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_PPP", INT2NUM());
103
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_FRELAY", INT2NUM());
104
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_CHDLC", INT2NUM());
105
+ rb_define_const(rb_cPcap, "DLT_MFR", INT2NUM());
106
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_VP", INT2NUM());
107
+ rb_define_const(rb_cPcap, "DLT_A429", INT2NUM());
108
+ rb_define_const(rb_cPcap, "DLT_A653_ICM", INT2NUM());
109
+ rb_define_const(rb_cPcap, "DLT_USB", INT2NUM());
110
+ rb_define_const(rb_cPcap, "DLT_BLUETOOTH_HCI_H4", INT2NUM());
111
+ rb_define_const(rb_cPcap, "DLT_IEEE802_16_MAC_CPS", INT2NUM());
112
+ rb_define_const(rb_cPcap, "DLT_USB_LINUX", INT2NUM());
113
+ rb_define_const(rb_cPcap, "DLT_CAN20B", INT2NUM());
114
+ rb_define_const(rb_cPcap, "DLT_IEEE802_15_4_LINUX", INT2NUM());
115
+ rb_define_const(rb_cPcap, "DLT_PPI", INT2NUM());
116
+ rb_define_const(rb_cPcap, "DLT_IEEE802_16_MAC_CPS_RADIO", INT2NUM());
117
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ISM", INT2NUM());
118
+ rb_define_const(rb_cPcap, "DLT_IEEE802_15_4", INT2NUM());
119
+ rb_define_const(rb_cPcap, "DLT_SITA", INT2NUM());
120
+ rb_define_const(rb_cPcap, "DLT_ERF", INT2NUM());
121
+ rb_define_const(rb_cPcap, "DLT_RAIF1", INT2NUM());
122
+ rb_define_const(rb_cPcap, "DLT_IPMB", INT2NUM());
123
+ rb_define_const(rb_cPcap, "DLT_JUNIPER_ST", INT2NUM());
124
+ rb_define_const(rb_cPcap, "DLT_BLUETOOTH_HCI_H4_WITH_PHDR", INT2NUM());
125
+ rb_define_const(rb_cPcap, "DLT_AX25_KISS", INT2NUM());
126
+ rb_define_const(rb_cPcap, "DLT_LAPD", INT2NUM());
127
+ rb_define_const(rb_cPcap, "DLT_PPP_WITH_DIR", INT2NUM()); /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */
128
+ rb_define_const(rb_cPcap, "DLT_C_HDLC_WITH_DIR", INT2NUM()); /* Cisco HDLC */
129
+ rb_define_const(rb_cPcap, "DLT_FRELAY_WITH_DIR", INT2NUM()); /* Frame Relay */
130
+ rb_define_const(rb_cPcap, "DLT_LAPB_WITH_DIR", INT2NUM()); /* LAPB */
131
+ rb_define_const(rb_cPcap, "DLT_IPMB_LINUX", INT2NUM());
132
+ rb_define_const(rb_cPcap, "DLT_FLEXRAY", INT2NUM());
133
+ rb_define_const(rb_cPcap, "DLT_MOST", INT2NUM());
134
+ rb_define_const(rb_cPcap, "DLT_LIN", INT2NUM());
135
+ rb_define_const(rb_cPcap, "DLT_X2E_SERIAL", INT2NUM());
136
+ rb_define_const(rb_cPcap, "DLT_X2E_XORAYA", INT2NUM());
137
+ rb_define_const(rb_cPcap, "DLT_IEEE802_15_4_NONASK_PHY", INT2NUM());
138
+ rb_define_const(rb_cPcap, "DLT_LINUX_EVDEV", INT2NUM());
139
+ rb_define_const(rb_cPcap, "DLT_GSMTAP_UM", INT2NUM());
140
+ rb_define_const(rb_cPcap, "DLT_GSMTAP_ABIS", INT2NUM());
141
+ rb_define_const(rb_cPcap, "DLT_MPLS", INT2NUM());
142
+ rb_define_const(rb_cPcap, "DLT_USB_LINUX_MMAPPED", INT2NUM());
143
+ rb_define_const(rb_cPcap, "DLT_DECT", INT2NUM());
144
+ rb_define_const(rb_cPcap, "DLT_AOS", INT2NUM());
145
+ rb_define_const(rb_cPcap, "DLT_WIHART", INT2NUM());
146
+ rb_define_const(rb_cPcap, "DLT_FC_2", INT2NUM());
147
+ rb_define_const(rb_cPcap, "DLT_FC_2_WITH_FRAME_DELIMS", INT2NUM());
148
+ rb_define_const(rb_cPcap, "DLT_IPNET", INT2NUM());
149
+ rb_define_const(rb_cPcap, "DLT_CAN_SOCKETCAN", INT2NUM());
150
+ rb_define_const(rb_cPcap, "DLT_IPV4", INT2NUM());
151
+ rb_define_const(rb_cPcap, "DLT_IPV6", INT2NUM());
@@ -23,6 +23,14 @@ static VALUE ePCAPRUBError, eDumperError, eBindingError, eBPFilterError;
23
23
  #define OFFLINE 1
24
24
  #define LIVE 2
25
25
 
26
+ #if !defined(PCAP_NETMASK_UNKNOWN)
27
+ /*
28
+ * Version of libpcap < 1.1
29
+ * Value to pass to pcap_compile() as the netmask if you dont know what the netmask is.
30
+ */
31
+ #define PCAP_NETMASK_UNKNOWN 0xffffffff
32
+ #endif
33
+
26
34
  typedef struct rbpcap {
27
35
  pcap_t *pd;
28
36
  pcap_dumper_t *pdt;
@@ -223,8 +231,11 @@ rbpcap_setfilter(VALUE self, VALUE filter)
223
231
  if(! rbpcap_ready(rbp)) return self;
224
232
 
225
233
  if(rbp->type == LIVE)
226
- if(pcap_lookupnet(rbp->iface, &netid, &mask, eb) < 0)
227
- rb_raise(rb_eRuntimeError, "%s", eb);
234
+ if(pcap_lookupnet(rbp->iface, &netid, &mask, eb) < 0) {
235
+ netid = 0;
236
+ mask = 0;
237
+ rb_warn(eb);
238
+ }
228
239
 
229
240
  if(pcap_compile(rbp->pd, &bpf, RSTRING_PTR(filter), 0, mask) < 0)
230
241
  rb_raise(eBPFilterError, "invalid bpf filter");
@@ -3,8 +3,8 @@ module PCAPRUB #:nodoc:
3
3
  module VERSION #:nodoc:
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 10
7
- TINY = 1
6
+ MINOR = 11
7
+ TINY = 1
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].join('.')
10
10
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pcaprub"
8
- s.version = "0.11.0"
8
+ s.version = "0.11.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["shadowbq"]
12
- s.date = "2011-10-21"
12
+ s.date = "2011-12-28"
13
13
  s.description = "libpcap bindings for ruby compat with JRUBY Ruby1.8 Ruby1.9"
14
14
  s.email = "shadowbq@gmail.com"
15
15
  s.extensions = ["ext/pcaprub/extconf.rb"]
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  "LICENSE",
19
19
  "README.rdoc",
20
20
  "USAGE.rdoc",
21
+ "ext/pcaprub/dlt.c",
21
22
  "ext/pcaprub/pcaprub.c"
22
23
  ]
23
24
  s.files = [
@@ -27,11 +28,11 @@ Gem::Specification.new do |s|
27
28
  "README.rdoc",
28
29
  "Rakefile",
29
30
  "USAGE.rdoc",
30
- "VERSION",
31
31
  "examples/dead_cap.rb",
32
32
  "examples/file_cap.rb",
33
33
  "examples/simple_cap.rb",
34
34
  "examples/telnet-raw.pcap",
35
+ "ext/pcaprub/dlt.c",
35
36
  "ext/pcaprub/extconf.rb",
36
37
  "ext/pcaprub/pcaprub.c",
37
38
  "lib/pcaprub.rb",
@@ -39,6 +40,8 @@ Gem::Specification.new do |s|
39
40
  "lib/pcaprub/ext.rb",
40
41
  "lib/pcaprub/version.rb",
41
42
  "pcaprub.gemspec",
43
+ "pkg/pcaprub-0.10.0.gem",
44
+ "pkg/pcaprub-0.9.2.gem",
42
45
  "test/helper.rb",
43
46
  "test/test_pcaprub.rb",
44
47
  "test/test_pcaprub_unit.rb"
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcaprub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-21 00:00:00.000000000Z
12
+ date: 2011-12-28 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: libpcap bindings for ruby compat with JRUBY Ruby1.8 Ruby1.9
15
15
  email: shadowbq@gmail.com
@@ -21,6 +21,7 @@ extra_rdoc_files:
21
21
  - LICENSE
22
22
  - README.rdoc
23
23
  - USAGE.rdoc
24
+ - ext/pcaprub/dlt.c
24
25
  - ext/pcaprub/pcaprub.c
25
26
  files:
26
27
  - .document
@@ -29,11 +30,11 @@ files:
29
30
  - README.rdoc
30
31
  - Rakefile
31
32
  - USAGE.rdoc
32
- - VERSION
33
33
  - examples/dead_cap.rb
34
34
  - examples/file_cap.rb
35
35
  - examples/simple_cap.rb
36
36
  - examples/telnet-raw.pcap
37
+ - ext/pcaprub/dlt.c
37
38
  - ext/pcaprub/extconf.rb
38
39
  - ext/pcaprub/pcaprub.c
39
40
  - lib/pcaprub.rb
@@ -41,6 +42,8 @@ files:
41
42
  - lib/pcaprub/ext.rb
42
43
  - lib/pcaprub/version.rb
43
44
  - pcaprub.gemspec
45
+ - pkg/pcaprub-0.10.0.gem
46
+ - pkg/pcaprub-0.9.2.gem
44
47
  - test/helper.rb
45
48
  - test/test_pcaprub.rb
46
49
  - test/test_pcaprub_unit.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.11.0