stem-mqtt-broker 0.8.3-aarch64-linux → 0.9.1-aarch64-linux
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
- data/lib/stem_mqtt_broker/mqtt_broker.rb +570 -3
- data/lib/stem_mqtt_broker/native/libmqtt_broker.so +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e51e0e3419ec2b683704f75f24f16145d8747059b775307e36ac29264d8d49b
|
|
4
|
+
data.tar.gz: 3db8576ffd80bfc9f1a1935c80740321c5894cadf42c3ea62e1ab754acb2b98a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a6acac021c5dad2d622fc04c0f202dd67074e498a63351c843270755c710ca5849fd1dc3ebbc1369a463b8b5fb6c30222a75b1671e914fb1cfebe0286222f30
|
|
7
|
+
data.tar.gz: 0606b1cb681259420d1664c71d4a41e721c61ba4b54b2165e4c43f94875402ebfb9e01c340fe382dc6125e6e9cc6d2ff9d165ce98c218412f87eff9224209532
|
|
@@ -260,6 +260,7 @@ private_constant :UniffiHandleMap
|
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
RustBuffer.check_lower_Optionalbytes(v.client_ca_pem)
|
|
263
|
+
RustBuffer.check_lower_TypeCertClientId(v.bind_client_id)
|
|
263
264
|
end
|
|
264
265
|
|
|
265
266
|
def self.alloc_from_TypeBrokerTlsConfig(v)
|
|
@@ -326,6 +327,28 @@ private_constant :UniffiHandleMap
|
|
|
326
327
|
end
|
|
327
328
|
end
|
|
328
329
|
|
|
330
|
+
# The Record type ObservedMessage.
|
|
331
|
+
|
|
332
|
+
def self.check_lower_TypeObservedMessage(v)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
RustBuffer.check_lower_TypeQoS(v.qos)
|
|
336
|
+
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def self.alloc_from_TypeObservedMessage(v)
|
|
340
|
+
RustBuffer.allocWithBuilder do |builder|
|
|
341
|
+
builder.write_TypeObservedMessage(v)
|
|
342
|
+
return builder.finalize
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def consume_into_TypeObservedMessage
|
|
347
|
+
consumeWithStream do |stream|
|
|
348
|
+
return stream.read_TypeObservedMessage
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
|
|
329
352
|
# The Enum type BrokerEvent.
|
|
330
353
|
|
|
331
354
|
def self.check_lower_TypeBrokerEvent(v)
|
|
@@ -360,6 +383,25 @@ private_constant :UniffiHandleMap
|
|
|
360
383
|
end
|
|
361
384
|
|
|
362
385
|
|
|
386
|
+
# The Enum type CertClientId.
|
|
387
|
+
|
|
388
|
+
def self.check_lower_TypeCertClientId(v)
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def self.alloc_from_TypeCertClientId(v)
|
|
392
|
+
RustBuffer.allocWithBuilder do |builder|
|
|
393
|
+
builder.write_TypeCertClientId(v)
|
|
394
|
+
return builder.finalize
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
def consume_into_TypeCertClientId
|
|
399
|
+
consumeWithStream do |stream|
|
|
400
|
+
return stream.read_TypeCertClientId
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
|
|
363
405
|
# The Enum type EnhancedAuthOutcome.
|
|
364
406
|
|
|
365
407
|
def self.check_lower_TypeEnhancedAuthOutcome(v)
|
|
@@ -414,6 +456,25 @@ private_constant :UniffiHandleMap
|
|
|
414
456
|
end
|
|
415
457
|
|
|
416
458
|
|
|
459
|
+
# The Enum type TopicAction.
|
|
460
|
+
|
|
461
|
+
def self.check_lower_TypeTopicAction(v)
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
def self.alloc_from_TypeTopicAction(v)
|
|
465
|
+
RustBuffer.allocWithBuilder do |builder|
|
|
466
|
+
builder.write_TypeTopicAction(v)
|
|
467
|
+
return builder.finalize
|
|
468
|
+
end
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
def consume_into_TypeTopicAction
|
|
472
|
+
consumeWithStream do |stream|
|
|
473
|
+
return stream.read_TypeTopicAction
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
|
|
417
478
|
# The Optional<T> type for u16.
|
|
418
479
|
|
|
419
480
|
def self.check_lower_Optionalu16(v)
|
|
@@ -630,6 +691,13 @@ class RustBufferStream
|
|
|
630
691
|
return MqttAuthProvider.uniffi_lift(handle)
|
|
631
692
|
end
|
|
632
693
|
|
|
694
|
+
# The Object type MqttAuthorizer.
|
|
695
|
+
|
|
696
|
+
def read_TypeMqttAuthorizer
|
|
697
|
+
handle = unpack_from 8, 'Q>'
|
|
698
|
+
return MqttAuthorizer.uniffi_lift(handle)
|
|
699
|
+
end
|
|
700
|
+
|
|
633
701
|
# The Object type MqttBroker.
|
|
634
702
|
|
|
635
703
|
def read_TypeMqttBroker
|
|
@@ -651,6 +719,13 @@ class RustBufferStream
|
|
|
651
719
|
return MqttEnhancedAuthProvider.uniffi_lift(handle)
|
|
652
720
|
end
|
|
653
721
|
|
|
722
|
+
# The Object type MqttMessageObserver.
|
|
723
|
+
|
|
724
|
+
def read_TypeMqttMessageObserver
|
|
725
|
+
handle = unpack_from 8, 'Q>'
|
|
726
|
+
return MqttMessageObserver.uniffi_lift(handle)
|
|
727
|
+
end
|
|
728
|
+
|
|
654
729
|
# The Record type AuthRequest.
|
|
655
730
|
|
|
656
731
|
def read_TypeAuthRequest
|
|
@@ -669,7 +744,8 @@ class RustBufferStream
|
|
|
669
744
|
port: read_u16,
|
|
670
745
|
cert_pem: read_bytes,
|
|
671
746
|
key_pem: read_bytes,
|
|
672
|
-
client_ca_pem: read_Optionalbytes
|
|
747
|
+
client_ca_pem: read_Optionalbytes,
|
|
748
|
+
bind_client_id: read_TypeCertClientId
|
|
673
749
|
)
|
|
674
750
|
end
|
|
675
751
|
|
|
@@ -702,6 +778,17 @@ class RustBufferStream
|
|
|
702
778
|
)
|
|
703
779
|
end
|
|
704
780
|
|
|
781
|
+
# The Record type ObservedMessage.
|
|
782
|
+
|
|
783
|
+
def read_TypeObservedMessage
|
|
784
|
+
ObservedMessage.new(
|
|
785
|
+
topic: read_string,
|
|
786
|
+
payload: read_bytes,
|
|
787
|
+
qos: read_TypeQoS,
|
|
788
|
+
retain: read_bool
|
|
789
|
+
)
|
|
790
|
+
end
|
|
791
|
+
|
|
705
792
|
|
|
706
793
|
|
|
707
794
|
# The Enum type BrokerEvent.
|
|
@@ -734,6 +821,28 @@ class RustBufferStream
|
|
|
734
821
|
|
|
735
822
|
|
|
736
823
|
|
|
824
|
+
# The Enum type CertClientId.
|
|
825
|
+
|
|
826
|
+
def read_TypeCertClientId
|
|
827
|
+
variant = unpack_from 4, 'l>'
|
|
828
|
+
|
|
829
|
+
if variant == 1
|
|
830
|
+
return CertClientId::NONE
|
|
831
|
+
end
|
|
832
|
+
if variant == 2
|
|
833
|
+
return CertClientId::COMMON_NAME
|
|
834
|
+
end
|
|
835
|
+
if variant == 3
|
|
836
|
+
return CertClientId::DNS_NAME
|
|
837
|
+
end
|
|
838
|
+
|
|
839
|
+
raise InternalError, 'Unexpected variant tag for TypeCertClientId'
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
737
846
|
# The Enum type EnhancedAuthOutcome.
|
|
738
847
|
|
|
739
848
|
def read_TypeEnhancedAuthOutcome
|
|
@@ -806,6 +915,25 @@ class RustBufferStream
|
|
|
806
915
|
|
|
807
916
|
|
|
808
917
|
|
|
918
|
+
|
|
919
|
+
# The Enum type TopicAction.
|
|
920
|
+
|
|
921
|
+
def read_TypeTopicAction
|
|
922
|
+
variant = unpack_from 4, 'l>'
|
|
923
|
+
|
|
924
|
+
if variant == 1
|
|
925
|
+
return TopicAction::PUBLISH
|
|
926
|
+
end
|
|
927
|
+
if variant == 2
|
|
928
|
+
return TopicAction::SUBSCRIBE
|
|
929
|
+
end
|
|
930
|
+
|
|
931
|
+
raise InternalError, 'Unexpected variant tag for TypeTopicAction'
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
809
937
|
# The Optional<T> type for u16.
|
|
810
938
|
|
|
811
939
|
def read_Optionalu16
|
|
@@ -979,6 +1107,13 @@ class RustBufferBuilder
|
|
|
979
1107
|
pack_into(8, 'Q>', handle)
|
|
980
1108
|
end
|
|
981
1109
|
|
|
1110
|
+
# The Object type MqttAuthorizer.
|
|
1111
|
+
|
|
1112
|
+
def write_TypeMqttAuthorizer(obj)
|
|
1113
|
+
handle = MqttAuthorizer.uniffi_lower obj
|
|
1114
|
+
pack_into(8, 'Q>', handle)
|
|
1115
|
+
end
|
|
1116
|
+
|
|
982
1117
|
# The Object type MqttBroker.
|
|
983
1118
|
|
|
984
1119
|
def write_TypeMqttBroker(obj)
|
|
@@ -1000,6 +1135,13 @@ class RustBufferBuilder
|
|
|
1000
1135
|
pack_into(8, 'Q>', handle)
|
|
1001
1136
|
end
|
|
1002
1137
|
|
|
1138
|
+
# The Object type MqttMessageObserver.
|
|
1139
|
+
|
|
1140
|
+
def write_TypeMqttMessageObserver(obj)
|
|
1141
|
+
handle = MqttMessageObserver.uniffi_lower obj
|
|
1142
|
+
pack_into(8, 'Q>', handle)
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1003
1145
|
# The Record type AuthRequest.
|
|
1004
1146
|
|
|
1005
1147
|
def write_TypeAuthRequest(v)
|
|
@@ -1016,6 +1158,7 @@ class RustBufferBuilder
|
|
|
1016
1158
|
self.write_bytes(v.cert_pem)
|
|
1017
1159
|
self.write_bytes(v.key_pem)
|
|
1018
1160
|
self.write_Optionalbytes(v.client_ca_pem)
|
|
1161
|
+
self.write_TypeCertClientId(v.bind_client_id)
|
|
1019
1162
|
end
|
|
1020
1163
|
|
|
1021
1164
|
# The Record type EnhancedAuthStep.
|
|
@@ -1043,6 +1186,15 @@ class RustBufferBuilder
|
|
|
1043
1186
|
self.write_u32(v.session_expiry_secs)
|
|
1044
1187
|
end
|
|
1045
1188
|
|
|
1189
|
+
# The Record type ObservedMessage.
|
|
1190
|
+
|
|
1191
|
+
def write_TypeObservedMessage(v)
|
|
1192
|
+
self.write_string(v.topic)
|
|
1193
|
+
self.write_bytes(v.payload)
|
|
1194
|
+
self.write_TypeQoS(v.qos)
|
|
1195
|
+
self.write_bool(v.retain)
|
|
1196
|
+
end
|
|
1197
|
+
|
|
1046
1198
|
# The Enum type BrokerEvent.
|
|
1047
1199
|
|
|
1048
1200
|
def write_TypeBrokerEvent(v)
|
|
@@ -1064,6 +1216,21 @@ class RustBufferBuilder
|
|
|
1064
1216
|
end
|
|
1065
1217
|
|
|
1066
1218
|
|
|
1219
|
+
# The Enum type CertClientId.
|
|
1220
|
+
|
|
1221
|
+
def write_TypeCertClientId(v)
|
|
1222
|
+
if v == CertClientId::NONE
|
|
1223
|
+
pack_into(4, 'l>', 1)
|
|
1224
|
+
end
|
|
1225
|
+
if v == CertClientId::COMMON_NAME
|
|
1226
|
+
pack_into(4, 'l>', 2)
|
|
1227
|
+
end
|
|
1228
|
+
if v == CertClientId::DNS_NAME
|
|
1229
|
+
pack_into(4, 'l>', 3)
|
|
1230
|
+
end
|
|
1231
|
+
end
|
|
1232
|
+
|
|
1233
|
+
|
|
1067
1234
|
# The Enum type EnhancedAuthOutcome.
|
|
1068
1235
|
|
|
1069
1236
|
def write_TypeEnhancedAuthOutcome(v)
|
|
@@ -1112,6 +1279,18 @@ class RustBufferBuilder
|
|
|
1112
1279
|
end
|
|
1113
1280
|
|
|
1114
1281
|
|
|
1282
|
+
# The Enum type TopicAction.
|
|
1283
|
+
|
|
1284
|
+
def write_TypeTopicAction(v)
|
|
1285
|
+
if v == TopicAction::PUBLISH
|
|
1286
|
+
pack_into(4, 'l>', 1)
|
|
1287
|
+
end
|
|
1288
|
+
if v == TopicAction::SUBSCRIBE
|
|
1289
|
+
pack_into(4, 'l>', 2)
|
|
1290
|
+
end
|
|
1291
|
+
end
|
|
1292
|
+
|
|
1293
|
+
|
|
1115
1294
|
# The Optional<T> type for u16.
|
|
1116
1295
|
|
|
1117
1296
|
def write_Optionalu16(v)
|
|
@@ -1227,6 +1406,8 @@ CALL_PANIC = 2
|
|
|
1227
1406
|
|
|
1228
1407
|
|
|
1229
1408
|
|
|
1409
|
+
|
|
1410
|
+
|
|
1230
1411
|
class MqttBrokerError
|
|
1231
1412
|
AlreadyRunning = Class.new StandardError
|
|
1232
1413
|
Io = Class.new StandardError
|
|
@@ -1469,6 +1650,10 @@ module UniFFILib
|
|
|
1469
1650
|
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, :pointer, RustCallStatus.by_ref],
|
|
1470
1651
|
:void
|
|
1471
1652
|
|
|
1653
|
+
callback :CallbackInterfaceMqttAuthorizerMethod0,
|
|
1654
|
+
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, :pointer, RustCallStatus.by_ref],
|
|
1655
|
+
:void
|
|
1656
|
+
|
|
1472
1657
|
callback :CallbackInterfaceMqttBrokerEventListenerMethod0,
|
|
1473
1658
|
[:uint64, RustBuffer.by_value, :pointer, RustCallStatus.by_ref],
|
|
1474
1659
|
:void
|
|
@@ -1485,6 +1670,10 @@ module UniFFILib
|
|
|
1485
1670
|
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, :uint32, :pointer, RustCallStatus.by_ref],
|
|
1486
1671
|
:void
|
|
1487
1672
|
|
|
1673
|
+
callback :CallbackInterfaceMqttMessageObserverMethod0,
|
|
1674
|
+
[:uint64, RustBuffer.by_value, RustBuffer.by_value, :pointer, RustCallStatus.by_ref],
|
|
1675
|
+
:void
|
|
1676
|
+
|
|
1488
1677
|
class VTableCallbackInterfaceMqttAuthProvider < FFI::Struct
|
|
1489
1678
|
layout(
|
|
1490
1679
|
:uniffi_free, :CallbackInterfaceFree,
|
|
@@ -1493,6 +1682,14 @@ module UniFFILib
|
|
|
1493
1682
|
)
|
|
1494
1683
|
end
|
|
1495
1684
|
|
|
1685
|
+
class VTableCallbackInterfaceMqttAuthorizer < FFI::Struct
|
|
1686
|
+
layout(
|
|
1687
|
+
:uniffi_free, :CallbackInterfaceFree,
|
|
1688
|
+
:uniffi_clone, :CallbackInterfaceClone,
|
|
1689
|
+
:authorize, :CallbackInterfaceMqttAuthorizerMethod0
|
|
1690
|
+
)
|
|
1691
|
+
end
|
|
1692
|
+
|
|
1496
1693
|
class VTableCallbackInterfaceMqttBrokerEventListener < FFI::Struct
|
|
1497
1694
|
layout(
|
|
1498
1695
|
:uniffi_free, :CallbackInterfaceFree,
|
|
@@ -1511,6 +1708,14 @@ module UniFFILib
|
|
|
1511
1708
|
)
|
|
1512
1709
|
end
|
|
1513
1710
|
|
|
1711
|
+
class VTableCallbackInterfaceMqttMessageObserver < FFI::Struct
|
|
1712
|
+
layout(
|
|
1713
|
+
:uniffi_free, :CallbackInterfaceFree,
|
|
1714
|
+
:uniffi_clone, :CallbackInterfaceClone,
|
|
1715
|
+
:on_message, :CallbackInterfaceMqttMessageObserverMethod0
|
|
1716
|
+
)
|
|
1717
|
+
end
|
|
1718
|
+
|
|
1514
1719
|
attach_function :uniffi_mqtt_broker_fn_clone_mqttbroker,
|
|
1515
1720
|
[:uint64, RustCallStatus.by_ref],
|
|
1516
1721
|
:uint64
|
|
@@ -1567,6 +1772,10 @@ module UniFFILib
|
|
|
1567
1772
|
[:uint64, :uint64, RustCallStatus.by_ref],
|
|
1568
1773
|
:void
|
|
1569
1774
|
|
|
1775
|
+
attach_function :uniffi_mqtt_broker_fn_method_mqttbroker_set_authorizer,
|
|
1776
|
+
[:uint64, :uint64, RustCallStatus.by_ref],
|
|
1777
|
+
:void
|
|
1778
|
+
|
|
1570
1779
|
attach_function :uniffi_mqtt_broker_fn_method_mqttbroker_set_enhanced_auth_provider,
|
|
1571
1780
|
[:uint64, :uint64, RustCallStatus.by_ref],
|
|
1572
1781
|
:void
|
|
@@ -1575,6 +1784,10 @@ module UniFFILib
|
|
|
1575
1784
|
[:uint64, :uint64, RustCallStatus.by_ref],
|
|
1576
1785
|
:void
|
|
1577
1786
|
|
|
1787
|
+
attach_function :uniffi_mqtt_broker_fn_method_mqttbroker_set_message_observer,
|
|
1788
|
+
[:uint64, :uint64, RustCallStatus.by_ref],
|
|
1789
|
+
:void
|
|
1790
|
+
|
|
1578
1791
|
attach_function :uniffi_mqtt_broker_fn_method_mqttbroker_start,
|
|
1579
1792
|
[:uint64, ],
|
|
1580
1793
|
:uint64
|
|
@@ -1599,6 +1812,22 @@ module UniFFILib
|
|
|
1599
1812
|
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
|
|
1600
1813
|
:int8
|
|
1601
1814
|
|
|
1815
|
+
attach_function :uniffi_mqtt_broker_fn_clone_mqttauthorizer,
|
|
1816
|
+
[:uint64, RustCallStatus.by_ref],
|
|
1817
|
+
:uint64
|
|
1818
|
+
|
|
1819
|
+
attach_function :uniffi_mqtt_broker_fn_free_mqttauthorizer,
|
|
1820
|
+
[:uint64, RustCallStatus.by_ref],
|
|
1821
|
+
:void
|
|
1822
|
+
|
|
1823
|
+
attach_function :uniffi_mqtt_broker_fn_init_callback_vtable_mqttauthorizer,
|
|
1824
|
+
[VTableCallbackInterfaceMqttAuthorizer.by_ref, ],
|
|
1825
|
+
:void
|
|
1826
|
+
|
|
1827
|
+
attach_function :uniffi_mqtt_broker_fn_method_mqttauthorizer_authorize,
|
|
1828
|
+
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
|
|
1829
|
+
:int8
|
|
1830
|
+
|
|
1602
1831
|
attach_function :uniffi_mqtt_broker_fn_clone_mqttbrokereventlistener,
|
|
1603
1832
|
[:uint64, RustCallStatus.by_ref],
|
|
1604
1833
|
:uint64
|
|
@@ -1639,6 +1868,22 @@ module UniFFILib
|
|
|
1639
1868
|
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustBuffer.by_value, :uint32, RustCallStatus.by_ref],
|
|
1640
1869
|
RustBuffer.by_value
|
|
1641
1870
|
|
|
1871
|
+
attach_function :uniffi_mqtt_broker_fn_clone_mqttmessageobserver,
|
|
1872
|
+
[:uint64, RustCallStatus.by_ref],
|
|
1873
|
+
:uint64
|
|
1874
|
+
|
|
1875
|
+
attach_function :uniffi_mqtt_broker_fn_free_mqttmessageobserver,
|
|
1876
|
+
[:uint64, RustCallStatus.by_ref],
|
|
1877
|
+
:void
|
|
1878
|
+
|
|
1879
|
+
attach_function :uniffi_mqtt_broker_fn_init_callback_vtable_mqttmessageobserver,
|
|
1880
|
+
[VTableCallbackInterfaceMqttMessageObserver.by_ref, ],
|
|
1881
|
+
:void
|
|
1882
|
+
|
|
1883
|
+
attach_function :uniffi_mqtt_broker_fn_method_mqttmessageobserver_on_message,
|
|
1884
|
+
[:uint64, RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
|
|
1885
|
+
:void
|
|
1886
|
+
|
|
1642
1887
|
attach_function :ffi_mqtt_broker_rustbuffer_alloc,
|
|
1643
1888
|
[:uint64, RustCallStatus.by_ref],
|
|
1644
1889
|
RustBuffer.by_value
|
|
@@ -1891,6 +2136,10 @@ module UniFFILib
|
|
|
1891
2136
|
[],
|
|
1892
2137
|
:uint16
|
|
1893
2138
|
|
|
2139
|
+
attach_function :uniffi_mqtt_broker_checksum_method_mqttbroker_set_authorizer,
|
|
2140
|
+
[],
|
|
2141
|
+
:uint16
|
|
2142
|
+
|
|
1894
2143
|
attach_function :uniffi_mqtt_broker_checksum_method_mqttbroker_set_enhanced_auth_provider,
|
|
1895
2144
|
[],
|
|
1896
2145
|
:uint16
|
|
@@ -1899,6 +2148,10 @@ module UniFFILib
|
|
|
1899
2148
|
[],
|
|
1900
2149
|
:uint16
|
|
1901
2150
|
|
|
2151
|
+
attach_function :uniffi_mqtt_broker_checksum_method_mqttbroker_set_message_observer,
|
|
2152
|
+
[],
|
|
2153
|
+
:uint16
|
|
2154
|
+
|
|
1902
2155
|
attach_function :uniffi_mqtt_broker_checksum_method_mqttbroker_start,
|
|
1903
2156
|
[],
|
|
1904
2157
|
:uint16
|
|
@@ -1911,6 +2164,10 @@ module UniFFILib
|
|
|
1911
2164
|
[],
|
|
1912
2165
|
:uint16
|
|
1913
2166
|
|
|
2167
|
+
attach_function :uniffi_mqtt_broker_checksum_method_mqttauthorizer_authorize,
|
|
2168
|
+
[],
|
|
2169
|
+
:uint16
|
|
2170
|
+
|
|
1914
2171
|
attach_function :uniffi_mqtt_broker_checksum_method_mqttbrokereventlistener_on_client_connected,
|
|
1915
2172
|
[],
|
|
1916
2173
|
:uint16
|
|
@@ -1927,6 +2184,10 @@ module UniFFILib
|
|
|
1927
2184
|
[],
|
|
1928
2185
|
:uint16
|
|
1929
2186
|
|
|
2187
|
+
attach_function :uniffi_mqtt_broker_checksum_method_mqttmessageobserver_on_message,
|
|
2188
|
+
[],
|
|
2189
|
+
:uint16
|
|
2190
|
+
|
|
1930
2191
|
attach_function :uniffi_mqtt_broker_checksum_constructor_mqttbroker_new,
|
|
1931
2192
|
[],
|
|
1932
2193
|
:uint16
|
|
@@ -2059,6 +2320,18 @@ private_constant :CallbackInterfaceFfiConverter
|
|
|
2059
2320
|
|
|
2060
2321
|
|
|
2061
2322
|
|
|
2323
|
+
class CertClientId
|
|
2324
|
+
NONE = 0
|
|
2325
|
+
COMMON_NAME = 1
|
|
2326
|
+
DNS_NAME = 2
|
|
2327
|
+
|
|
2328
|
+
end
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
|
|
2062
2335
|
class EnhancedAuthOutcome
|
|
2063
2336
|
CONTINUE = 0
|
|
2064
2337
|
SUCCESS = 1
|
|
@@ -2082,6 +2355,17 @@ end
|
|
|
2082
2355
|
|
|
2083
2356
|
|
|
2084
2357
|
|
|
2358
|
+
|
|
2359
|
+
class TopicAction
|
|
2360
|
+
PUBLISH = 0
|
|
2361
|
+
SUBSCRIBE = 1
|
|
2362
|
+
|
|
2363
|
+
end
|
|
2364
|
+
|
|
2365
|
+
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
|
|
2085
2369
|
|
|
2086
2370
|
|
|
2087
2371
|
class BrokerEvent
|
|
@@ -2239,13 +2523,14 @@ end
|
|
|
2239
2523
|
|
|
2240
2524
|
# Record type BrokerTlsConfig
|
|
2241
2525
|
class BrokerTlsConfig
|
|
2242
|
-
attr_reader :port, :cert_pem, :key_pem, :client_ca_pem
|
|
2526
|
+
attr_reader :port, :cert_pem, :key_pem, :client_ca_pem, :bind_client_id
|
|
2243
2527
|
|
|
2244
|
-
def initialize(port:, cert_pem:, key_pem:, client_ca_pem:)
|
|
2528
|
+
def initialize(port:, cert_pem:, key_pem:, client_ca_pem:, bind_client_id:)
|
|
2245
2529
|
@port = port
|
|
2246
2530
|
@cert_pem = cert_pem
|
|
2247
2531
|
@key_pem = key_pem
|
|
2248
2532
|
@client_ca_pem = client_ca_pem
|
|
2533
|
+
@bind_client_id = bind_client_id
|
|
2249
2534
|
end
|
|
2250
2535
|
|
|
2251
2536
|
def ==(other)
|
|
@@ -2261,6 +2546,9 @@ class BrokerTlsConfig
|
|
|
2261
2546
|
if @client_ca_pem != other.client_ca_pem
|
|
2262
2547
|
return false
|
|
2263
2548
|
end
|
|
2549
|
+
if @bind_client_id != other.bind_client_id
|
|
2550
|
+
return false
|
|
2551
|
+
end
|
|
2264
2552
|
|
|
2265
2553
|
true
|
|
2266
2554
|
end
|
|
@@ -2355,6 +2643,36 @@ class MqttBrokerConfig
|
|
|
2355
2643
|
|
|
2356
2644
|
end
|
|
2357
2645
|
|
|
2646
|
+
# Record type ObservedMessage
|
|
2647
|
+
class ObservedMessage
|
|
2648
|
+
attr_reader :topic, :payload, :qos, :retain
|
|
2649
|
+
|
|
2650
|
+
def initialize(topic:, payload:, qos:, retain:)
|
|
2651
|
+
@topic = topic
|
|
2652
|
+
@payload = payload
|
|
2653
|
+
@qos = qos
|
|
2654
|
+
@retain = retain
|
|
2655
|
+
end
|
|
2656
|
+
|
|
2657
|
+
def ==(other)
|
|
2658
|
+
if @topic != other.topic
|
|
2659
|
+
return false
|
|
2660
|
+
end
|
|
2661
|
+
if @payload != other.payload
|
|
2662
|
+
return false
|
|
2663
|
+
end
|
|
2664
|
+
if @qos != other.qos
|
|
2665
|
+
return false
|
|
2666
|
+
end
|
|
2667
|
+
if @retain != other.retain
|
|
2668
|
+
return false
|
|
2669
|
+
end
|
|
2670
|
+
|
|
2671
|
+
true
|
|
2672
|
+
end
|
|
2673
|
+
|
|
2674
|
+
end
|
|
2675
|
+
|
|
2358
2676
|
|
|
2359
2677
|
|
|
2360
2678
|
|
|
@@ -2488,6 +2806,12 @@ end
|
|
|
2488
2806
|
::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttbroker_set_auth_provider,uniffi_clone_handle(),(MqttAuthProvider.uniffi_lower provider))
|
|
2489
2807
|
end
|
|
2490
2808
|
|
|
2809
|
+
def set_authorizer(authorizer)
|
|
2810
|
+
authorizer = authorizer
|
|
2811
|
+
(MqttAuthorizer.uniffi_check_lower authorizer)
|
|
2812
|
+
::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttbroker_set_authorizer,uniffi_clone_handle(),(MqttAuthorizer.uniffi_lower authorizer))
|
|
2813
|
+
end
|
|
2814
|
+
|
|
2491
2815
|
def set_enhanced_auth_provider(provider)
|
|
2492
2816
|
provider = provider
|
|
2493
2817
|
(MqttEnhancedAuthProvider.uniffi_check_lower provider)
|
|
@@ -2500,6 +2824,12 @@ end
|
|
|
2500
2824
|
::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttbroker_set_event_listener,uniffi_clone_handle(),(MqttBrokerEventListener.uniffi_lower listener))
|
|
2501
2825
|
end
|
|
2502
2826
|
|
|
2827
|
+
def set_message_observer(observer)
|
|
2828
|
+
observer = observer
|
|
2829
|
+
(MqttMessageObserver.uniffi_check_lower observer)
|
|
2830
|
+
::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttbroker_set_message_observer,uniffi_clone_handle(),(MqttMessageObserver.uniffi_lower observer))
|
|
2831
|
+
end
|
|
2832
|
+
|
|
2503
2833
|
|
|
2504
2834
|
def start()
|
|
2505
2835
|
::MqttBroker.uniffi_rust_call_async(
|
|
@@ -2648,6 +2978,127 @@ module UniffiCallbackInterfaceMqttAuthProvider
|
|
|
2648
2978
|
UniFFILib.uniffi_mqtt_broker_fn_init_callback_vtable_mqttauthprovider(UNIFFI_VTABLE)
|
|
2649
2979
|
end
|
|
2650
2980
|
|
|
2981
|
+
class MqttAuthorizer
|
|
2982
|
+
|
|
2983
|
+
# A private helper for initializing instances of the class from a raw handle,
|
|
2984
|
+
# bypassing any initialization logic and ensuring they are GC'd properly.
|
|
2985
|
+
def self.uniffi_allocate(handle)
|
|
2986
|
+
inst = allocate
|
|
2987
|
+
inst.instance_variable_set :@handle, handle
|
|
2988
|
+
ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
|
|
2989
|
+
return inst
|
|
2990
|
+
end
|
|
2991
|
+
|
|
2992
|
+
# A private helper for registering an object finalizer.
|
|
2993
|
+
# N.B. it's important that this does not capture a reference
|
|
2994
|
+
# to the actual instance, only its underlying handle.
|
|
2995
|
+
def self.uniffi_define_finalizer_by_handle(handle, object_id)
|
|
2996
|
+
Proc.new do |_id|
|
|
2997
|
+
::MqttBroker.rust_call(
|
|
2998
|
+
:uniffi_mqtt_broker_fn_free_mqttauthorizer,
|
|
2999
|
+
handle
|
|
3000
|
+
)
|
|
3001
|
+
end
|
|
3002
|
+
end
|
|
3003
|
+
# HandleMap for trait interface: stores Ruby-native objects keyed by odd handles.
|
|
3004
|
+
@uniffi_handle_map = UniffiHandleMap.new
|
|
3005
|
+
|
|
3006
|
+
class << self
|
|
3007
|
+
attr_reader :uniffi_handle_map
|
|
3008
|
+
end
|
|
3009
|
+
|
|
3010
|
+
# For trait interfaces: check that the object is either a Rust-backed instance or
|
|
3011
|
+
# responds to the required interface methods.
|
|
3012
|
+
def self.uniffi_check_lower(inst)
|
|
3013
|
+
if !inst.respond_to?(:authorize)
|
|
3014
|
+
raise TypeError.new "Expected a MqttAuthorizer instance or an object implementing the interface, got #{inst}"
|
|
3015
|
+
end
|
|
3016
|
+
end
|
|
3017
|
+
|
|
3018
|
+
def uniffi_clone_handle
|
|
3019
|
+
return ::MqttBroker.rust_call(
|
|
3020
|
+
:uniffi_mqtt_broker_fn_clone_mqttauthorizer,
|
|
3021
|
+
@handle
|
|
3022
|
+
)
|
|
3023
|
+
end
|
|
3024
|
+
|
|
3025
|
+
# For trait interfaces: lowering distinguishes between Rust-backed and Ruby-native instances.
|
|
3026
|
+
def self.uniffi_lower(inst)
|
|
3027
|
+
if inst.is_a?(self) && inst.instance_variable_defined?(:@handle)
|
|
3028
|
+
inst.uniffi_clone_handle()
|
|
3029
|
+
else
|
|
3030
|
+
@uniffi_handle_map.insert(inst)
|
|
3031
|
+
end
|
|
3032
|
+
end
|
|
3033
|
+
|
|
3034
|
+
# For trait interfaces: lifting distinguishes even handles (Rust) from odd handles (Ruby).
|
|
3035
|
+
def self.uniffi_lift(handle)
|
|
3036
|
+
if (handle & 1) == 0
|
|
3037
|
+
uniffi_allocate handle
|
|
3038
|
+
else
|
|
3039
|
+
@uniffi_handle_map.remove handle
|
|
3040
|
+
end
|
|
3041
|
+
end
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
|
|
3045
|
+
def authorize(client_id, action, topic)
|
|
3046
|
+
client_id = ::MqttBroker::uniffi_utf8(client_id)
|
|
3047
|
+
|
|
3048
|
+
action = action
|
|
3049
|
+
RustBuffer.check_lower_TypeTopicAction(action)
|
|
3050
|
+
topic = ::MqttBroker::uniffi_utf8(topic)
|
|
3051
|
+
|
|
3052
|
+
result = ::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttauthorizer_authorize,uniffi_clone_handle(),RustBuffer.alloc_from_string(client_id),RustBuffer.alloc_from_TypeTopicAction(action),RustBuffer.alloc_from_string(topic))
|
|
3053
|
+
return 1 == result
|
|
3054
|
+
end
|
|
3055
|
+
|
|
3056
|
+
end
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
# Trait interface vtable implementation for MqttAuthorizer.
|
|
3060
|
+
module UniffiCallbackInterfaceMqttAuthorizer
|
|
3061
|
+
# Callback method for authorize
|
|
3062
|
+
AUTHORIZE_CALLBACK = Proc.new do |uniffi_handle, client_id, action, topic, uniffi_out_return, uniffi_call_status|
|
|
3063
|
+
uniffi_obj = MqttAuthorizer.uniffi_handle_map.get(uniffi_handle)
|
|
3064
|
+
make_call = Proc.new do
|
|
3065
|
+
uniffi_obj.authorize(
|
|
3066
|
+
client_id.consume_into_string,
|
|
3067
|
+
action.consume_into_TypeTopicAction,
|
|
3068
|
+
topic.consume_into_string
|
|
3069
|
+
)
|
|
3070
|
+
end
|
|
3071
|
+
write_return_value = Proc.new do |v|
|
|
3072
|
+
lowered = (v ? 1 : 0)
|
|
3073
|
+
uniffi_out_return.write_int8(lowered)
|
|
3074
|
+
end
|
|
3075
|
+
::MqttBroker.uniffi_trait_interface_call(
|
|
3076
|
+
uniffi_call_status,
|
|
3077
|
+
make_call,
|
|
3078
|
+
write_return_value,
|
|
3079
|
+
)
|
|
3080
|
+
end
|
|
3081
|
+
|
|
3082
|
+
# Free callback: removes the handle from the map.
|
|
3083
|
+
UNIFFI_FREE_CALLBACK = Proc.new do |uniffi_handle|
|
|
3084
|
+
MqttAuthorizer.uniffi_handle_map.remove uniffi_handle
|
|
3085
|
+
end
|
|
3086
|
+
|
|
3087
|
+
# Clone callback: clones the handle in the map.
|
|
3088
|
+
UNIFFI_CLONE_CALLBACK = Proc.new do |uniffi_handle|
|
|
3089
|
+
MqttAuthorizer.uniffi_handle_map.clone_handle(uniffi_handle)
|
|
3090
|
+
end
|
|
3091
|
+
|
|
3092
|
+
# Create the VTable struct instance.
|
|
3093
|
+
UNIFFI_VTABLE = UniFFILib::VTableCallbackInterfaceMqttAuthorizer.new
|
|
3094
|
+
UNIFFI_VTABLE[:uniffi_free] = UNIFFI_FREE_CALLBACK
|
|
3095
|
+
UNIFFI_VTABLE[:uniffi_clone] = UNIFFI_CLONE_CALLBACK
|
|
3096
|
+
UNIFFI_VTABLE[:authorize] = AUTHORIZE_CALLBACK
|
|
3097
|
+
|
|
3098
|
+
# Register the VTable with Rust.
|
|
3099
|
+
UniFFILib.uniffi_mqtt_broker_fn_init_callback_vtable_mqttauthorizer(UNIFFI_VTABLE)
|
|
3100
|
+
end
|
|
3101
|
+
|
|
2651
3102
|
class MqttBrokerEventListener
|
|
2652
3103
|
|
|
2653
3104
|
# A private helper for initializing instances of the class from a raw handle,
|
|
@@ -2950,6 +3401,122 @@ module UniffiCallbackInterfaceMqttEnhancedAuthProvider
|
|
|
2950
3401
|
UniFFILib.uniffi_mqtt_broker_fn_init_callback_vtable_mqttenhancedauthprovider(UNIFFI_VTABLE)
|
|
2951
3402
|
end
|
|
2952
3403
|
|
|
3404
|
+
class MqttMessageObserver
|
|
3405
|
+
|
|
3406
|
+
# A private helper for initializing instances of the class from a raw handle,
|
|
3407
|
+
# bypassing any initialization logic and ensuring they are GC'd properly.
|
|
3408
|
+
def self.uniffi_allocate(handle)
|
|
3409
|
+
inst = allocate
|
|
3410
|
+
inst.instance_variable_set :@handle, handle
|
|
3411
|
+
ObjectSpace.define_finalizer(inst, uniffi_define_finalizer_by_handle(handle, inst.object_id))
|
|
3412
|
+
return inst
|
|
3413
|
+
end
|
|
3414
|
+
|
|
3415
|
+
# A private helper for registering an object finalizer.
|
|
3416
|
+
# N.B. it's important that this does not capture a reference
|
|
3417
|
+
# to the actual instance, only its underlying handle.
|
|
3418
|
+
def self.uniffi_define_finalizer_by_handle(handle, object_id)
|
|
3419
|
+
Proc.new do |_id|
|
|
3420
|
+
::MqttBroker.rust_call(
|
|
3421
|
+
:uniffi_mqtt_broker_fn_free_mqttmessageobserver,
|
|
3422
|
+
handle
|
|
3423
|
+
)
|
|
3424
|
+
end
|
|
3425
|
+
end
|
|
3426
|
+
# HandleMap for trait interface: stores Ruby-native objects keyed by odd handles.
|
|
3427
|
+
@uniffi_handle_map = UniffiHandleMap.new
|
|
3428
|
+
|
|
3429
|
+
class << self
|
|
3430
|
+
attr_reader :uniffi_handle_map
|
|
3431
|
+
end
|
|
3432
|
+
|
|
3433
|
+
# For trait interfaces: check that the object is either a Rust-backed instance or
|
|
3434
|
+
# responds to the required interface methods.
|
|
3435
|
+
def self.uniffi_check_lower(inst)
|
|
3436
|
+
if !inst.respond_to?(:on_message)
|
|
3437
|
+
raise TypeError.new "Expected a MqttMessageObserver instance or an object implementing the interface, got #{inst}"
|
|
3438
|
+
end
|
|
3439
|
+
end
|
|
3440
|
+
|
|
3441
|
+
def uniffi_clone_handle
|
|
3442
|
+
return ::MqttBroker.rust_call(
|
|
3443
|
+
:uniffi_mqtt_broker_fn_clone_mqttmessageobserver,
|
|
3444
|
+
@handle
|
|
3445
|
+
)
|
|
3446
|
+
end
|
|
3447
|
+
|
|
3448
|
+
# For trait interfaces: lowering distinguishes between Rust-backed and Ruby-native instances.
|
|
3449
|
+
def self.uniffi_lower(inst)
|
|
3450
|
+
if inst.is_a?(self) && inst.instance_variable_defined?(:@handle)
|
|
3451
|
+
inst.uniffi_clone_handle()
|
|
3452
|
+
else
|
|
3453
|
+
@uniffi_handle_map.insert(inst)
|
|
3454
|
+
end
|
|
3455
|
+
end
|
|
3456
|
+
|
|
3457
|
+
# For trait interfaces: lifting distinguishes even handles (Rust) from odd handles (Ruby).
|
|
3458
|
+
def self.uniffi_lift(handle)
|
|
3459
|
+
if (handle & 1) == 0
|
|
3460
|
+
uniffi_allocate handle
|
|
3461
|
+
else
|
|
3462
|
+
@uniffi_handle_map.remove handle
|
|
3463
|
+
end
|
|
3464
|
+
end
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
|
|
3468
|
+
def on_message(client_id, message)
|
|
3469
|
+
client_id = ::MqttBroker::uniffi_utf8(client_id)
|
|
3470
|
+
|
|
3471
|
+
message = message
|
|
3472
|
+
RustBuffer.check_lower_TypeObservedMessage(message)
|
|
3473
|
+
::MqttBroker.rust_call(:uniffi_mqtt_broker_fn_method_mqttmessageobserver_on_message,uniffi_clone_handle(),RustBuffer.alloc_from_string(client_id),RustBuffer.alloc_from_TypeObservedMessage(message))
|
|
3474
|
+
end
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
end
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
# Trait interface vtable implementation for MqttMessageObserver.
|
|
3481
|
+
module UniffiCallbackInterfaceMqttMessageObserver
|
|
3482
|
+
# Callback method for on_message
|
|
3483
|
+
ON_MESSAGE_CALLBACK = Proc.new do |uniffi_handle, client_id, message, uniffi_out_return, uniffi_call_status|
|
|
3484
|
+
uniffi_obj = MqttMessageObserver.uniffi_handle_map.get(uniffi_handle)
|
|
3485
|
+
make_call = Proc.new do
|
|
3486
|
+
uniffi_obj.on_message(
|
|
3487
|
+
client_id.consume_into_string,
|
|
3488
|
+
message.consume_into_TypeObservedMessage
|
|
3489
|
+
)
|
|
3490
|
+
end
|
|
3491
|
+
# No return value, so do nothing
|
|
3492
|
+
write_return_value = Proc.new { |_v| }
|
|
3493
|
+
::MqttBroker.uniffi_trait_interface_call(
|
|
3494
|
+
uniffi_call_status,
|
|
3495
|
+
make_call,
|
|
3496
|
+
write_return_value,
|
|
3497
|
+
)
|
|
3498
|
+
end
|
|
3499
|
+
|
|
3500
|
+
# Free callback: removes the handle from the map.
|
|
3501
|
+
UNIFFI_FREE_CALLBACK = Proc.new do |uniffi_handle|
|
|
3502
|
+
MqttMessageObserver.uniffi_handle_map.remove uniffi_handle
|
|
3503
|
+
end
|
|
3504
|
+
|
|
3505
|
+
# Clone callback: clones the handle in the map.
|
|
3506
|
+
UNIFFI_CLONE_CALLBACK = Proc.new do |uniffi_handle|
|
|
3507
|
+
MqttMessageObserver.uniffi_handle_map.clone_handle(uniffi_handle)
|
|
3508
|
+
end
|
|
3509
|
+
|
|
3510
|
+
# Create the VTable struct instance.
|
|
3511
|
+
UNIFFI_VTABLE = UniFFILib::VTableCallbackInterfaceMqttMessageObserver.new
|
|
3512
|
+
UNIFFI_VTABLE[:uniffi_free] = UNIFFI_FREE_CALLBACK
|
|
3513
|
+
UNIFFI_VTABLE[:uniffi_clone] = UNIFFI_CLONE_CALLBACK
|
|
3514
|
+
UNIFFI_VTABLE[:on_message] = ON_MESSAGE_CALLBACK
|
|
3515
|
+
|
|
3516
|
+
# Register the VTable with Rust.
|
|
3517
|
+
UniFFILib.uniffi_mqtt_broker_fn_init_callback_vtable_mqttmessageobserver(UNIFFI_VTABLE)
|
|
3518
|
+
end
|
|
3519
|
+
|
|
2953
3520
|
|
|
2954
3521
|
|
|
2955
3522
|
end
|
|
Binary file
|