983 lines
27 KiB
Dart
983 lines
27 KiB
Dart
// AUTO GENERATED FILE, DO NOT EDIT.
|
|
// Generated by `flutter_rust_bridge`.
|
|
|
|
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import
|
|
|
|
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
import 'dart:convert';
|
|
import 'dart:typed_data';
|
|
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
|
import 'dart:ffi' as ffi;
|
|
|
|
part 'bridge_generated.freezed.dart';
|
|
|
|
abstract class VeilidFlutter {
|
|
Stream<VeilidUpdate> startupVeilidCore(
|
|
{required VeilidConfig config, dynamic hint});
|
|
|
|
Future<VeilidState> getVeilidState({dynamic hint});
|
|
|
|
Future<void> shutdownVeilidCore({dynamic hint});
|
|
}
|
|
|
|
enum AttachmentState {
|
|
Detached,
|
|
Attaching,
|
|
AttachedWeak,
|
|
AttachedGood,
|
|
AttachedStrong,
|
|
FullyAttached,
|
|
OverAttached,
|
|
Detaching,
|
|
}
|
|
|
|
class VeilidConfig {
|
|
final String programName;
|
|
final String namespace;
|
|
final VeilidConfigCapabilities capabilities;
|
|
final VeilidConfigProtectedStore protectedStore;
|
|
final VeilidConfigTableStore tableStore;
|
|
final VeilidConfigBlockStore blockStore;
|
|
final VeilidConfigNetwork network;
|
|
|
|
VeilidConfig({
|
|
required this.programName,
|
|
required this.namespace,
|
|
required this.capabilities,
|
|
required this.protectedStore,
|
|
required this.tableStore,
|
|
required this.blockStore,
|
|
required this.network,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigBlockStore {
|
|
final String directory;
|
|
final bool delete;
|
|
|
|
VeilidConfigBlockStore({
|
|
required this.directory,
|
|
required this.delete,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigCapabilities {
|
|
final bool protocolUdp;
|
|
final bool protocolConnectTcp;
|
|
final bool protocolAcceptTcp;
|
|
final bool protocolConnectWs;
|
|
final bool protocolAcceptWs;
|
|
final bool protocolConnectWss;
|
|
final bool protocolAcceptWss;
|
|
|
|
VeilidConfigCapabilities({
|
|
required this.protocolUdp,
|
|
required this.protocolConnectTcp,
|
|
required this.protocolAcceptTcp,
|
|
required this.protocolConnectWs,
|
|
required this.protocolAcceptWs,
|
|
required this.protocolConnectWss,
|
|
required this.protocolAcceptWss,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigDHT {
|
|
final int? resolveNodeTimeout;
|
|
final int resolveNodeCount;
|
|
final int resolveNodeFanout;
|
|
final int maxFindNodeCount;
|
|
final int? getValueTimeout;
|
|
final int getValueCount;
|
|
final int getValueFanout;
|
|
final int? setValueTimeout;
|
|
final int setValueCount;
|
|
final int setValueFanout;
|
|
final int minPeerCount;
|
|
final int minPeerRefreshTime;
|
|
final int validateDialInfoReceiptTime;
|
|
|
|
VeilidConfigDHT({
|
|
this.resolveNodeTimeout,
|
|
required this.resolveNodeCount,
|
|
required this.resolveNodeFanout,
|
|
required this.maxFindNodeCount,
|
|
this.getValueTimeout,
|
|
required this.getValueCount,
|
|
required this.getValueFanout,
|
|
this.setValueTimeout,
|
|
required this.setValueCount,
|
|
required this.setValueFanout,
|
|
required this.minPeerCount,
|
|
required this.minPeerRefreshTime,
|
|
required this.validateDialInfoReceiptTime,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigLeases {
|
|
final int maxServerSignalLeases;
|
|
final int maxServerRelayLeases;
|
|
final int maxClientSignalLeases;
|
|
final int maxClientRelayLeases;
|
|
|
|
VeilidConfigLeases({
|
|
required this.maxServerSignalLeases,
|
|
required this.maxServerRelayLeases,
|
|
required this.maxClientSignalLeases,
|
|
required this.maxClientRelayLeases,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigNetwork {
|
|
final int maxConnections;
|
|
final int connectionInitialTimeout;
|
|
final String nodeId;
|
|
final String nodeIdSecret;
|
|
final List<String> bootstrap;
|
|
final VeilidConfigRPC rpc;
|
|
final VeilidConfigDHT dht;
|
|
final bool upnp;
|
|
final bool natpmp;
|
|
final bool enableLocalPeerScope;
|
|
final int restrictedNatRetries;
|
|
final VeilidConfigProtocol protocol;
|
|
final VeilidConfigLeases leases;
|
|
|
|
VeilidConfigNetwork({
|
|
required this.maxConnections,
|
|
required this.connectionInitialTimeout,
|
|
required this.nodeId,
|
|
required this.nodeIdSecret,
|
|
required this.bootstrap,
|
|
required this.rpc,
|
|
required this.dht,
|
|
required this.upnp,
|
|
required this.natpmp,
|
|
required this.enableLocalPeerScope,
|
|
required this.restrictedNatRetries,
|
|
required this.protocol,
|
|
required this.leases,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigProtectedStore {
|
|
final bool allowInsecureFallback;
|
|
final bool alwaysUseInsecureStorage;
|
|
final String insecureFallbackDirectory;
|
|
final bool delete;
|
|
|
|
VeilidConfigProtectedStore({
|
|
required this.allowInsecureFallback,
|
|
required this.alwaysUseInsecureStorage,
|
|
required this.insecureFallbackDirectory,
|
|
required this.delete,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigProtocol {
|
|
final VeilidConfigUDP udp;
|
|
final VeilidConfigTCP tcp;
|
|
final VeilidConfigWS ws;
|
|
final VeilidConfigWSS wss;
|
|
|
|
VeilidConfigProtocol({
|
|
required this.udp,
|
|
required this.tcp,
|
|
required this.ws,
|
|
required this.wss,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigRPC {
|
|
final int concurrency;
|
|
final int queueSize;
|
|
final int? maxTimestampBehind;
|
|
final int? maxTimestampAhead;
|
|
final int timeout;
|
|
final int maxRouteHopCount;
|
|
|
|
VeilidConfigRPC({
|
|
required this.concurrency,
|
|
required this.queueSize,
|
|
this.maxTimestampBehind,
|
|
this.maxTimestampAhead,
|
|
required this.timeout,
|
|
required this.maxRouteHopCount,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigTableStore {
|
|
final String directory;
|
|
final bool delete;
|
|
|
|
VeilidConfigTableStore({
|
|
required this.directory,
|
|
required this.delete,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigTCP {
|
|
final bool connect;
|
|
final bool listen;
|
|
final int maxConnections;
|
|
final String listenAddress;
|
|
final String? publicAddress;
|
|
|
|
VeilidConfigTCP({
|
|
required this.connect,
|
|
required this.listen,
|
|
required this.maxConnections,
|
|
required this.listenAddress,
|
|
this.publicAddress,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigUDP {
|
|
final bool enabled;
|
|
final int socketPoolSize;
|
|
final String listenAddress;
|
|
final String? publicAddress;
|
|
|
|
VeilidConfigUDP({
|
|
required this.enabled,
|
|
required this.socketPoolSize,
|
|
required this.listenAddress,
|
|
this.publicAddress,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigWS {
|
|
final bool connect;
|
|
final bool listen;
|
|
final int maxConnections;
|
|
final String listenAddress;
|
|
final String path;
|
|
final String? url;
|
|
|
|
VeilidConfigWS({
|
|
required this.connect,
|
|
required this.listen,
|
|
required this.maxConnections,
|
|
required this.listenAddress,
|
|
required this.path,
|
|
this.url,
|
|
});
|
|
}
|
|
|
|
class VeilidConfigWSS {
|
|
final bool connect;
|
|
final int maxConnections;
|
|
|
|
VeilidConfigWSS({
|
|
required this.connect,
|
|
required this.maxConnections,
|
|
});
|
|
}
|
|
|
|
class VeilidState {
|
|
final AttachmentState attachment;
|
|
|
|
VeilidState({
|
|
required this.attachment,
|
|
});
|
|
}
|
|
|
|
@freezed
|
|
class VeilidUpdate with _$VeilidUpdate {
|
|
const factory VeilidUpdate.attachment(
|
|
AttachmentState field0,
|
|
) = Attachment;
|
|
}
|
|
|
|
class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
|
|
implements VeilidFlutter {
|
|
factory VeilidFlutterImpl(ffi.DynamicLibrary dylib) =>
|
|
VeilidFlutterImpl.raw(VeilidFlutterWire(dylib));
|
|
|
|
VeilidFlutterImpl.raw(VeilidFlutterWire inner) : super(inner);
|
|
|
|
Stream<VeilidUpdate> startupVeilidCore(
|
|
{required VeilidConfig config, dynamic hint}) =>
|
|
executeStream(FlutterRustBridgeTask(
|
|
callFfi: (port) => inner.wire_startup_veilid_core(
|
|
port, _api2wire_box_autoadd_veilid_config(config)),
|
|
parseSuccessData: _wire2api_veilid_update,
|
|
constMeta: const FlutterRustBridgeTaskConstMeta(
|
|
debugName: "startup_veilid_core",
|
|
argNames: ["config"],
|
|
),
|
|
argValues: [config],
|
|
hint: hint,
|
|
));
|
|
|
|
Future<VeilidState> getVeilidState({dynamic hint}) =>
|
|
executeNormal(FlutterRustBridgeTask(
|
|
callFfi: (port) => inner.wire_get_veilid_state(port),
|
|
parseSuccessData: _wire2api_veilid_state,
|
|
constMeta: const FlutterRustBridgeTaskConstMeta(
|
|
debugName: "get_veilid_state",
|
|
argNames: [],
|
|
),
|
|
argValues: [],
|
|
hint: hint,
|
|
));
|
|
|
|
Future<void> shutdownVeilidCore({dynamic hint}) =>
|
|
executeNormal(FlutterRustBridgeTask(
|
|
callFfi: (port) => inner.wire_shutdown_veilid_core(port),
|
|
parseSuccessData: _wire2api_unit,
|
|
constMeta: const FlutterRustBridgeTaskConstMeta(
|
|
debugName: "shutdown_veilid_core",
|
|
argNames: [],
|
|
),
|
|
argValues: [],
|
|
hint: hint,
|
|
));
|
|
|
|
// Section: api2wire
|
|
ffi.Pointer<wire_uint_8_list> _api2wire_String(String raw) {
|
|
return _api2wire_uint_8_list(utf8.encoder.convert(raw));
|
|
}
|
|
|
|
ffi.Pointer<wire_StringList> _api2wire_StringList(List<String> raw) {
|
|
final ans = inner.new_StringList(raw.length);
|
|
for (var i = 0; i < raw.length; i++) {
|
|
ans.ref.ptr[i] = _api2wire_String(raw[i]);
|
|
}
|
|
return ans;
|
|
}
|
|
|
|
int _api2wire_bool(bool raw) {
|
|
return raw ? 1 : 0;
|
|
}
|
|
|
|
ffi.Pointer<ffi.Uint64> _api2wire_box_autoadd_u64(int raw) {
|
|
return inner.new_box_autoadd_u64(raw);
|
|
}
|
|
|
|
ffi.Pointer<wire_VeilidConfig> _api2wire_box_autoadd_veilid_config(
|
|
VeilidConfig raw) {
|
|
final ptr = inner.new_box_autoadd_veilid_config();
|
|
_api_fill_to_wire_veilid_config(raw, ptr.ref);
|
|
return ptr;
|
|
}
|
|
|
|
ffi.Pointer<wire_uint_8_list> _api2wire_opt_String(String? raw) {
|
|
return raw == null ? ffi.nullptr : _api2wire_String(raw);
|
|
}
|
|
|
|
ffi.Pointer<ffi.Uint64> _api2wire_opt_box_autoadd_u64(int? raw) {
|
|
return raw == null ? ffi.nullptr : _api2wire_box_autoadd_u64(raw);
|
|
}
|
|
|
|
int _api2wire_u32(int raw) {
|
|
return raw;
|
|
}
|
|
|
|
int _api2wire_u64(int raw) {
|
|
return raw;
|
|
}
|
|
|
|
int _api2wire_u8(int raw) {
|
|
return raw;
|
|
}
|
|
|
|
ffi.Pointer<wire_uint_8_list> _api2wire_uint_8_list(Uint8List raw) {
|
|
final ans = inner.new_uint_8_list(raw.length);
|
|
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
|
|
return ans;
|
|
}
|
|
|
|
// Section: api_fill_to_wire
|
|
|
|
void _api_fill_to_wire_box_autoadd_veilid_config(
|
|
VeilidConfig apiObj, ffi.Pointer<wire_VeilidConfig> wireObj) {
|
|
_api_fill_to_wire_veilid_config(apiObj, wireObj.ref);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config(
|
|
VeilidConfig apiObj, wire_VeilidConfig wireObj) {
|
|
wireObj.program_name = _api2wire_String(apiObj.programName);
|
|
wireObj.namespace = _api2wire_String(apiObj.namespace);
|
|
wireObj.capabilities =
|
|
_api2wire_veilid_config_capabilities(apiObj.capabilities);
|
|
wireObj.protected_store =
|
|
_api2wire_veilid_config_protected_store(apiObj.protectedStore);
|
|
wireObj.table_store =
|
|
_api2wire_veilid_config_table_store(apiObj.tableStore);
|
|
wireObj.block_store =
|
|
_api2wire_veilid_config_block_store(apiObj.blockStore);
|
|
wireObj.network = _api2wire_veilid_config_network(apiObj.network);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_block_store(
|
|
VeilidConfigBlockStore apiObj, wire_VeilidConfigBlockStore wireObj) {
|
|
wireObj.directory = _api2wire_String(apiObj.directory);
|
|
wireObj.delete = _api2wire_bool(apiObj.delete);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_capabilities(
|
|
VeilidConfigCapabilities apiObj, wire_VeilidConfigCapabilities wireObj) {
|
|
wireObj.protocol_udp = _api2wire_bool(apiObj.protocolUdp);
|
|
wireObj.protocol_connect_tcp = _api2wire_bool(apiObj.protocolConnectTcp);
|
|
wireObj.protocol_accept_tcp = _api2wire_bool(apiObj.protocolAcceptTcp);
|
|
wireObj.protocol_connect_ws = _api2wire_bool(apiObj.protocolConnectWs);
|
|
wireObj.protocol_accept_ws = _api2wire_bool(apiObj.protocolAcceptWs);
|
|
wireObj.protocol_connect_wss = _api2wire_bool(apiObj.protocolConnectWss);
|
|
wireObj.protocol_accept_wss = _api2wire_bool(apiObj.protocolAcceptWss);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_dht(
|
|
VeilidConfigDHT apiObj, wire_VeilidConfigDHT wireObj) {
|
|
wireObj.resolve_node_timeout =
|
|
_api2wire_opt_box_autoadd_u64(apiObj.resolveNodeTimeout);
|
|
wireObj.resolve_node_count = _api2wire_u32(apiObj.resolveNodeCount);
|
|
wireObj.resolve_node_fanout = _api2wire_u32(apiObj.resolveNodeFanout);
|
|
wireObj.max_find_node_count = _api2wire_u32(apiObj.maxFindNodeCount);
|
|
wireObj.get_value_timeout =
|
|
_api2wire_opt_box_autoadd_u64(apiObj.getValueTimeout);
|
|
wireObj.get_value_count = _api2wire_u32(apiObj.getValueCount);
|
|
wireObj.get_value_fanout = _api2wire_u32(apiObj.getValueFanout);
|
|
wireObj.set_value_timeout =
|
|
_api2wire_opt_box_autoadd_u64(apiObj.setValueTimeout);
|
|
wireObj.set_value_count = _api2wire_u32(apiObj.setValueCount);
|
|
wireObj.set_value_fanout = _api2wire_u32(apiObj.setValueFanout);
|
|
wireObj.min_peer_count = _api2wire_u32(apiObj.minPeerCount);
|
|
wireObj.min_peer_refresh_time = _api2wire_u64(apiObj.minPeerRefreshTime);
|
|
wireObj.validate_dial_info_receipt_time =
|
|
_api2wire_u64(apiObj.validateDialInfoReceiptTime);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_leases(
|
|
VeilidConfigLeases apiObj, wire_VeilidConfigLeases wireObj) {
|
|
wireObj.max_server_signal_leases =
|
|
_api2wire_u32(apiObj.maxServerSignalLeases);
|
|
wireObj.max_server_relay_leases =
|
|
_api2wire_u32(apiObj.maxServerRelayLeases);
|
|
wireObj.max_client_signal_leases =
|
|
_api2wire_u32(apiObj.maxClientSignalLeases);
|
|
wireObj.max_client_relay_leases =
|
|
_api2wire_u32(apiObj.maxClientRelayLeases);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_network(
|
|
VeilidConfigNetwork apiObj, wire_VeilidConfigNetwork wireObj) {
|
|
wireObj.max_connections = _api2wire_u32(apiObj.maxConnections);
|
|
wireObj.connection_initial_timeout =
|
|
_api2wire_u64(apiObj.connectionInitialTimeout);
|
|
wireObj.node_id = _api2wire_String(apiObj.nodeId);
|
|
wireObj.node_id_secret = _api2wire_String(apiObj.nodeIdSecret);
|
|
wireObj.bootstrap = _api2wire_StringList(apiObj.bootstrap);
|
|
wireObj.rpc = _api2wire_veilid_config_rpc(apiObj.rpc);
|
|
wireObj.dht = _api2wire_veilid_config_dht(apiObj.dht);
|
|
wireObj.upnp = _api2wire_bool(apiObj.upnp);
|
|
wireObj.natpmp = _api2wire_bool(apiObj.natpmp);
|
|
wireObj.enable_local_peer_scope =
|
|
_api2wire_bool(apiObj.enableLocalPeerScope);
|
|
wireObj.restricted_nat_retries = _api2wire_u32(apiObj.restrictedNatRetries);
|
|
wireObj.protocol = _api2wire_veilid_config_protocol(apiObj.protocol);
|
|
wireObj.leases = _api2wire_veilid_config_leases(apiObj.leases);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_protected_store(
|
|
VeilidConfigProtectedStore apiObj,
|
|
wire_VeilidConfigProtectedStore wireObj) {
|
|
wireObj.allow_insecure_fallback =
|
|
_api2wire_bool(apiObj.allowInsecureFallback);
|
|
wireObj.always_use_insecure_storage =
|
|
_api2wire_bool(apiObj.alwaysUseInsecureStorage);
|
|
wireObj.insecure_fallback_directory =
|
|
_api2wire_String(apiObj.insecureFallbackDirectory);
|
|
wireObj.delete = _api2wire_bool(apiObj.delete);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_protocol(
|
|
VeilidConfigProtocol apiObj, wire_VeilidConfigProtocol wireObj) {
|
|
wireObj.udp = _api2wire_veilid_config_udp(apiObj.udp);
|
|
wireObj.tcp = _api2wire_veilid_config_tcp(apiObj.tcp);
|
|
wireObj.ws = _api2wire_veilid_config_ws(apiObj.ws);
|
|
wireObj.wss = _api2wire_veilid_config_wss(apiObj.wss);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_rpc(
|
|
VeilidConfigRPC apiObj, wire_VeilidConfigRPC wireObj) {
|
|
wireObj.concurrency = _api2wire_u32(apiObj.concurrency);
|
|
wireObj.queue_size = _api2wire_u32(apiObj.queueSize);
|
|
wireObj.max_timestamp_behind =
|
|
_api2wire_opt_box_autoadd_u64(apiObj.maxTimestampBehind);
|
|
wireObj.max_timestamp_ahead =
|
|
_api2wire_opt_box_autoadd_u64(apiObj.maxTimestampAhead);
|
|
wireObj.timeout = _api2wire_u64(apiObj.timeout);
|
|
wireObj.max_route_hop_count = _api2wire_u8(apiObj.maxRouteHopCount);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_table_store(
|
|
VeilidConfigTableStore apiObj, wire_VeilidConfigTableStore wireObj) {
|
|
wireObj.directory = _api2wire_String(apiObj.directory);
|
|
wireObj.delete = _api2wire_bool(apiObj.delete);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_tcp(
|
|
VeilidConfigTCP apiObj, wire_VeilidConfigTCP wireObj) {
|
|
wireObj.connect = _api2wire_bool(apiObj.connect);
|
|
wireObj.listen = _api2wire_bool(apiObj.listen);
|
|
wireObj.max_connections = _api2wire_u32(apiObj.maxConnections);
|
|
wireObj.listen_address = _api2wire_String(apiObj.listenAddress);
|
|
wireObj.public_address = _api2wire_opt_String(apiObj.publicAddress);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_udp(
|
|
VeilidConfigUDP apiObj, wire_VeilidConfigUDP wireObj) {
|
|
wireObj.enabled = _api2wire_bool(apiObj.enabled);
|
|
wireObj.socket_pool_size = _api2wire_u32(apiObj.socketPoolSize);
|
|
wireObj.listen_address = _api2wire_String(apiObj.listenAddress);
|
|
wireObj.public_address = _api2wire_opt_String(apiObj.publicAddress);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_ws(
|
|
VeilidConfigWS apiObj, wire_VeilidConfigWS wireObj) {
|
|
wireObj.connect = _api2wire_bool(apiObj.connect);
|
|
wireObj.listen = _api2wire_bool(apiObj.listen);
|
|
wireObj.max_connections = _api2wire_u32(apiObj.maxConnections);
|
|
wireObj.listen_address = _api2wire_String(apiObj.listenAddress);
|
|
wireObj.path = _api2wire_String(apiObj.path);
|
|
wireObj.url = _api2wire_opt_String(apiObj.url);
|
|
}
|
|
|
|
void _api_fill_to_wire_veilid_config_wss(
|
|
VeilidConfigWSS apiObj, wire_VeilidConfigWSS wireObj) {
|
|
wireObj.connect = _api2wire_bool(apiObj.connect);
|
|
wireObj.max_connections = _api2wire_u32(apiObj.maxConnections);
|
|
}
|
|
}
|
|
|
|
// Section: wire2api
|
|
AttachmentState _wire2api_attachment_state(dynamic raw) {
|
|
return AttachmentState.values[raw];
|
|
}
|
|
|
|
void _wire2api_unit(dynamic raw) {
|
|
return;
|
|
}
|
|
|
|
VeilidState _wire2api_veilid_state(dynamic raw) {
|
|
final arr = raw as List<dynamic>;
|
|
if (arr.length != 1)
|
|
throw Exception('unexpected arr length: expect 1 but see ${arr.length}');
|
|
return VeilidState(
|
|
attachment: _wire2api_attachment_state(arr[0]),
|
|
);
|
|
}
|
|
|
|
VeilidUpdate _wire2api_veilid_update(dynamic raw) {
|
|
switch (raw[0]) {
|
|
case 0:
|
|
return Attachment(
|
|
_wire2api_attachment_state(raw[1]),
|
|
);
|
|
default:
|
|
throw Exception("unreachable");
|
|
}
|
|
}
|
|
|
|
// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
|
|
|
|
// AUTO GENERATED FILE, DO NOT EDIT.
|
|
//
|
|
// Generated by `package:ffigen`.
|
|
|
|
/// generated by flutter_rust_bridge
|
|
class VeilidFlutterWire implements FlutterRustBridgeWireBase {
|
|
/// Holds the symbol lookup function.
|
|
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
_lookup;
|
|
|
|
/// The symbols are looked up in [dynamicLibrary].
|
|
VeilidFlutterWire(ffi.DynamicLibrary dynamicLibrary)
|
|
: _lookup = dynamicLibrary.lookup;
|
|
|
|
/// The symbols are looked up with [lookup].
|
|
VeilidFlutterWire.fromLookup(
|
|
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
lookup)
|
|
: _lookup = lookup;
|
|
|
|
void wire_startup_veilid_core(
|
|
int port_,
|
|
ffi.Pointer<wire_VeilidConfig> config,
|
|
) {
|
|
return _wire_startup_veilid_core(
|
|
port_,
|
|
config,
|
|
);
|
|
}
|
|
|
|
late final _wire_startup_veilid_corePtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Void Function(ffi.Int64,
|
|
ffi.Pointer<wire_VeilidConfig>)>>('wire_startup_veilid_core');
|
|
late final _wire_startup_veilid_core = _wire_startup_veilid_corePtr
|
|
.asFunction<void Function(int, ffi.Pointer<wire_VeilidConfig>)>();
|
|
|
|
void wire_get_veilid_state(
|
|
int port_,
|
|
) {
|
|
return _wire_get_veilid_state(
|
|
port_,
|
|
);
|
|
}
|
|
|
|
late final _wire_get_veilid_statePtr =
|
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
|
|
'wire_get_veilid_state');
|
|
late final _wire_get_veilid_state =
|
|
_wire_get_veilid_statePtr.asFunction<void Function(int)>();
|
|
|
|
void wire_shutdown_veilid_core(
|
|
int port_,
|
|
) {
|
|
return _wire_shutdown_veilid_core(
|
|
port_,
|
|
);
|
|
}
|
|
|
|
late final _wire_shutdown_veilid_corePtr =
|
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
|
|
'wire_shutdown_veilid_core');
|
|
late final _wire_shutdown_veilid_core =
|
|
_wire_shutdown_veilid_corePtr.asFunction<void Function(int)>();
|
|
|
|
ffi.Pointer<wire_StringList> new_StringList(
|
|
int len,
|
|
) {
|
|
return _new_StringList(
|
|
len,
|
|
);
|
|
}
|
|
|
|
late final _new_StringListPtr = _lookup<
|
|
ffi.NativeFunction<ffi.Pointer<wire_StringList> Function(ffi.Int32)>>(
|
|
'new_StringList');
|
|
late final _new_StringList = _new_StringListPtr
|
|
.asFunction<ffi.Pointer<wire_StringList> Function(int)>();
|
|
|
|
ffi.Pointer<ffi.Uint64> new_box_autoadd_u64(
|
|
int value,
|
|
) {
|
|
return _new_box_autoadd_u64(
|
|
value,
|
|
);
|
|
}
|
|
|
|
late final _new_box_autoadd_u64Ptr =
|
|
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Uint64> Function(ffi.Uint64)>>(
|
|
'new_box_autoadd_u64');
|
|
late final _new_box_autoadd_u64 = _new_box_autoadd_u64Ptr
|
|
.asFunction<ffi.Pointer<ffi.Uint64> Function(int)>();
|
|
|
|
ffi.Pointer<wire_VeilidConfig> new_box_autoadd_veilid_config() {
|
|
return _new_box_autoadd_veilid_config();
|
|
}
|
|
|
|
late final _new_box_autoadd_veilid_configPtr =
|
|
_lookup<ffi.NativeFunction<ffi.Pointer<wire_VeilidConfig> Function()>>(
|
|
'new_box_autoadd_veilid_config');
|
|
late final _new_box_autoadd_veilid_config = _new_box_autoadd_veilid_configPtr
|
|
.asFunction<ffi.Pointer<wire_VeilidConfig> Function()>();
|
|
|
|
ffi.Pointer<wire_uint_8_list> new_uint_8_list(
|
|
int len,
|
|
) {
|
|
return _new_uint_8_list(
|
|
len,
|
|
);
|
|
}
|
|
|
|
late final _new_uint_8_listPtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Pointer<wire_uint_8_list> Function(
|
|
ffi.Int32)>>('new_uint_8_list');
|
|
late final _new_uint_8_list = _new_uint_8_listPtr
|
|
.asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();
|
|
|
|
void free_WireSyncReturnStruct(
|
|
WireSyncReturnStruct val,
|
|
) {
|
|
return _free_WireSyncReturnStruct(
|
|
val,
|
|
);
|
|
}
|
|
|
|
late final _free_WireSyncReturnStructPtr =
|
|
_lookup<ffi.NativeFunction<ffi.Void Function(WireSyncReturnStruct)>>(
|
|
'free_WireSyncReturnStruct');
|
|
late final _free_WireSyncReturnStruct = _free_WireSyncReturnStructPtr
|
|
.asFunction<void Function(WireSyncReturnStruct)>();
|
|
|
|
void store_dart_post_cobject(
|
|
DartPostCObjectFnType ptr,
|
|
) {
|
|
return _store_dart_post_cobject(
|
|
ptr,
|
|
);
|
|
}
|
|
|
|
late final _store_dart_post_cobjectPtr =
|
|
_lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
|
|
'store_dart_post_cobject');
|
|
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
|
|
.asFunction<void Function(DartPostCObjectFnType)>();
|
|
}
|
|
|
|
class wire_uint_8_list extends ffi.Struct {
|
|
external ffi.Pointer<ffi.Uint8> ptr;
|
|
|
|
@ffi.Int32()
|
|
external int len;
|
|
}
|
|
|
|
class wire_VeilidConfigCapabilities extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int protocol_udp;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_connect_tcp;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_accept_tcp;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_connect_ws;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_accept_ws;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_connect_wss;
|
|
|
|
@ffi.Uint8()
|
|
external int protocol_accept_wss;
|
|
}
|
|
|
|
class wire_VeilidConfigProtectedStore extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int allow_insecure_fallback;
|
|
|
|
@ffi.Uint8()
|
|
external int always_use_insecure_storage;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> insecure_fallback_directory;
|
|
|
|
@ffi.Uint8()
|
|
external int delete_;
|
|
}
|
|
|
|
class wire_VeilidConfigTableStore extends ffi.Struct {
|
|
external ffi.Pointer<wire_uint_8_list> directory;
|
|
|
|
@ffi.Uint8()
|
|
external int delete_;
|
|
}
|
|
|
|
class wire_VeilidConfigBlockStore extends ffi.Struct {
|
|
external ffi.Pointer<wire_uint_8_list> directory;
|
|
|
|
@ffi.Uint8()
|
|
external int delete_;
|
|
}
|
|
|
|
class wire_StringList extends ffi.Struct {
|
|
external ffi.Pointer<ffi.Pointer<wire_uint_8_list>> ptr;
|
|
|
|
@ffi.Int32()
|
|
external int len;
|
|
}
|
|
|
|
class wire_VeilidConfigRPC extends ffi.Struct {
|
|
@ffi.Uint32()
|
|
external int concurrency;
|
|
|
|
@ffi.Uint32()
|
|
external int queue_size;
|
|
|
|
external ffi.Pointer<ffi.Uint64> max_timestamp_behind;
|
|
|
|
external ffi.Pointer<ffi.Uint64> max_timestamp_ahead;
|
|
|
|
@ffi.Uint64()
|
|
external int timeout;
|
|
|
|
@ffi.Uint8()
|
|
external int max_route_hop_count;
|
|
}
|
|
|
|
class wire_VeilidConfigDHT extends ffi.Struct {
|
|
external ffi.Pointer<ffi.Uint64> resolve_node_timeout;
|
|
|
|
@ffi.Uint32()
|
|
external int resolve_node_count;
|
|
|
|
@ffi.Uint32()
|
|
external int resolve_node_fanout;
|
|
|
|
@ffi.Uint32()
|
|
external int max_find_node_count;
|
|
|
|
external ffi.Pointer<ffi.Uint64> get_value_timeout;
|
|
|
|
@ffi.Uint32()
|
|
external int get_value_count;
|
|
|
|
@ffi.Uint32()
|
|
external int get_value_fanout;
|
|
|
|
external ffi.Pointer<ffi.Uint64> set_value_timeout;
|
|
|
|
@ffi.Uint32()
|
|
external int set_value_count;
|
|
|
|
@ffi.Uint32()
|
|
external int set_value_fanout;
|
|
|
|
@ffi.Uint32()
|
|
external int min_peer_count;
|
|
|
|
@ffi.Uint64()
|
|
external int min_peer_refresh_time;
|
|
|
|
@ffi.Uint64()
|
|
external int validate_dial_info_receipt_time;
|
|
}
|
|
|
|
class wire_VeilidConfigUDP extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int enabled;
|
|
|
|
@ffi.Uint32()
|
|
external int socket_pool_size;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> listen_address;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> public_address;
|
|
}
|
|
|
|
class wire_VeilidConfigTCP extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int connect;
|
|
|
|
@ffi.Uint8()
|
|
external int listen;
|
|
|
|
@ffi.Uint32()
|
|
external int max_connections;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> listen_address;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> public_address;
|
|
}
|
|
|
|
class wire_VeilidConfigWS extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int connect;
|
|
|
|
@ffi.Uint8()
|
|
external int listen;
|
|
|
|
@ffi.Uint32()
|
|
external int max_connections;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> listen_address;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> path;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> url;
|
|
}
|
|
|
|
class wire_VeilidConfigWSS extends ffi.Struct {
|
|
@ffi.Uint8()
|
|
external int connect;
|
|
|
|
@ffi.Uint32()
|
|
external int max_connections;
|
|
}
|
|
|
|
class wire_VeilidConfigProtocol extends ffi.Struct {
|
|
external wire_VeilidConfigUDP udp;
|
|
|
|
external wire_VeilidConfigTCP tcp;
|
|
|
|
external wire_VeilidConfigWS ws;
|
|
|
|
external wire_VeilidConfigWSS wss;
|
|
}
|
|
|
|
class wire_VeilidConfigLeases extends ffi.Struct {
|
|
@ffi.Uint32()
|
|
external int max_server_signal_leases;
|
|
|
|
@ffi.Uint32()
|
|
external int max_server_relay_leases;
|
|
|
|
@ffi.Uint32()
|
|
external int max_client_signal_leases;
|
|
|
|
@ffi.Uint32()
|
|
external int max_client_relay_leases;
|
|
}
|
|
|
|
class wire_VeilidConfigNetwork extends ffi.Struct {
|
|
@ffi.Uint32()
|
|
external int max_connections;
|
|
|
|
@ffi.Uint64()
|
|
external int connection_initial_timeout;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> node_id;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> node_id_secret;
|
|
|
|
external ffi.Pointer<wire_StringList> bootstrap;
|
|
|
|
external wire_VeilidConfigRPC rpc;
|
|
|
|
external wire_VeilidConfigDHT dht;
|
|
|
|
@ffi.Uint8()
|
|
external int upnp;
|
|
|
|
@ffi.Uint8()
|
|
external int natpmp;
|
|
|
|
@ffi.Uint8()
|
|
external int enable_local_peer_scope;
|
|
|
|
@ffi.Uint32()
|
|
external int restricted_nat_retries;
|
|
|
|
external wire_VeilidConfigProtocol protocol;
|
|
|
|
external wire_VeilidConfigLeases leases;
|
|
}
|
|
|
|
class wire_VeilidConfig extends ffi.Struct {
|
|
external ffi.Pointer<wire_uint_8_list> program_name;
|
|
|
|
external ffi.Pointer<wire_uint_8_list> namespace_;
|
|
|
|
external wire_VeilidConfigCapabilities capabilities;
|
|
|
|
external wire_VeilidConfigProtectedStore protected_store;
|
|
|
|
external wire_VeilidConfigTableStore table_store;
|
|
|
|
external wire_VeilidConfigBlockStore block_store;
|
|
|
|
external wire_VeilidConfigNetwork network;
|
|
}
|
|
|
|
typedef DartPostCObjectFnType = ffi.Pointer<
|
|
ffi.NativeFunction<ffi.Uint8 Function(DartPort, ffi.Pointer<ffi.Void>)>>;
|
|
typedef DartPort = ffi.Int64;
|