rslp 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +9 -0
- data/Gemfile +2 -3
- data/README.md +11 -6
- data/lib/rslp.rb +67 -59
- data/lib/slp/functions.rb +37 -11
- data/lib/slp/structs.rb +28 -2
- data/rslp.gemspec +8 -7
- data/spec/rslp_spec.rb +66 -23
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f495c04e7aa0fa38ebead86d3100b360d13de94d02ee3fc2f54bc41eb5b087c
|
4
|
+
data.tar.gz: 88a33d40ab0aa9e71048c73c765a250c60d559eda2619f483c1800bec48d4ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf1356f4e184640cf4b8f13198dca65469cf653228b1a9679dfce3da82ab0de9f236f81d85e01d3b11d3fd27e8dd472345a09aebf9111df207dc233c27acecb4
|
7
|
+
data.tar.gz: f67b5df2e8b5c6849b9fe826bee87b594bd4dcc351da1c640b0f3a637c106875e6160097f4e3a783abdfa9896df18b4813294dba6e94a81c914daebeb3d36f24
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,2 +1,11 @@
|
|
1
|
+
## 0.0.2 - 12-Oct-2022
|
2
|
+
* Fixed the parse_service_url singleton method. The underlying SLPSrvURL
|
3
|
+
struct is now a managed struct.
|
4
|
+
* Added some nicer method aliases to the SLPSrvURL struct.
|
5
|
+
* Refactored the underlying C function wrappers to return an SLPError enum
|
6
|
+
to more closely align with the API.
|
7
|
+
* Any internal function failures now raise an OpenSLP::SLP::Error instead
|
8
|
+
of a SystemCallError. The error message has also been improved.
|
9
|
+
|
1
10
|
## 0.0.1 - 2-Jul-2021
|
2
11
|
* Initial release
|
data/Gemfile
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
end
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gemspec
|
data/README.md
CHANGED
@@ -4,14 +4,18 @@ A Ruby wrapper for OpenSLP using FFI.
|
|
4
4
|
## Installation
|
5
5
|
`gem install rslp`
|
6
6
|
|
7
|
+
## Adding the trusted cert
|
8
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/rslp/main/certs/djberg96_pub.pem)`
|
9
|
+
|
7
10
|
## Synopsis
|
8
11
|
```ruby
|
9
12
|
require 'rslp'
|
10
13
|
|
14
|
+
# See docs for more methods
|
11
15
|
OpenSLP::SLP.new do |slp|
|
12
|
-
|
13
|
-
p slp.find_services
|
16
|
+
p slp.find_services('myservice:myorg')
|
14
17
|
p slp.find_scopes
|
18
|
+
p slp.find_service_types
|
15
19
|
end
|
16
20
|
```
|
17
21
|
|
@@ -25,18 +29,19 @@ None at this time.
|
|
25
29
|
|
26
30
|
## Maintenance
|
27
31
|
Please contact me about taking over maintenance of this library if you are
|
28
|
-
interested. I'm not actually using it myself,
|
29
|
-
|
32
|
+
interested. I'm not actually using it myself, so maintenance and releases
|
33
|
+
will be sporadic at best.
|
30
34
|
|
31
35
|
Why then? I originally wrote most of this when I thought we might need it
|
32
36
|
for a project at work. That never materialized, but I hated to let it go to
|
33
|
-
waste, so I've published what I completed
|
37
|
+
waste, so I've published what I completed and may occasionally tinker with
|
38
|
+
it from time to time.
|
34
39
|
|
35
40
|
## License
|
36
41
|
Apache-2.0
|
37
42
|
|
38
43
|
## Copyright
|
39
|
-
(C) 2003-
|
44
|
+
(C) 2003-2022 Daniel J. Berger, All Rights Reserved
|
40
45
|
|
41
46
|
## Warranty
|
42
47
|
This package is provided "as is" and without any express or
|
data/lib/rslp.rb
CHANGED
@@ -11,7 +11,10 @@ module OpenSLP
|
|
11
11
|
extend OpenSLP::Functions
|
12
12
|
|
13
13
|
# The version of the rslp library.
|
14
|
-
VERSION = '0.0.
|
14
|
+
VERSION = '0.0.2'.freeze
|
15
|
+
|
16
|
+
# Internal error raised whenever an openslp function fails.
|
17
|
+
class Error < StandardError; end
|
15
18
|
|
16
19
|
# The language tag for requests.
|
17
20
|
attr_reader :lang
|
@@ -27,7 +30,7 @@ module OpenSLP
|
|
27
30
|
# machine's locale.
|
28
31
|
#
|
29
32
|
# The +async+ argument may be set to true or false and establishes whether
|
30
|
-
# the underlying handle is set to
|
33
|
+
# the underlying handle is set to handle asynchronous operations or not. By
|
31
34
|
# default this value is false.
|
32
35
|
#
|
33
36
|
# If a block is given, then the object itself is yielded to the block, and
|
@@ -49,9 +52,8 @@ module OpenSLP
|
|
49
52
|
|
50
53
|
ptr = FFI::MemoryPointer.new(:ulong)
|
51
54
|
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
+
result = SLPOpen(lang, async, ptr)
|
56
|
+
raise Error, "SLPOpen(): #{result}" if result != :SLP_OK
|
55
57
|
|
56
58
|
@handle = ptr.read_ulong
|
57
59
|
|
@@ -96,20 +98,24 @@ module OpenSLP
|
|
96
98
|
attributes = ""
|
97
99
|
end
|
98
100
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
101
|
+
begin
|
102
|
+
cookie = FFI::MemoryPointer.new(:void)
|
103
|
+
|
104
|
+
result = SLPReg(
|
105
|
+
@handle,
|
106
|
+
options[:url],
|
107
|
+
options[:lifetime],
|
108
|
+
nil,
|
109
|
+
attributes,
|
110
|
+
options[:fresh],
|
111
|
+
options[:callback],
|
112
|
+
cookie
|
113
|
+
)
|
114
|
+
|
115
|
+
raise Error, "SLPReg(): #{result}" if result != :SLP_OK
|
116
|
+
ensure
|
117
|
+
cookie.free unless cookie.null?
|
118
|
+
end
|
113
119
|
|
114
120
|
options[:url]
|
115
121
|
end
|
@@ -119,10 +125,14 @@ module OpenSLP
|
|
119
125
|
#
|
120
126
|
def deregister(url)
|
121
127
|
callback = Proc.new{ |hslp, err, cookie| }
|
122
|
-
cookie = FFI::MemoryPointer.new(:void)
|
123
128
|
|
124
|
-
|
125
|
-
|
129
|
+
begin
|
130
|
+
cookie = FFI::MemoryPointer.new(:void)
|
131
|
+
result = SLPDereg(@handle, url, callback, cookie)
|
132
|
+
raise Error, "SLPDereg(): #{result}" if result != :SLP_OK
|
133
|
+
ensure
|
134
|
+
cookie.free unless cookie.null?
|
135
|
+
end
|
126
136
|
|
127
137
|
true
|
128
138
|
end
|
@@ -135,10 +145,14 @@ module OpenSLP
|
|
135
145
|
#
|
136
146
|
def delete_service_attributes(url, attributes)
|
137
147
|
callback = Proc.new{ |hslp, err, cookie| }
|
138
|
-
cookie = FFI::MemoryPointer.new(:void)
|
139
148
|
|
140
|
-
|
141
|
-
|
149
|
+
begin
|
150
|
+
cookie = FFI::MemoryPointer.new(:void)
|
151
|
+
result = SLPDelAttrs(@handle, url, attributes, callback, cookie)
|
152
|
+
raise Error, "SLPDelAttrs(): #{result}" if result != :SLP_OK
|
153
|
+
ensure
|
154
|
+
cookie.free unless cookie.null?
|
155
|
+
end
|
142
156
|
|
143
157
|
attributes
|
144
158
|
end
|
@@ -150,16 +164,13 @@ module OpenSLP
|
|
150
164
|
begin
|
151
165
|
pptr = FFI::MemoryPointer.new(:pointer, 128)
|
152
166
|
|
153
|
-
|
154
|
-
|
155
|
-
if rv != SLP_OK
|
156
|
-
raise SystemCallError.new('SLPFindScopes', rv)
|
157
|
-
end
|
167
|
+
result = SLPFindScopes(@handle, pptr)
|
168
|
+
raise Error, "SLPFindScopes(): #{result}" if result != :SLP_OK
|
158
169
|
|
159
170
|
arr = pptr.read_array_of_string
|
160
171
|
ensure
|
161
172
|
SLPFree(pptr.read_pointer)
|
162
|
-
pptr.free
|
173
|
+
pptr.free unless pptr.null?
|
163
174
|
end
|
164
175
|
|
165
176
|
arr
|
@@ -189,12 +200,12 @@ module OpenSLP
|
|
189
200
|
end
|
190
201
|
}
|
191
202
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
203
|
+
begin
|
204
|
+
cookie = FFI::MemoryPointer.new(:void)
|
205
|
+
result = SLPFindSrvs(@handle, type, scope, filter, callback, cookie)
|
206
|
+
raise Error, "SLPFindSrvs(): #{result}" if result != :SLP_OK
|
207
|
+
ensure
|
208
|
+
cookie.free unless cookie.null?
|
198
209
|
end
|
199
210
|
|
200
211
|
arr
|
@@ -223,12 +234,12 @@ module OpenSLP
|
|
223
234
|
end
|
224
235
|
}
|
225
236
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
237
|
+
begin
|
238
|
+
cookie = FFI::MemoryPointer.new(:void)
|
239
|
+
result = SLPFindSrvTypes(@handle, auth, scope, callback, cookie)
|
240
|
+
raise Error, "SLPFindSrvs(): #{result}" if result != :SLP_OK
|
241
|
+
ensure
|
242
|
+
cookie.free unless cookie.null?
|
232
243
|
end
|
233
244
|
|
234
245
|
arr
|
@@ -251,12 +262,12 @@ module OpenSLP
|
|
251
262
|
end
|
252
263
|
}
|
253
264
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
265
|
+
begin
|
266
|
+
cookie = FFI::MemoryPointer.new(:void)
|
267
|
+
result = SLPFindAttrs(@handle, url, scope, attrs, callback, cookie)
|
268
|
+
raise Error, "SLPFindAttrs(): #{result}" if result != :SLP_OK
|
269
|
+
ensure
|
270
|
+
cookie.free unless cookie.null?
|
260
271
|
end
|
261
272
|
|
262
273
|
arr
|
@@ -292,14 +303,13 @@ module OpenSLP
|
|
292
303
|
begin
|
293
304
|
pptr = FFI::MemoryPointer.new(SLPSrvURL)
|
294
305
|
|
295
|
-
|
296
|
-
|
297
|
-
end
|
306
|
+
result = SLPParseSrvURL(url, pptr)
|
307
|
+
raise Error, "SLPParseSrvURL(): #{result}" if result != :SLP_OK
|
298
308
|
|
299
309
|
ptr = pptr.read_pointer
|
300
310
|
struct = SLPSrvURL.new(ptr)
|
301
311
|
ensure
|
302
|
-
|
312
|
+
pptr.free unless pptr.null?
|
303
313
|
end
|
304
314
|
|
305
315
|
struct
|
@@ -312,9 +322,8 @@ module OpenSLP
|
|
312
322
|
begin
|
313
323
|
pptr = FFI::MemoryPointer.new(:pointer)
|
314
324
|
|
315
|
-
|
316
|
-
|
317
|
-
end
|
325
|
+
result = SLPEscape(string, pptr, istag)
|
326
|
+
raise Error, "SLPEscape(): #{result}" if result != :SLP_OK
|
318
327
|
|
319
328
|
str = pptr.read_pointer.read_string
|
320
329
|
ensure
|
@@ -331,9 +340,8 @@ module OpenSLP
|
|
331
340
|
begin
|
332
341
|
pptr = FFI::MemoryPointer.new(:pointer)
|
333
342
|
|
334
|
-
|
335
|
-
|
336
|
-
end
|
343
|
+
result = SLPUnescape(string, pptr, istag)
|
344
|
+
raise Error, "SLPUnescape(): #{result}" if result != :SLP_OK
|
337
345
|
|
338
346
|
str = pptr.read_pointer.read_string
|
339
347
|
ensure
|
data/lib/slp/functions.rb
CHANGED
@@ -19,6 +19,29 @@ module OpenSLP
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
SLPError = enum(
|
23
|
+
:SLP_LAST_CALL, 1,
|
24
|
+
:SLP_OK, 0,
|
25
|
+
:SLP_LANGUAGE_NOT_SUPPORTED, -1,
|
26
|
+
:SLP_PARSE_ERROR, -2,
|
27
|
+
:SLP_INVALID_REGISTRATION, -3,
|
28
|
+
:SLP_SCOPE_NOT_SUPPORTED, -4,
|
29
|
+
:SLP_AUTHENTICATION_ABSENT, -6,
|
30
|
+
:SLP_AUTHENTICATION_FAILED, -7,
|
31
|
+
:SLP_INVALID_UPDATE, -13,
|
32
|
+
:SLP_REFRESH_REJECTED, -15,
|
33
|
+
:SLP_NOT_IMPLEMENTED, -17,
|
34
|
+
:SLP_BUFFER_OVERFLOW, -18,
|
35
|
+
:SLP_NETWORK_TIMED_OUT, -19,
|
36
|
+
:SLP_NETWORK_INIT_FAILED, -20,
|
37
|
+
:SLP_MEMORY_ALLOC_FAILED, -21,
|
38
|
+
:SLP_PARAMETER_BAD, -22,
|
39
|
+
:SLP_NETWORK_ERROR, -23,
|
40
|
+
:SLP_INTERNAL_SYSTEM_ERROR, -24,
|
41
|
+
:SLP_HANDLE_IN_USE, -25,
|
42
|
+
:SLP_TYPE_ERROR, -26
|
43
|
+
)
|
44
|
+
|
22
45
|
typedef :ulong, :handle
|
23
46
|
|
24
47
|
callback :SLPSrvURLCallback, [:handle, :string, :ushort, :int, :pointer], :bool
|
@@ -27,28 +50,31 @@ module OpenSLP
|
|
27
50
|
callback :SLPRegReportCallback, [:handle, :int, :pointer], :void
|
28
51
|
|
29
52
|
attach_function :SLPClose, [:handle], :void
|
30
|
-
attach_function :SLPEscape, [:string, :pointer, :bool],
|
31
|
-
attach_function :SLPDelAttrs, [:handle, :string, :string, :SLPRegReportCallback, :pointer],
|
32
|
-
attach_function :SLPDereg, [:handle, :string, :SLPRegReportCallback, :pointer],
|
53
|
+
attach_function :SLPEscape, [:string, :pointer, :bool], SLPError
|
54
|
+
attach_function :SLPDelAttrs, [:handle, :string, :string, :SLPRegReportCallback, :pointer], SLPError
|
55
|
+
attach_function :SLPDereg, [:handle, :string, :SLPRegReportCallback, :pointer], SLPError
|
33
56
|
|
34
57
|
attach_function :SLPFindAttrs,
|
35
|
-
[:handle, :string, :string, :string, :SLPAttrCallback, :pointer],
|
58
|
+
[:handle, :string, :string, :string, :SLPAttrCallback, :pointer], SLPError
|
36
59
|
|
37
|
-
attach_function :SLPFindScopes, [:handle, :pointer],
|
60
|
+
attach_function :SLPFindScopes, [:handle, :pointer], SLPError
|
38
61
|
|
39
62
|
attach_function :SLPFindSrvs,
|
40
|
-
[:handle, :string, :string, :string, :SLPSrvURLCallback, :pointer],
|
63
|
+
[:handle, :string, :string, :string, :SLPSrvURLCallback, :pointer], SLPError
|
41
64
|
|
42
65
|
attach_function :SLPFindSrvTypes,
|
43
|
-
[:handle, :string, :string, :SLPSrvTypeCallback, :pointer],
|
66
|
+
[:handle, :string, :string, :SLPSrvTypeCallback, :pointer], SLPError
|
44
67
|
|
45
68
|
attach_function :SLPFree, [:pointer], :void
|
46
69
|
attach_function :SLPGetProperty, [:string], :string
|
47
70
|
attach_function :SLPGetRefreshInterval, [], :uint
|
48
|
-
attach_function :SLPOpen, [:string, :bool, :pointer],
|
49
|
-
attach_function :SLPParseSrvURL, [:string, :pointer],
|
50
|
-
|
71
|
+
attach_function :SLPOpen, [:string, :bool, :pointer], SLPError
|
72
|
+
attach_function :SLPParseSrvURL, [:string, :pointer], SLPError
|
73
|
+
|
74
|
+
attach_function :SLPReg,
|
75
|
+
[:handle, :string, :ushort, :string, :string, :bool, :SLPRegReportCallback, :pointer], SLPError
|
76
|
+
|
51
77
|
attach_function :SLPSetProperty, [:string, :string], :void
|
52
|
-
attach_function :SLPUnescape, [:string, :pointer, :bool],
|
78
|
+
attach_function :SLPUnescape, [:string, :pointer, :bool], SLPError
|
53
79
|
end
|
54
80
|
end
|
data/lib/slp/structs.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
require_relative 'functions'
|
2
2
|
|
3
3
|
module OpenSLP
|
4
4
|
module Structs
|
5
|
-
class SLPSrvURL < FFI::
|
5
|
+
class SLPSrvURL < FFI::ManagedStruct
|
6
|
+
extend OpenSLP::Functions
|
7
|
+
|
6
8
|
layout(
|
7
9
|
:s_pcSrvType, :string,
|
8
10
|
:s_pcHost, :string,
|
@@ -10,6 +12,30 @@ module OpenSLP
|
|
10
12
|
:s_pcNetFamily, :string,
|
11
13
|
:s_pcSrvPart, :string
|
12
14
|
)
|
15
|
+
|
16
|
+
def self.release(pointer)
|
17
|
+
SLPFree(pointer) unless pointer.null?
|
18
|
+
end
|
19
|
+
|
20
|
+
def service_type
|
21
|
+
self[:s_pcSrvType]
|
22
|
+
end
|
23
|
+
|
24
|
+
def host
|
25
|
+
self[:s_pcHost]
|
26
|
+
end
|
27
|
+
|
28
|
+
def port
|
29
|
+
self[:s_iPort]
|
30
|
+
end
|
31
|
+
|
32
|
+
def net_family
|
33
|
+
self[:s_pcNetFamily]
|
34
|
+
end
|
35
|
+
|
36
|
+
def url_remainder
|
37
|
+
self[:s_pcSrvPart]
|
38
|
+
end
|
13
39
|
end
|
14
40
|
end
|
15
41
|
end
|
data/rslp.gemspec
CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'rslp'
|
6
|
-
spec.version = '0.0.
|
6
|
+
spec.version = '0.0.2'
|
7
7
|
spec.license = 'Apache-2.0'
|
8
8
|
spec.author = 'Daniel J. Berger'
|
9
9
|
spec.email = 'djberg96@gmail.com'
|
@@ -21,12 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency('rspec', "~> 3.9")
|
22
22
|
|
23
23
|
spec.metadata = {
|
24
|
-
'homepage_uri'
|
25
|
-
'bug_tracker_uri'
|
26
|
-
'changelog_uri'
|
27
|
-
'documentation_uri'
|
28
|
-
'source_code_uri'
|
29
|
-
'wiki_uri'
|
24
|
+
'homepage_uri' => 'https://github.com/djberg96/rslp',
|
25
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/rslp/issues',
|
26
|
+
'changelog_uri' => 'https://github.com/djberg96/rslp/blob/main/CHANGES.md',
|
27
|
+
'documentation_uri' => 'https://github.com/djberg96/rslp/wiki',
|
28
|
+
'source_code_uri' => 'https://github.com/djberg96/rslp',
|
29
|
+
'wiki_uri' => 'https://github.com/djberg96/rslp/wiki',
|
30
|
+
'rubygems_mfa_required' => 'true'
|
30
31
|
}
|
31
32
|
|
32
33
|
spec.description = <<-EOF
|
data/spec/rslp_spec.rb
CHANGED
@@ -6,25 +6,25 @@
|
|
6
6
|
require 'rspec'
|
7
7
|
require 'rslp'
|
8
8
|
|
9
|
-
describe OpenSLP::SLP do
|
9
|
+
RSpec.describe OpenSLP::SLP do
|
10
10
|
before do
|
11
11
|
@lang = 'en-us'
|
12
|
-
@slp =
|
12
|
+
@slp = described_class.new(@lang, false)
|
13
13
|
end
|
14
14
|
|
15
15
|
context "version" do
|
16
16
|
example "version is set to the expected value" do
|
17
|
-
expect(
|
17
|
+
expect(described_class::VERSION).to eq('0.0.2')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
context "constructor" do
|
22
22
|
example "defaults to an empty string if no lang is provided" do
|
23
|
-
expect(
|
23
|
+
expect(described_class.new.lang).to eq('')
|
24
24
|
end
|
25
25
|
|
26
26
|
example "defaults to a false async value if no value is provided" do
|
27
|
-
expect(
|
27
|
+
expect(described_class.new.async).to be false
|
28
28
|
end
|
29
29
|
|
30
30
|
example "sets attributes to expected values" do
|
@@ -33,38 +33,81 @@ describe OpenSLP::SLP do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
describe "singleton methods" do
|
37
|
+
context "refresh_interval" do
|
38
|
+
example "defines a refresh_interval method" do
|
39
|
+
expect(described_class).to respond_to(:refresh_interval)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
example "returns the expected value for refresh_interval" do
|
43
|
+
expect(described_class.refresh_interval).to eq(0)
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
example "defines a get_property method" do
|
46
|
-
expect(
|
48
|
+
expect(described_class).to respond_to(:get_property)
|
47
49
|
end
|
48
50
|
|
49
51
|
example "defines a set_property method" do
|
50
|
-
expect(
|
52
|
+
expect(described_class).to respond_to(:set_property)
|
51
53
|
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
context "parse_service_url" do
|
56
|
+
let(:valid_url) { "service:test.openslp://192.168.100.1:3003,en,65535" }
|
57
|
+
|
58
|
+
before do
|
59
|
+
@struct = described_class.parse_service_url(valid_url)
|
60
|
+
end
|
61
|
+
|
62
|
+
example "defines a parse_service_url method" do
|
63
|
+
expect(described_class).to respond_to(:parse_service_url)
|
64
|
+
end
|
65
|
+
|
66
|
+
example "does not raise an error if the url is valid" do
|
67
|
+
expect{ described_class.parse_service_url(valid_url) }.not_to raise_error
|
68
|
+
end
|
69
|
+
|
70
|
+
example "returns a struct with the expected service type" do
|
71
|
+
expect(@struct.service_type).to eq("service:test.openslp")
|
72
|
+
end
|
56
73
|
|
57
|
-
|
58
|
-
|
74
|
+
example "returns a struct with the expected host" do
|
75
|
+
expect(@struct.host).to eq("192.168.100.1")
|
76
|
+
end
|
77
|
+
|
78
|
+
example "returns a struct with the expected port" do
|
79
|
+
expect(@struct.port).to eq(3003)
|
80
|
+
end
|
81
|
+
|
82
|
+
example "returns a struct with the expected net family" do
|
83
|
+
expect(@struct.net_family).to eq("")
|
84
|
+
end
|
85
|
+
|
86
|
+
example "returns a struct with the expected url remainder" do
|
87
|
+
expect(@struct.url_remainder).to eq("")
|
88
|
+
end
|
59
89
|
end
|
60
90
|
|
61
|
-
|
62
|
-
|
63
|
-
|
91
|
+
context "escape_reserved" do
|
92
|
+
example "defines a escape_reserved method" do
|
93
|
+
expect(described_class).to respond_to(:escape_reserved)
|
94
|
+
end
|
95
|
+
|
96
|
+
example "returns the expected value for the escape_reserved method" do
|
97
|
+
expected = "\\2Ctag-example\\2C"
|
98
|
+
expect(described_class.escape_reserved(",tag-example,")).to eq(expected)
|
99
|
+
end
|
64
100
|
end
|
65
101
|
|
66
|
-
|
67
|
-
|
102
|
+
context "unescape_reserved" do
|
103
|
+
example "defines a unescape_reserved method" do
|
104
|
+
expect(described_class).to respond_to(:unescape_reserved)
|
105
|
+
end
|
106
|
+
|
107
|
+
example "returns the expected value for the unescape_reserved method" do
|
108
|
+
expected = ",tag-example,"
|
109
|
+
expect(described_class.unescape_reserved("\\2Ctag-example\\2C")).to eq(expected)
|
110
|
+
end
|
68
111
|
end
|
69
112
|
end
|
70
113
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rslp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: ffi
|
@@ -115,6 +115,7 @@ metadata:
|
|
115
115
|
documentation_uri: https://github.com/djberg96/rslp/wiki
|
116
116
|
source_code_uri: https://github.com/djberg96/rslp
|
117
117
|
wiki_uri: https://github.com/djberg96/rslp/wiki
|
118
|
+
rubygems_mfa_required: 'true'
|
118
119
|
post_install_message:
|
119
120
|
rdoc_options: []
|
120
121
|
require_paths:
|
@@ -130,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.3.16
|
134
135
|
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: Interface for the OpenSLP library
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
IhQ����f� �w��m
|
2
|
+
���m�Wb�p��{~������������{�P�Z p僖��y��|yF�Ɣ#���J�����/�Om�S6٭�?�k+z�Wq#��Ӷ�(Q�Q��9G��3��r�"������GI2>�Q�f}�P��ؑ�e�ZZO�6IlLh�4*Gj����Rϻ�'��Y�i�^���I��ETrػ*�j��#/(
|
3
|
+
>y���z*
|