diff --git a/example/client-cpp-example/src/CMakeLists.txt b/example/client-cpp-example/src/CMakeLists.txt
index 6d87631ab576b..1ee249bfb803e 100644
--- a/example/client-cpp-example/src/CMakeLists.txt
+++ b/example/client-cpp-example/src/CMakeLists.txt
@@ -28,12 +28,23 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/thrift/include)
# Add cpp-client include directory
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
-FIND_PACKAGE(OpenSSL REQUIRED)
-IF(OpenSSL_FOUND)
- MESSAGE(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
+# =========================
+# SSL option (default OFF)
+# =========================
+option(WITH_SSL "Build with SSL support" OFF)
+
+IF(WITH_SSL)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ IF(OpenSSL_FOUND)
+ MESSAGE(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
+ INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
+ ADD_DEFINITIONS(-DWITH_SSL=1)
+ ELSE()
+ MESSAGE(FATAL_ERROR "OpenSSL not found, but WITH_SSL is enabled")
+ ENDIF()
ELSE()
- MESSAGE(FATAL_ERROR "OpenSSL not found")
+ MESSAGE(STATUS "Building without SSL support")
+ ADD_DEFINITIONS(-DWITH_SSL=0)
ENDIF()
FIND_PACKAGE(Boost REQUIRED)
@@ -50,53 +61,91 @@ ADD_EXECUTABLE(TableModelSessionExample TableModelSessionExample.cpp)
ADD_EXECUTABLE(MultiSvrNodeClient MultiSvrNodeClient.cpp)
IF(MSVC)
- TARGET_LINK_LIBRARIES(SessionExample
- iotdb_session
- "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
- iotdb_session
- "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(TableModelSessionExample
- iotdb_session
- "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(MultiSvrNodeClient
- iotdb_session
- "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
- OpenSSL::SSL
- OpenSSL::Crypto
- )
+ IF(WITH_SSL)
+ TARGET_LINK_LIBRARIES(SessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(TableModelSessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(MultiSvrNodeClient
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ ELSE()
+ TARGET_LINK_LIBRARIES(SessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ )
+ TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ )
+ TARGET_LINK_LIBRARIES(TableModelSessionExample
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ )
+ TARGET_LINK_LIBRARIES(MultiSvrNodeClient
+ iotdb_session
+ "${CMAKE_SOURCE_DIR}/thrift/lib/Release/thriftmd.lib"
+ )
+ ENDIF()
ELSE()
- TARGET_LINK_LIBRARIES(SessionExample
- iotdb_session
- pthread
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
- iotdb_session
- pthread
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(TableModelSessionExample
- iotdb_session
- pthread
- OpenSSL::SSL
- OpenSSL::Crypto
- )
- TARGET_LINK_LIBRARIES(MultiSvrNodeClient
- iotdb_session
- pthread
- OpenSSL::SSL
- OpenSSL::Crypto
- )
-ENDIF()
\ No newline at end of file
+ IF(WITH_SSL)
+ TARGET_LINK_LIBRARIES(SessionExample
+ iotdb_session
+ pthread
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
+ iotdb_session
+ pthread
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(TableModelSessionExample
+ iotdb_session
+ pthread
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ TARGET_LINK_LIBRARIES(MultiSvrNodeClient
+ iotdb_session
+ pthread
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ ELSE()
+ TARGET_LINK_LIBRARIES(SessionExample
+ iotdb_session
+ pthread
+ )
+ TARGET_LINK_LIBRARIES(AlignedTimeseriesSessionExample
+ iotdb_session
+ pthread
+ )
+ TARGET_LINK_LIBRARIES(TableModelSessionExample
+ iotdb_session
+ pthread
+ )
+ TARGET_LINK_LIBRARIES(MultiSvrNodeClient
+ iotdb_session
+ pthread
+ )
+ ENDIF()
+ENDIF()
diff --git a/iotdb-client/client-cpp/pom.xml b/iotdb-client/client-cpp/pom.xml
index c307c651fba8b..bf0f92204e41e 100644
--- a/iotdb-client/client-cpp/pom.xml
+++ b/iotdb-client/client-cpp/pom.xml
@@ -38,6 +38,7 @@
${project.build.directory}/dependency/cmake/
${project.build.directory}/thrift/bin/${thrift.executable}
${ctest.skip.tests}
+ false
@@ -217,6 +218,7 @@
${project.build.directory}/build/main
+
@@ -233,6 +235,7 @@
${project.build.directory}/build/test
+
diff --git a/iotdb-client/client-cpp/src/main/CMakeLists.txt b/iotdb-client/client-cpp/src/main/CMakeLists.txt
index 7945cd887d37f..8119c3830f4b7 100644
--- a/iotdb-client/client-cpp/src/main/CMakeLists.txt
+++ b/iotdb-client/client-cpp/src/main/CMakeLists.txt
@@ -26,13 +26,23 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g -O2 ")
# Add Thrift include directory
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../thrift/include)
-# Find OpenSSL Library
-FIND_PACKAGE(OpenSSL REQUIRED)
-IF(OpenSSL_FOUND)
- MESSAGE(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
+# =========================
+# SSL option (default OFF)
+# =========================
+option(WITH_SSL "Build with SSL support" OFF)
+
+IF(WITH_SSL)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ IF(OpenSSL_FOUND)
+ MESSAGE(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
+ INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
+ ADD_DEFINITIONS(-DWITH_SSL=1)
+ ELSE()
+ MESSAGE(FATAL_ERROR "OpenSSL not found, but WITH_SSL is enabled")
+ ENDIF()
ELSE()
- MESSAGE(FATAL_ERROR "OpenSSL not found")
+ MESSAGE(STATUS "Building without SSL support")
+ ADD_DEFINITIONS(-DWITH_SSL=0)
ENDIF()
# Add Boost include path for MacOS
@@ -51,8 +61,8 @@ ELSE()
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT MSVC)
- add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
- add_link_options(-fsanitize=address)
+ #add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
+ #add_link_options(-fsanitize=address)
ENDIF()
# Add the generated source files to the sources for the library.
@@ -63,10 +73,20 @@ ELSE()
ADD_LIBRARY(iotdb_session SHARED ${SESSION_SRCS})
ENDIF()
-# Link with Thrift static library
-target_link_libraries(iotdb_session
- PUBLIC
- OpenSSL::SSL
- OpenSSL::Crypto
- ${THRIFT_STATIC_LIB}
-)
+# =========================
+# Link libraries (SSL optional)
+# =========================
+IF(WITH_SSL)
+ target_link_libraries(iotdb_session
+ PUBLIC
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ ${THRIFT_STATIC_LIB}
+ )
+ELSE()
+ target_link_libraries(iotdb_session
+ PUBLIC
+ ${THRIFT_STATIC_LIB}
+ )
+ENDIF()
+
diff --git a/iotdb-client/client-cpp/src/main/SessionC.cpp b/iotdb-client/client-cpp/src/main/SessionC.cpp
new file mode 100644
index 0000000000000..1c502b0fac93f
--- /dev/null
+++ b/iotdb-client/client-cpp/src/main/SessionC.cpp
@@ -0,0 +1,1417 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 "SessionC.h"
+#include "Session.h"
+#include "TableSession.h"
+#include "TableSessionBuilder.h"
+#include "SessionBuilder.h"
+#include "SessionDataSet.h"
+
+#include
+#include
+#include
+#include