Skip to content
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

Fix CMake Not Finding URLEndpointListner Symbols #609

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
36 changes: 36 additions & 0 deletions CBL_C.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
1B21A7D92D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B21A7D82D711B29000CA0D5 /* URLEndpointListenerTest.cc */; };
1B21A7DA2D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B21A7D82D711B29000CA0D5 /* URLEndpointListenerTest.cc */; };
1B21A7DB2D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B21A7D82D711B29000CA0D5 /* URLEndpointListenerTest.cc */; };
1BC5D9602D6E3BD10080153E /* CBLURLEndpointListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 1BC5D95F2D6E3BD10080153E /* CBLURLEndpointListener.h */; };
1BC5D9612D6E3BD10080153E /* CBLURLEndpointListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 1BC5D95F2D6E3BD10080153E /* CBLURLEndpointListener.h */; };
1BC5D9662D6E4DA60080153E /* CBLURLEndpointListener_CAPI.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1BC5D9652D6E4DA60080153E /* CBLURLEndpointListener_CAPI.cc */; };
1BC5D9682D6E50960080153E /* CBLURLEndpointListener_Internal.hh in Headers */ = {isa = PBXBuildFile; fileRef = 1BC5D9672D6E50960080153E /* CBLURLEndpointListener_Internal.hh */; };
271A98B0243FDF56008C032D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 271A98AF243FDF55008C032D /* SystemConfiguration.framework */; };
271C2A3121CAC98F0045856E /* CBLReplicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 271C2A2C21CAC98F0045856E /* CBLReplicator.h */; };
271C2A3221CAC98F0045856E /* CBLBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 271C2A2D21CAC98F0045856E /* CBLBase.h */; };
Expand Down Expand Up @@ -203,6 +210,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
1B21A7D42D70E760000CA0D5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 271C2A3821CAD5950045856E /* LiteCore.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 27FC81E71EAAB0D90028E38E;
remoteInfo = "LiteCoreREST static";
};
271A989F243C0852008C032D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 271C2A3821CAD5950045856E /* LiteCore.xcodeproj */;
Expand Down Expand Up @@ -404,6 +418,10 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
1B21A7D82D711B29000CA0D5 /* URLEndpointListenerTest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = URLEndpointListenerTest.cc; sourceTree = "<group>"; };
1BC5D95F2D6E3BD10080153E /* CBLURLEndpointListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBLURLEndpointListener.h; sourceTree = "<group>"; };
1BC5D9652D6E4DA60080153E /* CBLURLEndpointListener_CAPI.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CBLURLEndpointListener_CAPI.cc; sourceTree = "<group>"; };
1BC5D9672D6E50960080153E /* CBLURLEndpointListener_Internal.hh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CBLURLEndpointListener_Internal.hh; sourceTree = "<group>"; };
2716F8F5247D9D6700BE21D9 /* exports */ = {isa = PBXFileReference; lastKnownFileType = folder; path = exports; sourceTree = "<group>"; };
271A98AF243FDF55008C032D /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
271C2A2321CAC8920045856E /* libcblite-static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcblite-static.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -699,6 +717,7 @@
406F8D6F2C17E191000223FC /* CBLQueryTypes.h */,
271C2A2C21CAC98F0045856E /* CBLReplicator.h */,
FCD829B12835ECE0004AA814 /* CBLScope.h */,
1BC5D95F2D6E3BD10080153E /* CBLURLEndpointListener.h */,
271C2A7021CAD6440045856E /* CBL_Compat.h */,
);
path = cbl;
Expand Down Expand Up @@ -732,6 +751,7 @@
27D11BFF235140E300C58A70 /* CBLReplicator_Internal.hh */,
FCC063C828588DA6000C5BD7 /* CBLScope.cc */,
FCD8299C2835AC20004AA814 /* CBLScope_Internal.hh */,
1BC5D9672D6E50960080153E /* CBLURLEndpointListener_Internal.hh */,
AE591AB729473A4400E4BDE8 /* CBLUserAgent.hh */,
42D1B68F2978AD31003B9871 /* CBLUserAgent.mm */,
27D11BEE2351043B00C58A70 /* ConflictResolver.cc */,
Expand Down Expand Up @@ -807,6 +827,7 @@
27B61D5521D5ABA60027CCDB /* CBLQuery_CAPI.cc */,
277FEE7421ED3C4900B60E3C /* CBLReplicator_CAPI.cc */,
FCD829B22835EE39004AA814 /* CBLScope_CAPI.cc */,
1BC5D9652D6E4DA60080153E /* CBLURLEndpointListener_CAPI.cc */,
4083FCAE2BA3B8B00061509D /* CBLVectorIndexConfig_CAPI.cc */,
);
name = "C Glue";
Expand Down Expand Up @@ -861,6 +882,7 @@
FC82CE0428C6E2BD001FA083 /* ReplicatorCollectionTest_Cpp.cc */,
2736A633242E5A74002B9D65 /* ReplicatorEETest.cc */,
93C70D1626CB334D0093E927 /* ReplicatorPropEncTest.cc */,
1B21A7D82D711B29000CA0D5 /* URLEndpointListenerTest.cc */,
40FE2E0F2C12AF52005E99E9 /* VectorSearchTest.hh */,
406E46D22BACAEFF0088198C /* VectorSearchTest.cc */,
400AB0412C2E669500DB6223 /* VectorSearchTest_Cpp.cc */,
Expand Down Expand Up @@ -971,6 +993,7 @@
files = (
EA34BC4C2C369895000CEA70 /* CBLPrediction.h in Headers */,
277FEE7821ED62AA00B60E3C /* CBLReplicatorConfig.hh in Headers */,
1BC5D9602D6E3BD10080153E /* CBLURLEndpointListener.h in Headers */,
9320630F26BDB408006917A5 /* CBLPlatform.h in Headers */,
4083FCB02BA3B8C50061509D /* CBLVectorIndexConfig.hh in Headers */,
27DBCF2F246B4352002FD7A7 /* CBLQuery_Internal.hh in Headers */,
Expand Down Expand Up @@ -999,6 +1022,7 @@
271C2A3421CAC98F0045856E /* CBLDatabase.h in Headers */,
FCC064122862B848000C5BD7 /* CBLBlob.h in Headers */,
271C2A3121CAC98F0045856E /* CBLReplicator.h in Headers */,
1BC5D9682D6E50960080153E /* CBLURLEndpointListener_Internal.hh in Headers */,
271C2A3221CAC98F0045856E /* CBLBase.h in Headers */,
FCB96E8529007D50001C4DED /* CBLDefaults.h in Headers */,
27886C8D21F64C1400069BEA /* Listener.hh in Headers */,
Expand Down Expand Up @@ -1035,6 +1059,7 @@
27984E332249A247000FE777 /* Blob.hh in Headers */,
400AB0532C2E66B500DB6223 /* QueryIndex.hh in Headers */,
27984E342249A247000FE777 /* Database.hh in Headers */,
1BC5D9612D6E3BD10080153E /* CBLURLEndpointListener.h in Headers */,
FCC064212862B851000C5BD7 /* CBLScope.h in Headers */,
27984E352249A247000FE777 /* Document.hh in Headers */,
27DBD0A9246CA667002FD7A7 /* CBLLog.h in Headers */,
Expand Down Expand Up @@ -1084,6 +1109,7 @@
buildRules = (
);
dependencies = (
1B21A7D52D70E760000CA0D5 /* PBXTargetDependency */,
271A98A0243C0852008C032D /* PBXTargetDependency */,
271C2A7B21CC86E10045856E /* PBXTargetDependency */,
);
Expand Down Expand Up @@ -1485,6 +1511,7 @@
"$(BUILT_PRODUCTS_DIR)/libmbedcrypto.a",
"$(BUILT_PRODUCTS_DIR)/libmbedtls.a",
"$(BUILT_PRODUCTS_DIR)/libmbedx509.a",
"$(BUILT_PRODUCTS_DIR)/libLiteCoreREST-static.a",
);
name = "Merge static libs";
outputFileListPaths = (
Expand Down Expand Up @@ -1611,6 +1638,7 @@
276633A62602815000B9BD36 /* CBLDatabase_CAPI.cc in Sources */,
27DBD098246C9DE7002FD7A7 /* CBLDatabase+Apple.mm in Sources */,
FC5FBBB52821CC2E0066157F /* CBLCollection_CAPI.cc in Sources */,
1BC5D9662D6E4DA60080153E /* CBLURLEndpointListener_CAPI.cc in Sources */,
275BC4DE2201323700DBE7D2 /* CBLBlob_CAPI.cc in Sources */,
4083FCAF2BA3B8B00061509D /* CBLVectorIndexConfig_CAPI.cc in Sources */,
271C2A7821CC750E0045856E /* CBLDocument.cc in Sources */,
Expand Down Expand Up @@ -1638,6 +1666,7 @@
files = (
40E32F432D2F45A3000CED57 /* LogTest_Cpp.cc in Sources */,
93965A6426A7CD50008728EE /* LogTest.cc in Sources */,
1B21A7DB2D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */,
275B3599234C158900FE9CF0 /* CouchbaseLiteTests.mm in Sources */,
275B358E23481D0C00FE9CF0 /* CBLTest.c in Sources */,
FC645E2E29088211007D5536 /* Platform_Apple.mm in Sources */,
Expand Down Expand Up @@ -1689,6 +1718,7 @@
27B61DAF21D6E4B70027CCDB /* CBLTest.cc in Sources */,
FCD8298C283591D4004AA814 /* CollectionTest.cc in Sources */,
FC645E2D29088211007D5536 /* Platform_Apple.mm in Sources */,
1B21A7DA2D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */,
93C70D3426D01B5A0093E927 /* BlobTest.cc in Sources */,
27B61DB921D6ECA70027CCDB /* DatabaseTest.cc in Sources */,
277FEE5321E6BCA500B60E3C /* DatabaseTest_Cpp.cc in Sources */,
Expand Down Expand Up @@ -1731,6 +1761,7 @@
FC645E1D29085CBF007D5536 /* CBLTest.c in Sources */,
FCE497C02907959400EF2354 /* LibC++Debug.cc in Sources */,
FC645E1229085C2E007D5536 /* CollectionTest_Cpp.cc in Sources */,
1B21A7D92D711B29000CA0D5 /* URLEndpointListenerTest.cc in Sources */,
FC645E2C29087777007D5536 /* Platform_Apple.mm in Sources */,
FC645E0E29085C05007D5536 /* CollectionTest.cc in Sources */,
FC645E1B29085C87007D5536 /* ReplicatorEETest.cc in Sources */,
Expand All @@ -1752,6 +1783,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
1B21A7D52D70E760000CA0D5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "LiteCoreREST static";
targetProxy = 1B21A7D42D70E760000CA0D5 /* PBXContainerItemProxy */;
};
271A98A0243C0852008C032D /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = LiteCoreWebSocket;
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ set(
src/CBLReplicator_CAPI.cc
src/CBLScope.cc
src/CBLScope_CAPI.cc
src/CBLURLEndpointListener_CAPI.cc
src/CBLVectorIndexConfig_CAPI.cc
src/ConflictResolver.cc
src/ContextManager.cc
Expand Down Expand Up @@ -191,8 +192,9 @@ set(CBL_LIBRARIES_PRIVATE
${WHOLE_LIBRARY_FLAG}
cblite-static
${NO_WHOLE_LIBRARY_FLAG}
LiteCoreWebSocket
LiteCoreObjects
LiteCoreREST_Objects
LiteCoreWebSocket
FleeceObjects
BLIPObjects
)
Expand Down
110 changes: 110 additions & 0 deletions include/cbl/CBLURLEndpointListener.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// CBLURLEndpointListener.h
// CBL_C
//
// Created by Pasin Suriyentrakorn on 2/19/25.
// Copyright © 2025 Couchbase. All rights reserved.
//

#pragma once
#include "CBLBase.h"

#ifdef COUCHBASE_ENTERPRISE

CBL_CAPI_BEGIN

/** An opaque object representing the listener authenticator. */
typedef struct CBLListenerAuthenticator CBLListenerAuthenticator;

/** Password authenticator callback for verifying client credentials when the HTTP Basic Authentication is used. */
typedef bool (*CBLListenerPasswordAuthCallback) (
void* context, ///< URLEndpointListener’s context
FLString username, ///< Username
FLString password ///< Password
);

/** Creates a password authenticatorfor verifying client credentials when the HTTP Basic Authentication is used. */
_cbl_warn_unused CBLListenerAuthenticator* CBLListenerAuth_CreatePassword(CBLListenerPasswordAuthCallback auth) CBLAPI;

/** Certificate authenticator callback for verifying client certificate when the TLS client certificate authentication is used. */
typedef bool (*CBLListenerCertAuthCallback) (
void* context, ///< URLEndpointListener’s context
FLSlice cert ///< Certificate data
);

/** Creates a certificate authenticator for verifying client certificate when the TLS client certificate authentication is used. */
_cbl_warn_unused CBLListenerAuthenticator* CBLListenerAuth_CreateCertificate(CBLListenerCertAuthCallback auth) CBLAPI;

/** Frees a CBLListenerAuthenticator object. */
void CBLListenerAuth_Free(CBLListenerAuthenticator* _cbl_nullable) CBLAPI;

/** The configuration for the URLEndpointListener. */
typedef struct {
/** Arbitrary value that will be passed to the authenticator callback. */
void* _cbl_nullable context;

/** (Required) The collections available for replication . */
CBLCollection* _cbl_nonnull * _cbl_nullable collections;

/** (Required) The number of collections (Required). */
size_t collectionCount;

/** The port that the listener will listen to. Default value is zero which means that the listener will automatically
select an available port to listen to when the listener is started. */
uint16_t port;

/** The network interface in the form of the IP Address or network interface name such as en0 that the listener will
listen to. The default value is null slice which means that the listener will listen to all network interfaces. */
FLString networkInterface;

/** Disable TLS communication. The default value is false which means that TLS will be enabled by default. */
bool disableTLS;

/** The authenticator used by the listener to authenticate clients. */
CBLListenerAuthenticator* authenticator;

/** Allow delta sync when replicating with the listener. The default value is false. */
bool enableDeltaSync;

/** Allow only pull replication to pull changes from the listener. The default value is false. */
bool readOnly;
} CBLURLEndpointListenerConfiguration;

/** An opaque object representing the listener. */
typedef struct CBLURLEndpointListener CBLURLEndpointListener;

CBL_REFCOUNTED(CBLURLEndpointListener*, URLEndpointListener);

/** Creates a URL endpoint listener with the given configuration. */
_cbl_warn_unused CBLURLEndpointListener* _cbl_nullable CBLURLEndpointListener_Create(const CBLURLEndpointListenerConfiguration*, CBLError* _cbl_nullable outError) CBLAPI;

/** Frees a CBLURLEndpointListener object. */
void CBLURLEndpointListener_Free(CBLURLEndpointListener* _cbl_nullable) CBLAPI;

/** Gets the listener's configuration. */
const CBLURLEndpointListenerConfiguration* CBLURLEndpointListener_Config(const CBLURLEndpointListener*) CBLAPI;

/** The listening port of the listener. If the listener is not started, the port will be zero. */
uint16_t CBLURLEndpointListener_Port(const CBLURLEndpointListener*) CBLAPI;

/** The possible URLs of the listener. If the listener is not started, NULL will be returned. */
FLMutableArray CBLURLEndpointListener_Urls(const CBLURLEndpointListener*) CBLAPI;

/** The connection status of the listener */
typedef struct {
uint64_t connectionCount; ///< The total number of connections.
uint64_t activeConnectionCount; ///< The number of the connections that are in active or busy state.
} CBLConnectionStatus;

/** Gets the current connection status of the listener. */
CBLConnectionStatus CBLURLEndpointListener_Status(const CBLURLEndpointListener*) CBLAPI;

/** Starts the listener. */
bool CBLURLEndpointListener_Start(CBLURLEndpointListener*, CBLError* _cbl_nullable outError) CBLAPI;

/** Stops the listener. */
void CBLURLEndpointListener_Stop(CBLURLEndpointListener*) CBLAPI;

CBL_CAPI_END

#endif
1 change: 1 addition & 0 deletions include/cbl/CouchbaseLite.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
#include "CBLQueryTypes.h"
#include "CBLReplicator.h"
#include "CBLScope.h"
#include "CBLURLEndpointListener.h"
85 changes: 85 additions & 0 deletions src/CBLURLEndpointListener_CAPI.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// CBLURLEndoiubtListeber_CAPI.cc
//
// Copyright © 2025 Couchbase. 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.
//

#include "CBLURLEndpointListener_Internal.hh"

#ifdef COUCHBASE_ENTERPRISE

CBLListenerAuthenticator* CBLListenerAuth_CreatePassword(CBLListenerPasswordAuthCallback auth) noexcept {
return nullptr;
}

CBLListenerAuthenticator* CBLListenerAuth_CreateCertificate(CBLListenerCertAuthCallback auth) noexcept {
return nullptr;
}

void CBLListenerAuth_Free(CBLListenerAuthenticator* _cbl_nullable auth) noexcept {
delete auth;
}

CBLURLEndpointListener* CBLURLEndpointListener_Create(const CBLURLEndpointListenerConfiguration* conf, CBLError* outError) noexcept {
if (conf->collectionCount == 0) {
if (outError) {
outError->domain = kCBLDomain;
outError->code = kCBLErrorInvalidParameter;
}
return nullptr;
}
try {
return retain(new CBLURLEndpointListener(*conf));
} catchAndBridge(outError);
}

void CBLURLEndpointListener_Free(CBLURLEndpointListener* listener) noexcept {
if (!listener) return;
try {
release(listener);
} catchAndWarnNoReturn()
}

const CBLURLEndpointListenerConfiguration* CBLURLEndpointListener_Config(const CBLURLEndpointListener* listener) noexcept {
return listener->configuration();
}

uint16_t CBLURLEndpointListener_Port(const CBLURLEndpointListener* listener) noexcept {
return listener->port();
}

FLMutableArray CBLURLEndpointListener_Urls(const CBLURLEndpointListener* listener) noexcept {
try {
return listener->getUrls();
} catchAndBridge(nullptr)
}

CBLConnectionStatus CBLURLEndpointListener_Status(const CBLURLEndpointListener* listener) noexcept {
return listener->getConnectionStatus();
}

bool CBLURLEndpointListener_Start(CBLURLEndpointListener* listener, CBLError* outError) noexcept {
try {
return listener->start(outError);
} catchAndBridge(outError)
}

void CBLURLEndpointListener_Stop(CBLURLEndpointListener* listener) noexcept {
try {
listener->stop();
} catchAndWarnNoReturn()
}

#endif
Loading
Loading