smartcard 0.4.8 → 0.4.9

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/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4.9. Disabled Nagle's algorithm in the remote JCOP transport.
2
+
1
3
  v0.4.8. Gem dependencies.
2
4
 
3
5
  v0.4.7. Custom exception class for APDU responses with error codes.
data/Rakefile CHANGED
@@ -9,7 +9,8 @@ Echoe.new('smartcard') do |p|
9
9
  p.email = 'victor@costan.us'
10
10
  p.summary = 'Interface with ISO 7816 smart cards.'
11
11
  p.url = 'http://www.costan.us/smartcard'
12
- p.dependencies = ['rubyzip >=0.9.1']
12
+ p.dependencies = ['rubyzip >=0.9.1',
13
+ 'zerg_support >=0.1.5']
13
14
  p.development_dependencies = ['echoe >=3.2',
14
15
  'flexmock >=0.8.6']
15
16
 
@@ -66,8 +66,6 @@ class JcopRemoteServer
66
66
  # The options hash supports the following keys:
67
67
  # port:: the port to serve on
68
68
  # ip:: the IP of the interface to serve on (defaults to all interfaces)
69
- # reusable:: if set, the serving port can be shared with another
70
- # application (REUSEADDR flag will be set on the socket)
71
69
  #
72
70
  # If the |serving_logic| parameter is nil, a serving logic implementation
73
71
  # must be provided when calling JcopRemoteServer#run. The server will crash
@@ -126,13 +124,12 @@ class JcopRemoteServer
126
124
  end
127
125
 
128
126
  # TODO(costan): figure out a way to let serving logic reach this directly.
129
- end
130
-
127
+ end
131
128
 
132
129
  # Creates a socket listening to incoming connections to this server.
133
130
  #
134
131
  # :call-seq:
135
- # server.establish_socket(options) -> Socket
132
+ # server.serving_socket(options) -> Socket
136
133
  #
137
134
  # The |options| parameter supports the same keys as the options parameter
138
135
  # of JcopRemoteServer#new.
@@ -141,17 +138,9 @@ class JcopRemoteServer
141
138
  def serving_socket(options)
142
139
  port = options[:port] || 0
143
140
  interface_ip = options[:ip] || '0.0.0.0'
144
- serving_address = Socket.pack_sockaddr_in port, interface_ip
145
-
146
- socket = Socket.new Socket::AF_INET, Socket::SOCK_STREAM,
147
- Socket::PF_UNSPEC
148
-
149
- if options[:reusable]
150
- socket.setsockopt Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true
151
- end
152
- socket.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true
153
- socket.bind serving_address
154
- socket.listen 5
141
+ socket = Zerg::Support::SocketFactory.socket :in_addr => interface_ip,
142
+ :in_port => port, :no_delay => true, :reuse_addr => true
143
+ socket.listen
155
144
  socket
156
145
  end
157
146
  private :serving_socket
@@ -4,7 +4,7 @@
4
4
  # Copyright:: Copyright (C) 2008 Massachusetts Institute of Technology
5
5
  # License:: MIT
6
6
 
7
- require 'socket'
7
+ require 'zerg_support'
8
8
 
9
9
  # :nodoc: namespace
10
10
  module Smartcard::Iso
@@ -43,16 +43,8 @@ class JcopRemoteTransport
43
43
  # Makes a transport-level connection to the TEM.
44
44
  def connect
45
45
  begin
46
- Socket.getaddrinfo(@host, @port, Socket::AF_INET,
47
- Socket::SOCK_STREAM).each do |addr_info|
48
- begin
49
- @socket = Socket.new(addr_info[4], addr_info[5], addr_info[6])
50
- @socket.connect Socket.pack_sockaddr_in(addr_info[1], addr_info[3])
51
- break
52
- rescue
53
- @socket = nil
54
- end
55
- end
46
+ @socket = Zerg::Support::SocketFactory.socket :out_addr => @host,
47
+ :out_port => @port, :no_delay => true
56
48
  raise 'Connection refused' unless @socket
57
49
 
58
50
  # Wait for the card to be inserted.
data/smartcard.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{smartcard}
5
- s.version = "0.4.8"
5
+ s.version = "0.4.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Victor Costan"]
9
- s.date = %q{2009-11-10}
9
+ s.date = %q{2009-11-11}
10
10
  s.description = %q{Interface with ISO 7816 smart cards.}
11
11
  s.email = %q{victor@costan.us}
12
12
  s.extensions = ["ext/smartcard_pcsc/extconf.rb"]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.rubyforge_project = %q{smartcard}
19
19
  s.rubygems_version = %q{1.3.5}
20
20
  s.summary = %q{Interface with ISO 7816 smart cards.}
21
- s.test_files = ["test/pcsc/containers_test.rb", "test/pcsc/smoke_test.rb", "test/gp/cap_loader_test.rb", "test/gp/gp_card_mixin_test.rb", "test/gp/des_test.rb", "test/gp/asn1_ber_test.rb", "test/iso/jcop_remote_test.rb", "test/iso/iso_card_mixin_test.rb", "test/iso/iso_exception_test.rb", "test/iso/auto_configurator_test.rb"]
21
+ s.test_files = ["test/gp/asn1_ber_test.rb", "test/gp/cap_loader_test.rb", "test/gp/des_test.rb", "test/gp/gp_card_mixin_test.rb", "test/iso/auto_configurator_test.rb", "test/iso/iso_card_mixin_test.rb", "test/iso/iso_exception_test.rb", "test/iso/jcop_remote_test.rb", "test/pcsc/containers_test.rb", "test/pcsc/smoke_test.rb"]
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -26,15 +26,18 @@ Gem::Specification.new do |s|
26
26
 
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<rubyzip>, [">= 0.9.1"])
29
+ s.add_runtime_dependency(%q<zerg_support>, [">= 0.1.5"])
29
30
  s.add_development_dependency(%q<echoe>, [">= 3.2"])
30
31
  s.add_development_dependency(%q<flexmock>, [">= 0.8.6"])
31
32
  else
32
33
  s.add_dependency(%q<rubyzip>, [">= 0.9.1"])
34
+ s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
33
35
  s.add_dependency(%q<echoe>, [">= 3.2"])
34
36
  s.add_dependency(%q<flexmock>, [">= 0.8.6"])
35
37
  end
36
38
  else
37
39
  s.add_dependency(%q<rubyzip>, [">= 0.9.1"])
40
+ s.add_dependency(%q<zerg_support>, [">= 0.1.5"])
38
41
  s.add_dependency(%q<echoe>, [">= 3.2"])
39
42
  s.add_dependency(%q<flexmock>, [">= 0.8.6"])
40
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-10 00:00:00 -05:00
12
+ date: 2009-11-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.9.1
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: zerg_support
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.5
34
+ version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: echoe
27
37
  type: :development
@@ -163,13 +173,13 @@ signing_key:
163
173
  specification_version: 3
164
174
  summary: Interface with ISO 7816 smart cards.
165
175
  test_files:
166
- - test/pcsc/containers_test.rb
167
- - test/pcsc/smoke_test.rb
176
+ - test/gp/asn1_ber_test.rb
168
177
  - test/gp/cap_loader_test.rb
169
- - test/gp/gp_card_mixin_test.rb
170
178
  - test/gp/des_test.rb
171
- - test/gp/asn1_ber_test.rb
172
- - test/iso/jcop_remote_test.rb
179
+ - test/gp/gp_card_mixin_test.rb
180
+ - test/iso/auto_configurator_test.rb
173
181
  - test/iso/iso_card_mixin_test.rb
174
182
  - test/iso/iso_exception_test.rb
175
- - test/iso/auto_configurator_test.rb
183
+ - test/iso/jcop_remote_test.rb
184
+ - test/pcsc/containers_test.rb
185
+ - test/pcsc/smoke_test.rb