qpid_proton 0.19.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/examples/README.md +76 -0
  3. data/examples/broker.rb +167 -0
  4. data/examples/client.rb +79 -0
  5. data/examples/direct_recv.rb +61 -0
  6. data/examples/direct_send.rb +67 -0
  7. data/examples/example_test.rb +109 -0
  8. data/examples/helloworld.rb +57 -0
  9. data/examples/server.rb +70 -0
  10. data/examples/simple_recv.rb +57 -0
  11. data/examples/simple_send.rb +63 -0
  12. data/examples/ssl_certs/README.txt +24 -0
  13. data/examples/ssl_certs/tclient-certificate.p12 +0 -0
  14. data/examples/ssl_certs/tclient-certificate.pem +19 -0
  15. data/examples/ssl_certs/tclient-full.p12 +0 -0
  16. data/examples/ssl_certs/tclient-private-key.pem +30 -0
  17. data/examples/ssl_certs/tserver-certificate.p12 +0 -0
  18. data/examples/ssl_certs/tserver-certificate.pem +19 -0
  19. data/examples/ssl_certs/tserver-full.p12 +0 -0
  20. data/examples/ssl_certs/tserver-private-key.pem +30 -0
  21. data/examples/ssl_send.rb +70 -0
  22. data/ext/cproton/cproton.c +105 -74
  23. data/lib/core/container.rb +2 -1
  24. data/lib/core/ssl_domain.rb +1 -1
  25. data/lib/core/uri.rb +15 -9
  26. data/lib/handler/messaging_adapter.rb +20 -5
  27. data/tests/old_examples/broker.rb +200 -0
  28. data/tests/old_examples/client.rb +81 -0
  29. data/tests/old_examples/direct_recv.rb +64 -0
  30. data/tests/old_examples/direct_send.rb +63 -0
  31. data/tests/old_examples/helloworld.rb +72 -0
  32. data/tests/old_examples/helloworld_direct.rb +73 -0
  33. data/tests/old_examples/lib/debugging.rb +25 -0
  34. data/tests/old_examples/lib/driver.rb +68 -0
  35. data/tests/old_examples/lib/qpid_examples.rb +26 -0
  36. data/tests/old_examples/lib/selectable.rb +119 -0
  37. data/tests/old_examples/lib/send_and_receive.rb +89 -0
  38. data/tests/old_examples/old_example_test.rb +107 -0
  39. data/tests/old_examples/recv.rb +23 -0
  40. data/tests/old_examples/send.rb +21 -0
  41. data/tests/old_examples/server.rb +75 -0
  42. data/tests/old_examples/simple_recv.rb +57 -0
  43. data/tests/old_examples/simple_send.rb +54 -0
  44. data/tests/test_connection_driver.rb +134 -0
  45. data/tests/test_container.rb +319 -0
  46. data/tests/test_data.rb +66 -0
  47. data/tests/test_delivery.rb +110 -0
  48. data/tests/test_interop.rb +131 -0
  49. data/tests/test_messaging_adapter.rb +223 -0
  50. data/tests/test_old_adapter.rb +228 -0
  51. data/tests/test_tools.rb +147 -0
  52. data/tests/test_uri.rb +83 -0
  53. metadata +49 -3
@@ -0,0 +1,57 @@
1
+ #--
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #++
19
+
20
+ require 'qpid_proton'
21
+ require 'optparse'
22
+
23
+ class SimpleReceive < Qpid::Proton::MessagingHandler
24
+
25
+ def initialize(url, address, count)
26
+ super()
27
+ @url = url
28
+ @address = address
29
+ @expected = count
30
+ @received = 0
31
+ end
32
+
33
+ def on_container_start(container)
34
+ c = container.connect(@url)
35
+ c.open_receiver(@address)
36
+ end
37
+
38
+ def on_message(delivery, message)
39
+ if @expected.zero? || (@received < @expected)
40
+ puts "Received: #{message.body}"
41
+ @received = @received + 1
42
+ if @received == @expected
43
+ delivery.connection.close
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ unless (2..3).include? ARGV.size
50
+ STDERR.puts "Usage: #{__FILE__} URL ADDRESS [COUNT]}
51
+ Connect to URL and receive COUNT messages from ADDRESS"
52
+ return 1
53
+ end
54
+ url, address, count = ARGV
55
+ count = Integer(count || 10)
56
+ Qpid::Proton::Container.new(SimpleReceive.new(url, address, count)).run
57
+
@@ -0,0 +1,63 @@
1
+ #--
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #++
19
+
20
+ require 'qpid_proton'
21
+ require 'optparse'
22
+
23
+ class SimpleSend < Qpid::Proton::MessagingHandler
24
+
25
+ def initialize(url, address, expected)
26
+ super()
27
+ @url = url
28
+ @address = address
29
+ @sent = 0
30
+ @confirmed = 0
31
+ @expected = expected
32
+ end
33
+
34
+ def on_container_start(container)
35
+ c = container.connect(@url)
36
+ c.open_sender(@address)
37
+ end
38
+
39
+ def on_sendable(sender)
40
+ while sender.credit > 0 && @sent < @expected
41
+ msg = Qpid::Proton::Message.new("sequence #{@sent}", { :id => @sent } )
42
+ sender.send(msg)
43
+ @sent = @sent + 1
44
+ end
45
+ end
46
+
47
+ def on_tracker_accept(tracker)
48
+ @confirmed = @confirmed + 1
49
+ if @confirmed == @expected
50
+ puts "All #{@expected} messages confirmed!"
51
+ tracker.connection.close
52
+ end
53
+ end
54
+ end
55
+
56
+ unless (2..3).include? ARGV.size
57
+ STDERR.puts "Usage: #{__FILE__} URL ADDRESS [COUNT]}
58
+ Connect to URL and send COUNT messages to ADDRESS"
59
+ return 1
60
+ end
61
+ url, address, count = ARGV
62
+ count = Integer(count || 10)
63
+ Qpid::Proton::Container.new(SimpleSend.new(url, address, count)).run
@@ -0,0 +1,24 @@
1
+ This directory contains basic self signed test certificates for use by
2
+ proton examples.
3
+
4
+ The ".pem" files are in the format expected by proton implementations
5
+ using OpenSSL. The ".p12" file are for Windows implementations using
6
+ SChannel.
7
+
8
+ The commands used to generate the certificates follow.
9
+
10
+
11
+ make_pn_cert()
12
+ {
13
+ name=$1
14
+ subject=$2
15
+ passwd=$3
16
+ # create the pem files
17
+ openssl req -newkey rsa:2048 -keyout $name-private-key.pem -out $name-certificate.pem -subj $subject -passout pass:$passwd -x509 -days 3650
18
+ # create the p12 files
19
+ openssl pkcs12 -export -out $name-full.p12 -passin pass:$passwd -passout pass:$passwd -inkey $name-private-key.pem -in $name-certificate.pem -name $name
20
+ openssl pkcs12 -export -out $name-certificate.p12 -in $name-certificate.pem -name $name -nokeys -passout pass:
21
+ }
22
+
23
+ make_pn_cert tserver /CN=test_server/OU=proton_test tserverpw
24
+ make_pn_cert tclient /CN=test_client/OU=proton_test tclientpw
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDKzCCAhOgAwIBAgIJAIV7frIjftgcMA0GCSqGSIb3DQEBCwUAMCwxFDASBgNV
3
+ BAMMC3Rlc3RfY2xpZW50MRQwEgYDVQQLDAtwcm90b25fdGVzdDAeFw0xNTExMjcx
4
+ ODEwMzlaFw0yNTExMjQxODEwMzlaMCwxFDASBgNVBAMMC3Rlc3RfY2xpZW50MRQw
5
+ EgYDVQQLDAtwcm90b25fdGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
6
+ ggEBAPCIS4qUdOtQplUxZ6WW0LXcvosqFP6qOiCARLSEWpR3B8bq213rzefwwfcM
7
+ 4TtMr88bP+huLKmlyMfwpl8yB88eXkscPgaAce2zk24urWkFXKSQ6GPitWBLGqBa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mH47SY6HBBOL3DDP5uQ0jw8P454
21
+ QBjlMOpEZmZxO6TcEtJwu0vzgog4rQ5g3NWy6SIpjWehNwTynLt7yM3R5WTI6cZs
22
+ 0GTv/rqo2/SUoNsFmnGIUwj/DrBe4XOAq1nS2ZlEctxKhBsKH0hMFp6D1rXOzrgl
23
+ bwcq+oistoB0TLcThShyNgSqzW1znQ1n5SVUk9b5rRhSttJxn3yOMewH0i3v8bPo
24
+ HOhP5kaGjblPsCYyhlL/SNVF0OXEGTwLNey7FQdWFOwVwTRRXe7k+uGZ2d5hg+Jn
25
+ It/trDZ1RDYbVmB7/Qy73c16J4mvhOUJ2de5ZciFBjkidbiiUKLj9xnjK9k9Sauo
26
+ MKhNnDMAEU5VDQM3xNe5BRdX8dFLwfF5H64sU3nROF83aUnDgvfFEowYPnCuPYfm
27
+ m4aQHfoBSg4j3v1OeOwktcl+Q2TjxPHfWhbWeRBfxOTqQ/suYhnQChuFSK/qyo9K
28
+ ccgotqghhunRsWMoZT25H7AZM6yKb1sMz/0oyMRIKeGqoYh+ULM5XLY0xNYd4/xU
29
+ WtQ=
30
+ -----END ENCRYPTED PRIVATE KEY-----
@@ -0,0 +1,70 @@
1
+ #--
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #++
19
+
20
+ require 'qpid_proton'
21
+ require 'optparse'
22
+
23
+ class SimpleSend < Qpid::Proton::MessagingHandler
24
+
25
+ def initialize(url, address, expected)
26
+ super()
27
+ @url = url
28
+ @address = address
29
+ @sent = 0
30
+ @confirmed = 0
31
+ @expected = expected
32
+ end
33
+
34
+ def on_container_start(container)
35
+ # Use a default client SSL domain
36
+ ssl_domain = Qpid::Proton::SSLDomain.new(Qpid::Proton::SSLDomain::MODE_CLIENT)
37
+ c = container.connect(@url, { :ssl_domain => ssl_domain })
38
+ c.open_sender(@address)
39
+ end
40
+
41
+ def on_connection_open(c)
42
+ raise "No security!" unless c.transport.ssl?
43
+ STDOUT.puts "Connection secured with #{c.transport.ssl.protocol_name.inspect}"
44
+ end
45
+
46
+ def on_sendable(sender)
47
+ while sender.credit > 0 && @sent < @expected
48
+ msg = Qpid::Proton::Message.new("sequence #{@sent}", { :id => @sent } )
49
+ sender.send(msg)
50
+ @sent = @sent + 1
51
+ end
52
+ end
53
+
54
+ def on_tracker_accept(tracker)
55
+ @confirmed = @confirmed + 1
56
+ if @confirmed == @expected
57
+ puts "All #{@expected} messages confirmed!"
58
+ tracker.connection.close
59
+ end
60
+ end
61
+ end
62
+
63
+ unless (2..3).include? ARGV.size
64
+ STDERR.puts "Usage: #{__FILE__} URL ADDRESS [COUNT]}
65
+ Connect to URL and send COUNT messages to ADDRESS"
66
+ return 1
67
+ end
68
+ url, address, count = ARGV
69
+ count = Integer(count || 10)
70
+ Qpid::Proton::Container.new(SimpleSend.new(url, address, count)).run
@@ -1813,73 +1813,74 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
1813
1813
  #define SWIGTYPE_p_long swig_types[10]
1814
1814
  #define SWIGTYPE_p_long_long swig_types[11]
1815
1815
  #define SWIGTYPE_p_p_char swig_types[12]
1816
- #define SWIGTYPE_p_pn_acceptor_t swig_types[13]
1817
- #define SWIGTYPE_p_pn_atom_t swig_types[14]
1818
- #define SWIGTYPE_p_pn_bytes_t swig_types[15]
1819
- #define SWIGTYPE_p_pn_cid_t swig_types[16]
1820
- #define SWIGTYPE_p_pn_class_t swig_types[17]
1821
- #define SWIGTYPE_p_pn_collector_t swig_types[18]
1822
- #define SWIGTYPE_p_pn_condition_t swig_types[19]
1823
- #define SWIGTYPE_p_pn_connection_driver_t swig_types[20]
1824
- #define SWIGTYPE_p_pn_connection_t swig_types[21]
1825
- #define SWIGTYPE_p_pn_data_t swig_types[22]
1826
- #define SWIGTYPE_p_pn_decimal128_t swig_types[23]
1827
- #define SWIGTYPE_p_pn_delivery_t swig_types[24]
1828
- #define SWIGTYPE_p_pn_disposition_t swig_types[25]
1829
- #define SWIGTYPE_p_pn_distribution_mode_t swig_types[26]
1830
- #define SWIGTYPE_p_pn_durability_t swig_types[27]
1831
- #define SWIGTYPE_p_pn_error_t swig_types[28]
1832
- #define SWIGTYPE_p_pn_event_batch_t swig_types[29]
1833
- #define SWIGTYPE_p_pn_event_t swig_types[30]
1834
- #define SWIGTYPE_p_pn_event_type_t swig_types[31]
1835
- #define SWIGTYPE_p_pn_expiry_policy_t swig_types[32]
1836
- #define SWIGTYPE_p_pn_handler_t swig_types[33]
1837
- #define SWIGTYPE_p_pn_hash_t swig_types[34]
1838
- #define SWIGTYPE_p_pn_iterator_t swig_types[35]
1839
- #define SWIGTYPE_p_pn_link_t swig_types[36]
1840
- #define SWIGTYPE_p_pn_list_t swig_types[37]
1841
- #define SWIGTYPE_p_pn_listener_t swig_types[38]
1842
- #define SWIGTYPE_p_pn_map_t swig_types[39]
1843
- #define SWIGTYPE_p_pn_message_t swig_types[40]
1844
- #define SWIGTYPE_p_pn_messenger_t swig_types[41]
1845
- #define SWIGTYPE_p_pn_proactor_t swig_types[42]
1846
- #define SWIGTYPE_p_pn_rcv_settle_mode_t swig_types[43]
1847
- #define SWIGTYPE_p_pn_reactor_t swig_types[44]
1848
- #define SWIGTYPE_p_pn_record_t swig_types[45]
1849
- #define SWIGTYPE_p_pn_rwbytes_t swig_types[46]
1850
- #define SWIGTYPE_p_pn_sasl_outcome_t swig_types[47]
1851
- #define SWIGTYPE_p_pn_sasl_t swig_types[48]
1852
- #define SWIGTYPE_p_pn_selectable_t swig_types[49]
1853
- #define SWIGTYPE_p_pn_session_t swig_types[50]
1854
- #define SWIGTYPE_p_pn_snd_settle_mode_t swig_types[51]
1855
- #define SWIGTYPE_p_pn_ssl_cert_subject_subfield swig_types[52]
1856
- #define SWIGTYPE_p_pn_ssl_domain_t swig_types[53]
1857
- #define SWIGTYPE_p_pn_ssl_hash_alg swig_types[54]
1858
- #define SWIGTYPE_p_pn_ssl_mode_t swig_types[55]
1859
- #define SWIGTYPE_p_pn_ssl_resume_status_t swig_types[56]
1860
- #define SWIGTYPE_p_pn_ssl_t swig_types[57]
1861
- #define SWIGTYPE_p_pn_ssl_verify_mode_t swig_types[58]
1862
- #define SWIGTYPE_p_pn_status_t swig_types[59]
1863
- #define SWIGTYPE_p_pn_string_t swig_types[60]
1864
- #define SWIGTYPE_p_pn_subscription_t swig_types[61]
1865
- #define SWIGTYPE_p_pn_task_t swig_types[62]
1866
- #define SWIGTYPE_p_pn_terminus_t swig_types[63]
1867
- #define SWIGTYPE_p_pn_terminus_type_t swig_types[64]
1868
- #define SWIGTYPE_p_pn_timer_t swig_types[65]
1869
- #define SWIGTYPE_p_pn_transport_t swig_types[66]
1870
- #define SWIGTYPE_p_pn_type_t swig_types[67]
1871
- #define SWIGTYPE_p_pn_url_t swig_types[68]
1872
- #define SWIGTYPE_p_pn_uuid_t swig_types[69]
1873
- #define SWIGTYPE_p_short swig_types[70]
1874
- #define SWIGTYPE_p_signed_char swig_types[71]
1875
- #define SWIGTYPE_p_unsigned_char swig_types[72]
1876
- #define SWIGTYPE_p_unsigned_int swig_types[73]
1877
- #define SWIGTYPE_p_unsigned_long swig_types[74]
1878
- #define SWIGTYPE_p_unsigned_long_long swig_types[75]
1879
- #define SWIGTYPE_p_unsigned_short swig_types[76]
1880
- #define SWIGTYPE_p_void swig_types[77]
1881
- static swig_type_info *swig_types[79];
1882
- static swig_module_info swig_module = {swig_types, 78, 0, 0, 0, 0};
1816
+ #define SWIGTYPE_p_p_pn_connection_driver_t swig_types[13]
1817
+ #define SWIGTYPE_p_pn_acceptor_t swig_types[14]
1818
+ #define SWIGTYPE_p_pn_atom_t swig_types[15]
1819
+ #define SWIGTYPE_p_pn_bytes_t swig_types[16]
1820
+ #define SWIGTYPE_p_pn_cid_t swig_types[17]
1821
+ #define SWIGTYPE_p_pn_class_t swig_types[18]
1822
+ #define SWIGTYPE_p_pn_collector_t swig_types[19]
1823
+ #define SWIGTYPE_p_pn_condition_t swig_types[20]
1824
+ #define SWIGTYPE_p_pn_connection_driver_t swig_types[21]
1825
+ #define SWIGTYPE_p_pn_connection_t swig_types[22]
1826
+ #define SWIGTYPE_p_pn_data_t swig_types[23]
1827
+ #define SWIGTYPE_p_pn_decimal128_t swig_types[24]
1828
+ #define SWIGTYPE_p_pn_delivery_t swig_types[25]
1829
+ #define SWIGTYPE_p_pn_disposition_t swig_types[26]
1830
+ #define SWIGTYPE_p_pn_distribution_mode_t swig_types[27]
1831
+ #define SWIGTYPE_p_pn_durability_t swig_types[28]
1832
+ #define SWIGTYPE_p_pn_error_t swig_types[29]
1833
+ #define SWIGTYPE_p_pn_event_batch_t swig_types[30]
1834
+ #define SWIGTYPE_p_pn_event_t swig_types[31]
1835
+ #define SWIGTYPE_p_pn_event_type_t swig_types[32]
1836
+ #define SWIGTYPE_p_pn_expiry_policy_t swig_types[33]
1837
+ #define SWIGTYPE_p_pn_handler_t swig_types[34]
1838
+ #define SWIGTYPE_p_pn_hash_t swig_types[35]
1839
+ #define SWIGTYPE_p_pn_iterator_t swig_types[36]
1840
+ #define SWIGTYPE_p_pn_link_t swig_types[37]
1841
+ #define SWIGTYPE_p_pn_list_t swig_types[38]
1842
+ #define SWIGTYPE_p_pn_listener_t swig_types[39]
1843
+ #define SWIGTYPE_p_pn_map_t swig_types[40]
1844
+ #define SWIGTYPE_p_pn_message_t swig_types[41]
1845
+ #define SWIGTYPE_p_pn_messenger_t swig_types[42]
1846
+ #define SWIGTYPE_p_pn_proactor_t swig_types[43]
1847
+ #define SWIGTYPE_p_pn_rcv_settle_mode_t swig_types[44]
1848
+ #define SWIGTYPE_p_pn_reactor_t swig_types[45]
1849
+ #define SWIGTYPE_p_pn_record_t swig_types[46]
1850
+ #define SWIGTYPE_p_pn_rwbytes_t swig_types[47]
1851
+ #define SWIGTYPE_p_pn_sasl_outcome_t swig_types[48]
1852
+ #define SWIGTYPE_p_pn_sasl_t swig_types[49]
1853
+ #define SWIGTYPE_p_pn_selectable_t swig_types[50]
1854
+ #define SWIGTYPE_p_pn_session_t swig_types[51]
1855
+ #define SWIGTYPE_p_pn_snd_settle_mode_t swig_types[52]
1856
+ #define SWIGTYPE_p_pn_ssl_cert_subject_subfield swig_types[53]
1857
+ #define SWIGTYPE_p_pn_ssl_domain_t swig_types[54]
1858
+ #define SWIGTYPE_p_pn_ssl_hash_alg swig_types[55]
1859
+ #define SWIGTYPE_p_pn_ssl_mode_t swig_types[56]
1860
+ #define SWIGTYPE_p_pn_ssl_resume_status_t swig_types[57]
1861
+ #define SWIGTYPE_p_pn_ssl_t swig_types[58]
1862
+ #define SWIGTYPE_p_pn_ssl_verify_mode_t swig_types[59]
1863
+ #define SWIGTYPE_p_pn_status_t swig_types[60]
1864
+ #define SWIGTYPE_p_pn_string_t swig_types[61]
1865
+ #define SWIGTYPE_p_pn_subscription_t swig_types[62]
1866
+ #define SWIGTYPE_p_pn_task_t swig_types[63]
1867
+ #define SWIGTYPE_p_pn_terminus_t swig_types[64]
1868
+ #define SWIGTYPE_p_pn_terminus_type_t swig_types[65]
1869
+ #define SWIGTYPE_p_pn_timer_t swig_types[66]
1870
+ #define SWIGTYPE_p_pn_transport_t swig_types[67]
1871
+ #define SWIGTYPE_p_pn_type_t swig_types[68]
1872
+ #define SWIGTYPE_p_pn_url_t swig_types[69]
1873
+ #define SWIGTYPE_p_pn_uuid_t swig_types[70]
1874
+ #define SWIGTYPE_p_short swig_types[71]
1875
+ #define SWIGTYPE_p_signed_char swig_types[72]
1876
+ #define SWIGTYPE_p_unsigned_char swig_types[73]
1877
+ #define SWIGTYPE_p_unsigned_int swig_types[74]
1878
+ #define SWIGTYPE_p_unsigned_long swig_types[75]
1879
+ #define SWIGTYPE_p_unsigned_long_long swig_types[76]
1880
+ #define SWIGTYPE_p_unsigned_short swig_types[77]
1881
+ #define SWIGTYPE_p_void swig_types[78]
1882
+ static swig_type_info *swig_types[80];
1883
+ static swig_module_info swig_module = {swig_types, 79, 0, 0, 0, 0};
1883
1884
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1884
1885
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1885
1886
 
@@ -2160,18 +2161,19 @@ SWIG_From_bool (bool value)
2160
2161
  }
2161
2162
 
2162
2163
 
2163
- #if defined(RUBY20) || defined(RUBY21)
2164
+ #if defined(RUBY_USE_rb_thread_call_without_gvl)
2164
2165
 
2166
+ #include <ruby/thread.h>
2165
2167
  typedef void *non_blocking_return_t;
2166
- #define RB_BLOCKING_CALL rb_thread_call_without_gvl
2168
+ #define RB_BLOCKING_CALL (VALUE)rb_thread_call_without_gvl
2167
2169
 
2168
- #elif defined(RUBY19)
2170
+ #elif defined(RUBY_USE_rb_thread_blocking_region)
2169
2171
 
2170
- typedef VALUE non_blocking_return_t;
2171
- #define RB_BLOCKING_CALL rb_thread_blocking_region
2172
+ typedef VALUE non_blocking_return_t;
2173
+ #define RB_BLOCKING_CALL rb_thread_blocking_region
2172
2174
 
2173
2175
  #endif
2174
-
2176
+
2175
2177
 
2176
2178
 
2177
2179
  #if defined(RB_BLOCKING_CALL)
@@ -21143,6 +21145,30 @@ fail:
21143
21145
  }
21144
21146
 
21145
21147
 
21148
+ SWIGINTERN VALUE
21149
+ _wrap_pn_connection_driver_ptr(int argc, VALUE *argv, VALUE self) {
21150
+ pn_connection_t *arg1 = (pn_connection_t *) 0 ;
21151
+ void *argp1 = 0 ;
21152
+ int res1 = 0 ;
21153
+ pn_connection_driver_t **result = 0 ;
21154
+ VALUE vresult = Qnil;
21155
+
21156
+ if ((argc < 1) || (argc > 1)) {
21157
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
21158
+ }
21159
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_pn_connection_t, 0 | 0 );
21160
+ if (!SWIG_IsOK(res1)) {
21161
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "pn_connection_t *","pn_connection_driver_ptr", 1, argv[0] ));
21162
+ }
21163
+ arg1 = (pn_connection_t *)(argp1);
21164
+ result = (pn_connection_driver_t **)pn_connection_driver_ptr(arg1);
21165
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_pn_connection_driver_t, 0 | 0 );
21166
+ return vresult;
21167
+ fail:
21168
+ return Qnil;
21169
+ }
21170
+
21171
+
21146
21172
  SWIGINTERN VALUE
21147
21173
  _wrap_pn_url(int argc, VALUE *argv, VALUE self) {
21148
21174
  pn_url_t *result = 0 ;
@@ -23070,6 +23096,7 @@ static swig_type_info _swigt__p_intptr_t = {"_p_intptr_t", "intptr_t *|pn_shandl
23070
23096
  static swig_type_info _swigt__p_long = {"_p_long", "int32_t *|long *|pn_sequence_t *", 0, 0, (void*)0, 0};
23071
23097
  static swig_type_info _swigt__p_long_long = {"_p_long_long", "int64_t *|long long *|pn_tracker_t *|pn_timestamp_t *", 0, 0, (void*)0, 0};
23072
23098
  static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
23099
+ static swig_type_info _swigt__p_p_pn_connection_driver_t = {"_p_p_pn_connection_driver_t", "struct pn_connection_driver_t **|pn_connection_driver_t **", 0, 0, (void*)0, 0};
23073
23100
  static swig_type_info _swigt__p_pn_acceptor_t = {"_p_pn_acceptor_t", "struct pn_acceptor_t *|pn_acceptor_t *", 0, 0, (void*)0, 0};
23074
23101
  static swig_type_info _swigt__p_pn_atom_t = {"_p_pn_atom_t", "pn_atom_t *", 0, 0, (void*)0, 0};
23075
23102
  static swig_type_info _swigt__p_pn_bytes_t = {"_p_pn_bytes_t", "struct pn_bytes_t *|pn_bytes_t *", 0, 0, (void*)0, 0};
@@ -23150,6 +23177,7 @@ static swig_type_info *swig_type_initial[] = {
23150
23177
  &_swigt__p_long,
23151
23178
  &_swigt__p_long_long,
23152
23179
  &_swigt__p_p_char,
23180
+ &_swigt__p_p_pn_connection_driver_t,
23153
23181
  &_swigt__p_pn_acceptor_t,
23154
23182
  &_swigt__p_pn_atom_t,
23155
23183
  &_swigt__p_pn_bytes_t,
@@ -23230,6 +23258,7 @@ static swig_cast_info _swigc__p_intptr_t[] = { {&_swigt__p_intptr_t, 0, 0, 0},{
23230
23258
  static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
23231
23259
  static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
23232
23260
  static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
23261
+ static swig_cast_info _swigc__p_p_pn_connection_driver_t[] = { {&_swigt__p_p_pn_connection_driver_t, 0, 0, 0},{0, 0, 0, 0}};
23233
23262
  static swig_cast_info _swigc__p_pn_acceptor_t[] = { {&_swigt__p_pn_acceptor_t, 0, 0, 0},{0, 0, 0, 0}};
23234
23263
  static swig_cast_info _swigc__p_pn_atom_t[] = { {&_swigt__p_pn_atom_t, 0, 0, 0},{0, 0, 0, 0}};
23235
23264
  static swig_cast_info _swigc__p_pn_bytes_t[] = { {&_swigt__p_pn_bytes_t, 0, 0, 0},{0, 0, 0, 0}};
@@ -23310,6 +23339,7 @@ static swig_cast_info *swig_cast_initial[] = {
23310
23339
  _swigc__p_long,
23311
23340
  _swigc__p_long_long,
23312
23341
  _swigc__p_p_char,
23342
+ _swigc__p_p_pn_connection_driver_t,
23313
23343
  _swigc__p_pn_acceptor_t,
23314
23344
  _swigc__p_pn_atom_t,
23315
23345
  _swigc__p_pn_bytes_t,
@@ -23681,7 +23711,7 @@ SWIGEXPORT void Init_cproton(void) {
23681
23711
  rb_define_module_function(mCproton, "pni_connection_driver", _wrap_pni_connection_driver, -1);
23682
23712
  rb_define_const(mCproton, "PROTON_IMPORT_EXPORT_H", SWIG_From_int((int)(1)));
23683
23713
  rb_define_const(mCproton, "PN_VERSION_MAJOR", SWIG_From_int((int)(0)));
23684
- rb_define_const(mCproton, "PN_VERSION_MINOR", SWIG_From_int((int)(19)));
23714
+ rb_define_const(mCproton, "PN_VERSION_MINOR", SWIG_From_int((int)(21)));
23685
23715
  rb_define_const(mCproton, "PN_VERSION_POINT", SWIG_From_int((int)(0)));
23686
23716
  rb_define_const(mCproton, "PROTON_TYPES_H", SWIG_From_int((int)(1)));
23687
23717
  rb_define_const(mCproton, "PN_MILLIS_MAX", SWIG_From_unsigned_SS_int((unsigned int)((~0U))));
@@ -24487,6 +24517,7 @@ SWIGEXPORT void Init_cproton(void) {
24487
24517
  rb_define_module_function(mCproton, "pn_connection_driver_errorf", _wrap_pn_connection_driver_errorf, -1);
24488
24518
  rb_define_module_function(mCproton, "pn_event_batch_connection_driver", _wrap_pn_event_batch_connection_driver, -1);
24489
24519
  rb_define_module_function(mCproton, "pn_connection_driver_log", _wrap_pn_connection_driver_log, -1);
24520
+ rb_define_module_function(mCproton, "pn_connection_driver_ptr", _wrap_pn_connection_driver_ptr, -1);
24490
24521
  rb_define_const(mCproton, "PROTON_URL_H", SWIG_From_int((int)(1)));
24491
24522
  rb_define_module_function(mCproton, "pn_url", _wrap_pn_url, -1);
24492
24523
  rb_define_module_function(mCproton, "pn_url_parse", _wrap_pn_url_parse, -1);
@@ -125,7 +125,8 @@ module Qpid::Proton
125
125
  # - nil on the @work queue makes a #run thread exit
126
126
 
127
127
  @work = Queue.new
128
- @work << :start << self # Issue start and start start selecting
128
+ @work << :start
129
+ @work << self # Issue start and start start selecting
129
130
  @wake = IO.pipe # Wakes #run thread in IO.select
130
131
  @auto_stop = true # Stop when @active drops to 0
131
132
 
@@ -48,7 +48,7 @@ module Qpid::Proton
48
48
  # @private
49
49
  def initialize(mode)
50
50
  @impl = Cproton.pn_ssl_domain(mode)
51
- raise SSLUnavailable.new if @impl.nil?
51
+ raise Qpid::Proton::SSLError, "SSL Unavailable" if @impl.nil?
52
52
  end
53
53
 
54
54
  # Set the certificate that identifies the local node to the remote.
data/lib/core/uri.rb CHANGED
@@ -37,9 +37,15 @@ module URI
37
37
  end
38
38
 
39
39
  module Qpid::Proton
40
- # Returns +s+ converted to a {URI::AMQP} or {URI::AMQPS} object
40
+ private
41
+ # Make sure to allow empty hostnames, Ruby 2.0.0 does not.
42
+ DEFAULT_URI_PARSER = URI::Parser.new(:HOSTNAME => /(?:#{URI::PATTERN::HOSTNAME})|/)
43
+
44
+ public
45
+
46
+ # Convert +s+ to a {URI::AMQP} or {URI::AMQPS} object
41
47
  #
42
- # Shortcut strings are allowed: an "amqp://" prefix is added if +s+ does
48
+ # Shortcut strings like "host:port" are allowed: an "amqp://" prefix is added if +s+ does
43
49
  # not already look like an 'amqp:', 'amqps:' URI.
44
50
  #
45
51
  # @note this does not give the same result as a standard URI parser in all cases.
@@ -54,19 +60,19 @@ module Qpid::Proton
54
60
  #
55
61
  def self.uri(s)
56
62
  case s
57
- when URI::AMQP then s # Pass-thru
58
- when URI::Generic
59
- s.scheme ||= 'amqp'
60
- u = URI.parse(s.to_s) # Re-parse as amqp
63
+ when URI::AMQP then s # This is already an AMQP or AMQPS URL.
64
+ when URI::Generic # Re-parse a generic URI that was not parsed as AMQP/AMQPS class
65
+ s.scheme ||= 'amqp' # Default to amqp: scheme
66
+ u = DEFAULT_URI_PARSER.parse(s.to_s)
61
67
  raise URI::BadURIError, "Not an AMQP URI: '#{u}'" unless u.is_a? URI::AMQP
62
68
  u
63
69
  else
64
70
  s = String.try_convert s
65
71
  raise ::ArgumentError, "bad argument (expected URI object or URI string)" unless s
66
72
  case s
67
- when %r{^amqps?:} then URI.parse(s) # Looks like an AMQP URI
68
- when %r{^//} then URI.parse("amqp:#{s}") # Looks like a scheme-less URI
69
- else URI.parse("amqp://#{s}") # Treat as a bare host:port/path string
73
+ when %r{^amqps?:} then DEFAULT_URI_PARSER.parse(s) # Looks like an AMQP URI
74
+ when %r{^//} then DEFAULT_URI_PARSER.parse("amqp:#{s}") # Looks like an authority with no scheme
75
+ else DEFAULT_URI_PARSER.parse("amqp://#{s}") # Treat as a bare host:port/path string
70
76
  end
71
77
  end
72
78
  end