Skip to content

Update LiteCore to 3.3.0-79 #1707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core_version.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[version]
build = 4.0.0-38
build = 3.3.0-79

[hashes]
ce = 6d3748cd6dd8466bd4ac3c07744357662dfc1894
ee = 81151912cf26bcfd9258b638ed6ea1d098cadc46
ce = bb1b98277133800381399941277871c4bbd0c1ee
ee = 6fbaed6e2633fb2b286486283cd687b2f390e58f
2 changes: 1 addition & 1 deletion src/Couchbase.Lite.Shared/API/Log/FileLogger.cs
Original file line number Diff line number Diff line change
@@ -257,7 +257,7 @@ private unsafe void UpdateConfig()
var options = new C4LogFileOptions
{
base_path = dir.AsFLSlice(),
log_level = (C4LogLevel) Level,
log_level = Config?.Directory == null ? C4LogLevel.None : (C4LogLevel) Level,
max_rotate_count = _config?.MaxRotateCount ?? 1,
max_size_bytes = _config?.MaxSize ?? 1024 * 500L,
use_plaintext = _config?.UsePlaintext ?? false,
2 changes: 1 addition & 1 deletion src/LiteCore/parse/parse_API.py
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@

#HACK: Typedefs choke CppHeaderParser if the struct and typename have the same name (i.e. typedef struct foo foo)
fin = open(file, "r")
file_contents = fin.read().replace("C4NONNULL", "").replace("FLNONNULL","").replace("NODISCARD", "")
file_contents = fin.read().replace("C4NONNULL", "").replace("FLNONNULL","").replace("NODISCARD", "").replace("LIFETIMEBOUND", "")
file_contents = re.sub("typedef.*", "", file_contents)
fin.close()

5 changes: 3 additions & 2 deletions src/LiteCore/parse/parse_structs.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"FLString":"FLSlice"}
bridge_types = ["UIntPtr","string","bool"]
reverse_bridge_map = {"string":"IntPtr","bool":"byte"}
skip_types = ["C4FullTextTerm","C4SocketFactory","C4ReplicatorParameters","C4ReplicationCollection","C4PredictiveModel", "C4ExtraInfo", "C4TLSConfig", "C4ListenerConfig", "C4ExternalKeyCallbacks"]
skip_types = ["C4FullTextTerm","C4SocketFactory","C4ReplicatorParameters","C4ReplicationCollection","C4PredictiveModel", "C4ExtraInfo", "C4TLSConfig", "C4ListenerConfig", "C4ExternalKeyCallbacks", "C4PeerSyncCollection"]
partials = ["C4RawDocument", "C4Address", "C4QueryEnumerator", "C4SocketFactory", "C4Error","C4Slice","C4BlobKey","C4EncryptionKey","C4DatabaseConfig","C4IndexOptions",
"C4EnumeratorOptions","C4QueryOptions","C4UUID","FLSlice","FLSliceResult","C4FullTextMatch","C4DocPutRequest", "C4DocumentInfo",
"C4Document", "C4SocketFactory"]
@@ -111,7 +111,8 @@ def make_literal(type):
continue

line = line.replace("FL_NULLABLE", "") \
.replace("C4NULLABLE", "")
.replace("C4NULLABLE", "") \
.replace("const*", "")
stripped = re.search(r'([^ ;{}]+) +(\**)([^ ;{}*]+);', line)
if not stripped:
continue
28 changes: 2 additions & 26 deletions src/LiteCore/parse/templates_c4/C4ListenerConfig.cs
Original file line number Diff line number Diff line change
@@ -2,39 +2,15 @@ internal unsafe struct C4ListenerConfig
{
public ushort port;
public FLSlice networkInterface;
public C4ListenerAPIs apis;
public C4TLSConfig* tlsConfig;
public FLSlice serverName;
public FLSlice serverVersion;
public IntPtr httpAuthCallback;
public void* callbackContext;
public FLSlice directory;
private byte _allowCreateDBs;
private byte _allowDeleteDBs;
private byte _allowCreateCollections;
private byte _allowDeleteCollections;
private byte _allowPush;
private byte _allowPull;
private byte _enableDeltaSync;

public bool allowCreateDBs
{
get {
return Convert.ToBoolean(_allowCreateDBs);
}
set {
_allowCreateDBs = Convert.ToByte(value);
}
}

public bool allowDeleteDBs
{
get {
return Convert.ToBoolean(_allowDeleteDBs);
}
set {
_allowDeleteDBs = Convert.ToByte(value);
}
}

public bool allowPush
{
get {
34 changes: 34 additions & 0 deletions src/LiteCore/parse/templates_c4/C4PeerSyncCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
internal unsafe partial struct C4PeerSyncCollection
{
public C4CollectionSpec collection;
private byte _pushEnabled;
private byte _pullEnabled;
public FLSlice optionsDictFleece;
private IntPtr _pushFilter;
private IntPtr _pullFilter;
public void* callbackContext;

public bool pushEnabled
{
get
{
return Convert.ToBoolean(_pushEnabled);
}
set
{
_pushEnabled = Convert.ToByte(value);
}
}

public bool pullEnabled
{
get
{
return Convert.ToBoolean(_pullEnabled);
}
set
{
_pullEnabled = Convert.ToByte(value);
}
}
}
5 changes: 3 additions & 2 deletions src/LiteCore/parse/templates_c4/C4ReplicatorParameters.cs
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@ internal unsafe struct C4ReplicatorParameters
public IntPtr onStatusChanged;
public IntPtr onDocumentEnded;
public IntPtr onBlobProgress;
public IntPtr propertyEncryptor;
public IntPtr propertyDecryptor;
public IntPtr propertyEncryptor;
public IntPtr propertyDecryptor;
public void* callbackContext;
public C4SocketFactory* socketFactory;
public C4ReplicationCollection* collections;
public IntPtr collectionCount;
public C4KeyPair* externalKey;
}
10 changes: 9 additions & 1 deletion src/LiteCore/src/LiteCore.Shared/Interop/C4Base_defs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4Base_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -107,6 +107,14 @@ internal unsafe struct C4KeyPair

internal unsafe struct C4Listener
{
}

internal unsafe struct C4LogObserver
{
}

internal unsafe struct C4PeerSync
{
}

internal unsafe struct C4Query
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4DatabaseTypes_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ internal enum C4DatabaseFlags : uint
NonObservable = 0x40,
DiskSyncFull = 0x80,
FakeVectorClock = 0x0100,
NoHousekeeping = 0x0200,
}

internal enum C4EncryptionAlgorithm : uint
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4DocumentTypes_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -65,7 +65,6 @@ internal enum C4DocContentLevel : byte
DocGetMetadata,
DocGetCurrentRev,
DocGetAll,
DocGetUpgraded,
}

internal unsafe struct C4Revision
14 changes: 13 additions & 1 deletion src/LiteCore/src/LiteCore.Shared/Interop/C4IndexTypes_defs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4IndexTypes_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -115,6 +115,7 @@ internal unsafe partial struct C4IndexOptions
private IntPtr _stopWords;
private IntPtr _unnestPath;
public C4VectorIndexOptions vector;
private IntPtr _where;

public string? language
{
@@ -168,6 +169,17 @@ public string? unnestPath
Marshal.FreeHGlobal(old);
}
}

public string? where
{
get {
return Marshal.PtrToStringAnsi(_where);
}
set {
var old = Interlocked.Exchange(ref _where, Marshal.StringToHGlobalAnsi(value));
Marshal.FreeHGlobal(old);
}
}
}
}

50 changes: 20 additions & 30 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4Listener.cs
Original file line number Diff line number Diff line change
@@ -167,6 +167,8 @@ internal sealed unsafe class ListenerConfig : IDisposable
private C4ListenerConfig _c4ListenerConfig;
private C4ListenerHTTPAuthCallback? _onHTTPAuthCallback;
private C4String _networkInterface;
private C4String _serverName;
private C4String _serverVersion;

#endregion

@@ -222,51 +224,37 @@ public string? NetworkInterface
}
}

/// <summary>
/// Which API(s) to enable
/// </summary>
public C4ListenerAPIs Apis
{
get => _c4ListenerConfig.apis;
set => _c4ListenerConfig.apis = value;
}

/// <summary>
/// TLS configuration, or NULL for no TLS
/// </summary>
public TLSConfig? TlsConfig { get; set; }

#region For REST listeners only:

/// <summary>
/// Directory where newly-PUT databases will be created
/// The optional name of the server to return from requests
/// </summary>
public FLSlice Directory
public string? ServerName
{
get => _c4ListenerConfig.directory;
set => _c4ListenerConfig.directory = value;
}

/// <summary>
/// If true, "PUT /db" is allowed
/// </summary>
public bool AllowCreateDBs
{
get => _c4ListenerConfig.allowCreateDBs;
set => _c4ListenerConfig.allowCreateDBs = value;
get => _c4ListenerConfig.serverName.CreateString();
set {
_serverName.Dispose();
_serverName = new C4String(value);
_c4ListenerConfig.serverName = _serverName.AsFLSlice();
}
}

/// <summary>
/// If true, "DELETE /db" is allowed
/// The optional version of the server to return from requests
/// </summary>
public bool AllowDeleteDBs
public string? ServerVersion
{
get => _c4ListenerConfig.allowDeleteDBs;
set => _c4ListenerConfig.allowDeleteDBs = value;
get => _c4ListenerConfig.serverName.CreateString();
set {
_serverVersion.Dispose();
_serverVersion = new C4String(value);
_c4ListenerConfig.serverName = _serverVersion.AsFLSlice();
}
}

#endregion

#region For sync listeners only:


@@ -307,6 +295,8 @@ private void Dispose(bool finalizing)
{
Context = null;
_networkInterface.Dispose();
_serverName.Dispose();
_serverVersion.Dispose();
}

#endregion
48 changes: 27 additions & 21 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4ListenerTypes_defs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4ListenerTypes_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -38,13 +38,6 @@

namespace LiteCore.Interop
{
[Flags]
internal enum C4ListenerAPIs : uint
{
RESTAPI = 0x01,
SyncAPI = 0x02
}

internal enum C4PrivateKeyRepresentation : uint
{
PrivateKeyFromCert,
@@ -77,39 +70,53 @@ internal unsafe struct C4ListenerConfig
{
public ushort port;
public FLSlice networkInterface;
public C4ListenerAPIs apis;
public C4TLSConfig* tlsConfig;
public FLSlice serverName;
public FLSlice serverVersion;
public IntPtr httpAuthCallback;
public void* callbackContext;
public FLSlice directory;
private byte _allowCreateDBs;
private byte _allowDeleteDBs;
private byte _allowCreateCollections;
private byte _allowDeleteCollections;
private byte _allowPush;
private byte _allowPull;
private byte _enableDeltaSync;

public bool allowCreateDBs
public bool allowPush
{
get {
return Convert.ToBoolean(_allowCreateDBs);
return Convert.ToBoolean(_allowPush);
}
set {
_allowCreateDBs = Convert.ToByte(value);
_allowPush = Convert.ToByte(value);
}
}

public bool allowDeleteDBs
public bool allowPull
{
get {
return Convert.ToBoolean(_allowDeleteDBs);
return Convert.ToBoolean(_allowPull);
}
set {
_allowDeleteDBs = Convert.ToByte(value);
_allowPull = Convert.ToByte(value);
}
}

public bool enableDeltaSync
{
get {
return Convert.ToBoolean(_enableDeltaSync);
}
set {
_enableDeltaSync = Convert.ToByte(value);
}
}
}


internal unsafe struct C4ListenerDatabaseConfig
{
private byte _allowPush;
private byte _allowPull;
private byte _enableDeltaSync;

public bool allowPush
{
get {
@@ -140,7 +147,6 @@ public bool enableDeltaSync
}
}
}

}

#pragma warning restore IDE0051 // Remove unused private members
4 changes: 2 additions & 2 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4Listener_native.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4Listener_native.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public static bool c4listener_unshareCollection(C4Listener* listener, string? na
}

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern FLMutableArray* c4listener_getURLs(C4Listener* listener, C4Database* db, C4ListenerAPIs api, C4Error* err);
public static extern FLMutableArray* c4listener_getURLs(C4Listener* listener, C4Database* db, C4Error* err);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern ushort c4listener_getPort(C4Listener* listener);
24 changes: 24 additions & 0 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4Log.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// C4Log.cs
//
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

using System.Runtime.InteropServices;

namespace LiteCore.Interop;

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4LogObserverCallback(C4LogEntry* entry, void* context);
36 changes: 35 additions & 1 deletion src/LiteCore/src/LiteCore.Shared/Interop/C4Log_defs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4Log_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -71,6 +71,40 @@ public bool use_plaintext
}
}
}

internal unsafe struct C4LogEntry
{
public long timestamp;
public C4LogLevel level;
public C4LogDomain domain;
public FLHeapSlice message;
}

internal unsafe struct C4DomainLevel
{
public C4LogDomain domain;
public C4LogLevel level;
}

internal unsafe struct C4LogObserverConfig
{
public C4LogLevel defaultLevel;
public C4DomainLevel* domains;
private UIntPtr _domainsCount;
public C4LogObserverCallback callback;
public void* callbackContext;
public C4LogFileOptions* fileOptions;

public ulong domainsCount
{
get {
return _domainsCount.ToUInt64();
}
set {
_domainsCount = (UIntPtr)value;
}
}
}
}

#pragma warning restore IDE0051 // Remove unused private members
28 changes: 14 additions & 14 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4Log_native.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4Log_native.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -35,19 +35,6 @@ namespace LiteCore.Interop

internal unsafe static partial class Native
{
[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool c4log_writeToBinaryFile(C4LogFileOptions options, C4Error* error);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern C4LogLevel c4log_binaryFileLevel();

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void c4log_setBinaryFileLevel(C4LogLevel level);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void c4log_writeToCallback(C4LogLevel level, C4LogCallback callback, [MarshalAs(UnmanagedType.U1)]bool preformatted);

public static string? c4log_getDomainName(C4LogDomain* x)
{
var retVal = NativeRaw.c4log_getDomainName(x);
@@ -67,6 +54,19 @@ public static void c4slog(C4LogDomain* domain, C4LogLevel level, string? msg)
}
}

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool c4log_writeToBinaryFile(C4LogFileOptions options, C4Error* error);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern C4LogLevel c4log_binaryFileLevel();

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void c4log_setBinaryFileLevel(C4LogLevel level);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void c4log_writeToCallback(C4LogLevel level, C4LogCallback callback, [MarshalAs(UnmanagedType.U1)]bool preformatted);


}

69 changes: 69 additions & 0 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4PeerSync.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using LiteCore.Util;
using System;
using System.Runtime.InteropServices;

namespace LiteCore.Interop;

/** Callback that notifies that C4PeerSync has started, failed to start, or stopped. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4PeerSync_StatusCallback(C4PeerSync* peer, ///< Sender
bool started, ///< Whether it's running or not
C4Error* err, ///< Error, if any
void* context);

/** Callback that notifies that a peer has been discovered, or is no longer visible. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4PeerSync_DiscoveryCallback(C4PeerSync* peer, ///< Sender
C4PeerID* peerID, ///< Peer's ID
bool online, ///< Is peer online?
void* context);

/** Callback that authenticates a peer based on its X.509 certificate.
This is not called when a peer is discovered, only when making a direct connection.
It should return `true` to allow the connection, `false` to prevent it. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate bool C4PeerSync_AuthenticatorCallback(C4PeerSync* peer, ///< Sender
C4PeerID* peerID, ///< Peer's ID
C4Cert* peerCert, ///< Peer's X.509 certificate
void* context);

/** Callback that notifies the status of an individual replication with one peer.
@note This is similar to \ref C4ReplicatorStatusChangedCallback, but adds the peer's ID
and indicates whether I connected to the peer or vice versa (just in case you care.) */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4PeerSync_ReplicatorCallback(C4PeerSync* peer, ///< Sender
C4PeerID* peerID, ///< Peer's ID
bool outgoing, ///< True if I opened the socket
C4ReplicatorStatus* status, ///< Status/progress
void* context);

/** Callback that notifies that documents have been pushed or pulled.
@note This is similar to \ref C4ReplicatorDocumentsEndedCallback, but adds the peer's ID. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4PeerSync_DocsCallback(C4PeerSync* peer, ///< Sender
C4PeerID* peerID, ///< Peer ID
bool pushing, ///< Direction of sync
UIntPtr numDocs, ///< Size of docs[]
C4DocumentEnded* docs, ///< Document info
void* context);

/** Callback that notifies about progress pushing or pulling a single blob.
@note This is similar to \ref C4ReplicatorBlobProgressCallback, but adds the peer's ID. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void C4PeerSync_BlobCallback(C4PeerSync* peer, ///< Sender
C4PeerID* peerID, ///< Peer ID
bool pushing, ///< Direction of transfer
C4BlobProgress* progress, ///< Progress info
void* context);

/** Replicator document validation / filtering callback.
@note This is similar to \ref C4ReplicatorValidationFunction, but adds the peer's ID. */
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate bool C4PeerSync_ValidationFunction(C4PeerSync* sender, ///< Sender
C4PeerID* peerID, ///< Peer's ID
C4CollectionSpec spec, ///< Collection
C4String docID, ///< Document ID
C4String revID, ///< Revision ID
C4RevisionFlags flags, ///< Revision flags
FLDict body, ///< Document body
void* context);
164 changes: 164 additions & 0 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4PeerSyncTypes_defs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
//
// C4PeerSyncTypes_defs.cs
//
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// --------------------------------------------------
// <auto-generated>
// This file was generated by generate_bindings.ps1
// </auto-generated>
// --------------------------------------------------

#nullable enable
#pragma warning disable IDE0051 // Remove unused private members
#pragma warning disable IDE0044 // Add readonly modifier
#pragma warning disable CS0649 // Member never assigned to
#pragma warning disable CS0169 // Member never used


using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;

using LiteCore.Util;

namespace LiteCore.Interop
{


internal unsafe struct C4PeerID
{
public fixed byte bytes[32];
}

internal unsafe struct C4PeerSyncCallbacks
{
public C4PeerSync_StatusCallback syncStatus;
public C4PeerSync_AuthenticatorCallback authenticator;
public C4PeerSync_DiscoveryCallback onPeerDiscovery;
public C4PeerSync_ReplicatorCallback onReplicatorStatusChanged;
public C4PeerSync_DocsCallback onDocumentsEnded;
public C4PeerSync_BlobCallback onBlobProgress;
public C4ReplicatorPropertyEncryptionCallback propertyEncryptor;
public C4ReplicatorPropertyDecryptionCallback propertyDecryptor;
public void* context;
}

internal unsafe struct C4PeerSyncCollection
{
public C4CollectionSpec collection;
private byte _pushEnabled;
private byte _pullEnabled;
public FLSlice optionsDictFleece;
public C4PeerSync_ValidationFunction pushFilter;
public C4PeerSync_ValidationFunction pullFilter;
public void* callbackContext;

public bool pushEnabled
{
get
{
return Convert.ToBoolean(_pushEnabled);
}
set
{
_pushEnabled = Convert.ToByte(value);
}
}

public bool pullEnabled
{
get
{
return Convert.ToBoolean(_pullEnabled);
}
set
{
_pullEnabled = Convert.ToByte(value);
}
}
}

internal unsafe struct C4PeerSyncParameters
{
public FLSlice peerGroupID;
public FLSlice protocols;
private UIntPtr _protocolsCount;
public C4Cert* tlsCert;
public C4KeyPair* tlsKeyPair;
public C4Database* database;
public C4PeerSyncCollection* collections;
private UIntPtr _collectionCount;
public FLSlice optionsDictFleece;
public C4ReplicatorProgressLevel progressLevel;
public C4PeerSyncCallbacks callbacks;

public ulong protocolsCount
{
get {
return _protocolsCount.ToUInt64();
}
set {
_protocolsCount = (UIntPtr)value;
}
}

public ulong collectionCount
{
get {
return _collectionCount.ToUInt64();
}
set {
_collectionCount = (UIntPtr)value;
}
}
}

internal unsafe struct C4PeerInfo
{
public C4Cert* certificate;
public C4PeerID* neighbors;
private UIntPtr _neighborCount;
public C4ReplicatorStatus replicatorStatus;
private byte _online;

public ulong neighborCount
{
get {
return _neighborCount.ToUInt64();
}
set {
_neighborCount = (UIntPtr)value;
}
}

public bool online
{
get {
return Convert.ToBoolean(_online);
}
set {
_online = Convert.ToByte(value);
}
}
}
}

#pragma warning restore IDE0051 // Remove unused private members
#pragma warning restore IDE0044 // Add readonly modifier
#pragma warning restore CS0649 // Member never assigned to
#pragma warning restore CS0169 // Member never used
5 changes: 5 additions & 0 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4Query.cs
Original file line number Diff line number Diff line change
@@ -43,6 +43,11 @@ public void Dispose()
if (old != IntPtr.Zero) {
Marshal.FreeHGlobal(old);
}

old = Interlocked.Exchange(ref _where, IntPtr.Zero);
if (old != IntPtr.Zero) {
Marshal.FreeHGlobal(old);
}
}
}

18 changes: 15 additions & 3 deletions src/LiteCore/src/LiteCore.Shared/Interop/C4ReplicatorTypes_defs.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// C4ReplicatorTypes_defs.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -118,6 +118,17 @@ public bool errorIsTransient
}
}

internal unsafe struct C4BlobProgress
{
public C4CollectionSpec collectionSpec;
public FLSlice docID;
public FLSlice docProperty;
public C4BlobKey blobKey;
public ulong bytesComplete;
public ulong bytesTotal;
public C4Error error;
}

internal unsafe struct C4ReplicationCollection
{
public C4CollectionSpec collection;
@@ -135,12 +146,13 @@ internal unsafe struct C4ReplicatorParameters
public IntPtr onStatusChanged;
public IntPtr onDocumentEnded;
public IntPtr onBlobProgress;
public IntPtr propertyEncryptor;
public IntPtr propertyDecryptor;
public IntPtr propertyEncryptor;
public IntPtr propertyDecryptor;
public void* callbackContext;
public C4SocketFactory* socketFactory;
public C4ReplicationCollection* collections;
public IntPtr collectionCount;
public C4KeyPair* externalKey;
}

}
4 changes: 2 additions & 2 deletions src/LiteCore/src/LiteCore.Shared/Interop/FLDoc_native.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FLDoc_native.cs
//
// Copyright (c) 2024 Couchbase, Inc All rights reserved.
// Copyright (c) 2025 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ internal unsafe static partial class Native
public static extern void FLDoc_Release(FLDoc* x);

[DllImport(Constants.DllName, CallingConvention = CallingConvention.Cdecl)]
public static extern FLValue* FLDoc_GetRoot(FLDoc* x);
public static extern FLValue* FLDoc_GetRoot(FLDoc* doc);


}
3 changes: 3 additions & 0 deletions src/LiteCore/src/LiteCore.Shared/LiteCore.Shared.projitems
Original file line number Diff line number Diff line change
@@ -44,11 +44,14 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Listener.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4ListenerTypes_defs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Listener_native.cs" />
<Compile Include="$(MSBuildThisFileDirectory)interop\C4Log.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Log_defs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Log_native.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Observer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Observer_native.cs" />
<Compile Include="$(MSBuildThisFileDirectory)interop\C4Observer_native_safe.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4PeerSync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4PeerSyncTypes_defs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4PredictiveQuery_defs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4PredictiveQuery_native.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\C4Private.cs" />