Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Update ouisync
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Sep 28, 2023
1 parent 06b7407 commit eebd77f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
16 changes: 10 additions & 6 deletions lib/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import 'package:path/path.dart' as p;

final bindings = Bindings(_defaultLib());

typedef PostCObject = Int8 Function(Int64, Pointer<Dart_CObject>);

typedef _session_create_c = SessionCreateResult Function(
Pointer<Void>,
Pointer<Char>,
Pointer<Char>,
Pointer<NativeFunction<PostCObject>>,
Int64,
);
typedef session_create_dart = SessionCreateResult Function(
Pointer<Void>, Pointer<Char>, Pointer<Char>, int);
Pointer<Char>, Pointer<Char>, Pointer<NativeFunction<PostCObject>>, int);

typedef _session_channel_send_c = Void Function(Uint64, Pointer<Uint8>, Uint64);
typedef session_channel_send_dart = void Function(int, Pointer<Uint8>, int);
Expand All @@ -30,8 +32,10 @@ typedef session_close_dart = void Function(int);
typedef _session_shutdown_network_and_close_c = Void Function(Uint64);
typedef session_shutdown_network_and_close_dart = void Function(int);

typedef _file_copy_to_raw_fd_c = Void Function(Uint64, Uint64, Int, Int64);
typedef file_copy_to_raw_fd_dart = void Function(int, int, int, int);
typedef _file_copy_to_raw_fd_c = Void Function(
Uint64, Uint64, Int, Pointer<NativeFunction<PostCObject>>, Int64);
typedef file_copy_to_raw_fd_dart = void Function(
int, int, int, Pointer<NativeFunction<PostCObject>>, int);

typedef _log_print_c = Void Function(Uint8, Pointer<Char>, Pointer<Char>);
typedef log_print_dart = void Function(int, Pointer<Char>, Pointer<Char>);
Expand All @@ -52,7 +56,7 @@ class SessionCreateResult extends Struct {
class Bindings {
Bindings(DynamicLibrary library)
: session_create = library
.lookup<NativeFunction<_session_create_c>>('session_create')
.lookup<NativeFunction<_session_create_c>>('session_create_dart')
.asFunction(),
session_channel_send = library
.lookup<NativeFunction<_session_channel_send_c>>(
Expand All @@ -67,7 +71,7 @@ class Bindings {
.asFunction(),
file_copy_to_raw_fd = library
.lookup<NativeFunction<_file_copy_to_raw_fd_c>>(
'file_copy_to_raw_fd')
'file_copy_to_raw_fd_dart')
.asFunction(),
log_print = library
.lookup<NativeFunction<_log_print_c>>('log_print')
Expand Down
3 changes: 2 additions & 1 deletion lib/ouisync_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Session {

final recvPort = ReceivePort();
final result = _withPoolSync((pool) => bindings.session_create(
NativeApi.postCObject.cast<Void>(),
pool.toNativeUtf8(configPath),
logPath != null ? pool.toNativeUtf8(logPath) : nullptr,
NativeApi.postCObject,
recvPort.sendPort.nativePort,
));

Expand Down Expand Up @@ -799,6 +799,7 @@ class File {
session.handle,
handle,
fd,
NativeApi.postCObject,
port,
),
);
Expand Down
2 changes: 1 addition & 1 deletion ouisync
Submodule ouisync updated 48 files
+64 −3 .github/workflows/ci.yml
+ .gradle/file-system.probe
+3 −3 Cargo.toml
+9 −0 bindings/kotlin/.gitattributes
+5 −0 bindings/kotlin/.gitignore
+30 −0 bindings/kotlin/README.md
+48 −0 bindings/kotlin/build.gradle
+42 −0 bindings/kotlin/example/build.gradle
+14 −0 bindings/kotlin/example/src/main/AndroidManifest.xml
+71 −0 bindings/kotlin/example/src/main/kotlin/org/equalitie/ouisync/MainActivity.kt
+5 −0 bindings/kotlin/example/src/main/res/values/strings.xml
+1 −0 bindings/kotlin/gradle.properties
+ bindings/kotlin/gradle/wrapper/gradle-wrapper.jar
+7 −0 bindings/kotlin/gradle/wrapper/gradle-wrapper.properties
+249 −0 bindings/kotlin/gradlew
+92 −0 bindings/kotlin/gradlew.bat
+114 −0 bindings/kotlin/lib/build.gradle
+3 −0 bindings/kotlin/lib/src/main/AndroidManifest.xml
+42 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Bindings.kt
+160 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Client.kt
+61 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Directory.kt
+3 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Error.kt
+59 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/File.kt
+122 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Repository.kt
+426 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Request.kt
+213 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/ServerMessage.kt
+163 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/Session.kt
+37 −0 bindings/kotlin/lib/src/main/kotlin/org/equalitie/ouisync/ShareToken.kt
+279 −0 bindings/kotlin/lib/src/test/kotlin/org/equalitie/ouisync/RepositoryTest.kt
+102 −0 bindings/kotlin/lib/src/test/kotlin/org/equalitie/ouisync/SessionTest.kt
+5 −0 bindings/kotlin/settings.gradle
+31 −0 ffi/src/c.rs
+82 −183 ffi/src/dart.rs
+1 −1 ffi/src/error.rs
+2 −0 ffi/src/handler.rs
+73 −169 ffi/src/lib.rs
+11 −0 ffi/src/log.rs
+4 −4 ffi/src/protocol.rs
+6 −0 ffi/src/sender.rs
+134 −0 ffi/src/session.rs
+28 −22 ffi/src/transport.rs
+24 −0 lib/src/file/mod.rs
+0 −0 utils/bindgen/Cargo.toml
+0 −0 utils/bindgen/README.md
+0 −0 utils/bindgen/src/dart.rs
+73 −0 utils/bindgen/src/kotlin.rs
+2 −1 utils/bindgen/src/main.rs
+2 −0 utils/bindgen/src/parse.rs

0 comments on commit eebd77f

Please sign in to comment.