pcaprub 0.12.4 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 282b1065a65ad397abd040bcdc8fa3b692c2cae0
4
- data.tar.gz: df9c6be00a06fd8a1602c59e55d8614a633da93e
3
+ metadata.gz: 3fdbd4939dcfb61fc4cc143de865f17bd4999ba6
4
+ data.tar.gz: 58b38fcc9f3a4b9ff136134ab3fb18783ade94b1
5
5
  SHA512:
6
- metadata.gz: 618dabf64136f5f255a5e85e95efc1d17d215b1e45c563528e2b7919486538877d509254a0c607b85f5ca66bceafae46e7f2577d60c4ef5bfe4ddf7dd53287b0
7
- data.tar.gz: c32162eb764c0b91d8ca93a0d9435e1adf3560367f7145c2eb25c8c551a41cdaaa67c349303fa3666accdfb5e793a582742f2e7fa838e321e18cc6be91289283
6
+ metadata.gz: b8af65ed57f6c0fe37c2d2e5d184f4ba38510ed0e7e8ff607ead0aae160d9916cfbd24ef8ec7929ff3cafcdcfd868a47bda74166d8c3cca27ca9284a245b93a5
7
+ data.tar.gz: db80e02ee8b845edaa10551ecc5a3b327e96a72dd5b7ba5d456578fc5e39322b686c079215f2f060a064398b48cb5b33aee3f96b75baa45e2dc56274d09b3254
@@ -5,8 +5,6 @@ before_install:
5
5
  before_script:
6
6
  - travis_retry gem update bundler
7
7
  rvm:
8
- - 1.8.7
9
- - 1.9.3
10
8
  - 2.0.0
11
9
  - 2.1
12
10
  - 2.2
data/Gemfile CHANGED
@@ -1,11 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # No more static spec file
4
-
5
- platforms :ruby_18 do
6
- gem 'rdoc'
7
- end
8
-
9
3
  group :development, :test do
10
4
  # Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826)
11
5
  gem 'minitest', '~> 4.7.0'
@@ -16,7 +10,7 @@ group :development, :test do
16
10
  gem 'test-unit'
17
11
  end
18
12
 
19
- platforms :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23 do
13
+ platforms :ruby_20, :ruby_21, :ruby_22, :ruby_23 do
20
14
  gem 'coveralls', :require => false
21
15
  end
22
16
  end
@@ -24,10 +18,7 @@ end
24
18
  gem 'rake-compiler', '>= 0.6.0'
25
19
  gem 'rubygems-tasks'
26
20
 
27
- if Bundler.current_ruby.ruby_18?
28
- gem 'rake', '< 10.6'
29
- gem 'git', '1.2.9'
30
- elsif Bundler.current_ruby.mri? || Bundler.current_ruby.mingw? || Bundler.current_ruby.x64_mingw?
21
+ if Bundler.current_ruby.mri? || Bundler.current_ruby.mingw? || Bundler.current_ruby.x64_mingw?
31
22
  gem 'rake', '>= 0.9.2'
32
23
  gem 'git', '~> 1.3.0'
33
24
  end
data/Rakefile CHANGED
@@ -9,15 +9,16 @@ ENV['LANG'] = "en_US.UTF-8"
9
9
 
10
10
 
11
11
  @gemspec = Gem::Specification.new do |spec|
12
- spec.name = "pcaprub"
13
- spec.version = PCAPRUB::Pcap.version
14
- spec.authors = ["shadowbq", "crondaemon", "jmcavinee", "unmarshal"]
15
- spec.email = "shadowbq@gmail.com"
16
- spec.description = "libpcap bindings for ruby with Ruby1.8, Ruby1.9, Ruby 2.x"
17
- spec.summary = "libpcap bindings for ruby"
18
- spec.homepage = "https://github.com/pcaprub/pcaprub"
19
- spec.requirements = "libpcap"
20
- spec.license = "LGPL-2.1"
12
+ spec.name = "pcaprub"
13
+ spec.version = PCAPRUB::Pcap.version
14
+ spec.authors = ["shadowbq", "crondaemon", "jmcavinee", "unmarshal"]
15
+ spec.email = "shadowbq@gmail.com"
16
+ spec.description = "libpcap bindings for Ruby 2.x"
17
+ spec.summary = "libpcap bindings for ruby"
18
+ spec.homepage = "https://github.com/pcaprub/pcaprub"
19
+ spec.requirements = "libpcap"
20
+ spec.license = "LGPL-2.1"
21
+ spec.required_ruby_version = '~> 2.0'
21
22
 
22
23
  spec.files = [
23
24
  ".document",
@@ -114,6 +115,7 @@ Gem::Tasks.new
114
115
  # Override standard release task
115
116
  require 'git'
116
117
  Rake::Task["release"].clear
118
+ desc 'Release the gem (create tag, build, publish)'
117
119
  task :release do
118
120
  version = "#{PCAPRUB::VERSION::STRING}"
119
121
  remote = 'origin'
@@ -61,6 +61,15 @@ typedef struct rbpacket {
61
61
  u_char* pkt;
62
62
  } rbpacket_t;
63
63
 
64
+ /*
65
+ * Return the pcap version
66
+ */
67
+ static VALUE
68
+ rbpcap_s_lib_version(VALUE self)
69
+ {
70
+ return rb_str_new2(pcap_lib_version());
71
+ }
72
+
64
73
  /*
65
74
  * Return the name of a network device on the system.
66
75
  *
@@ -1295,6 +1304,7 @@ Init_pcaprub_c()
1295
1304
 
1296
1305
  rb_define_module_function(rb_cPcap, "lookupdev", rbpcap_s_lookupdev, 0);
1297
1306
  rb_define_module_function(rb_cPcap, "lookupnet", rbpcap_s_lookupnet, 1);
1307
+ rb_define_module_function(rb_cPcap, "lib_version", rbpcap_s_lib_version, 0);
1298
1308
 
1299
1309
  rb_define_const(rb_cPcap, "DLT_NULL", INT2NUM(DLT_NULL));
1300
1310
  rb_define_const(rb_cPcap, "DLT_EN10MB", INT2NUM(DLT_EN10MB));
@@ -1,9 +1,5 @@
1
1
  begin
2
- if RUBY_VERSION =~ /1.8/
3
- require '1.8/pcaprub_c'
4
- elsif RUBY_VERSION =~ /1.9/
5
- require '1.9/pcaprub_c'
6
- elsif RUBY_VERSION =~ /2.0/
2
+ if RUBY_VERSION =~ /2.0/
7
3
  require '2.0/pcaprub_c'
8
4
  elsif RUBY_VERSION =~ /2.1/
9
5
  require '2.1/pcaprub_c'
@@ -3,8 +3,8 @@ module PCAPRUB #:nodoc:
3
3
  module VERSION #:nodoc:
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 12
7
- TINY = 4
6
+ MINOR = 13
7
+ TINY = 0
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].join('.')
10
10
 
@@ -13,19 +13,20 @@ require File.expand_path '../test_helper.rb', __FILE__
13
13
  class Pcap::UnitTest < Test::Unit::TestCase
14
14
  def test_version
15
15
  assert_equal(String, Pcap.version.class)
16
- puts "Pcaprub version: #{Pcap.version}"
16
+ # puts "Pcaprub version: #{Pcap.version}"
17
17
  end
18
18
 
19
19
  def test_lookupdev
20
20
  assert_equal(String, Pcap.lookupdev.class)
21
- puts "Pcaprub default device: #{Pcap.lookupdev}"
21
+ # puts "Pcaprub default device: #{Pcap.lookupdev}"
22
22
  end
23
23
 
24
24
  def test_lookupnet
25
25
  dev = Pcap.lookupdev
26
26
  assert_equal(Array, Pcap.lookupnet(dev).class)
27
27
  net = Pcap.lookupnet(dev)
28
- puts "Pcaprub net (#{dev}): #{net[0]} #{[net[1]].pack("N").unpack("H*")[0]}"
28
+ assert net
29
+ # puts "Pcaprub net (#{dev}): #{net[0]} #{[net[1]].pack("N").unpack("H*")[0]}"
29
30
  end
30
31
 
31
32
  def test_pcap_new
@@ -106,8 +107,8 @@ class Pcap::UnitTest < Test::Unit::TestCase
106
107
  end
107
108
 
108
109
  t.kill
109
- puts "Background thread ticked #{@c} times while capture was running"
110
- puts "Captured #{pkt_count} packets"
110
+ # puts "Background thread ticked #{@c} times while capture was running"
111
+ # puts "Captured #{pkt_count} packets"
111
112
  assert(0 < @c, "Background thread failed to tick while capture was running");
112
113
  true
113
114
  end
@@ -160,4 +161,11 @@ class Pcap::UnitTest < Test::Unit::TestCase
160
161
  o.compile("A non working filter")
161
162
  end
162
163
  end
164
+
165
+ def test_lib_version
166
+ v = Pcap.lib_version.split
167
+ assert_equal "libpcap", v[0]
168
+ assert_equal "version", v[1]
169
+ assert_equal 3, v[2].split('.').size
170
+ end
163
171
  end
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.12.4
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - shadowbq
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-04-18 00:00:00.000000000 Z
14
+ date: 2018-07-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -107,7 +107,7 @@ dependencies:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: 4.7.0
110
- description: libpcap bindings for ruby with Ruby1.8, Ruby1.9, Ruby 2.x
110
+ description: libpcap bindings for Ruby 2.x
111
111
  email: shadowbq@gmail.com
112
112
  executables: []
113
113
  extensions:
@@ -149,9 +149,9 @@ require_paths:
149
149
  - lib
150
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: '2.0'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - libpcap
162
162
  rubyforge_project:
163
- rubygems_version: 2.4.8
163
+ rubygems_version: 2.5.2.1
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: libpcap bindings for ruby