implemented basics
This commit is contained in:
		
							
								
								
									
										45
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										45
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -6,6 +6,7 @@ __pycache__/ | |||||||
|  |  | ||||||
| # C extensions | # C extensions | ||||||
| *.so | *.so | ||||||
|  | *.o | ||||||
|  |  | ||||||
| # Distribution / packaging | # Distribution / packaging | ||||||
| .Python | .Python | ||||||
| @@ -102,3 +103,47 @@ database.config | |||||||
| ### vim | ### vim | ||||||
| # | # | ||||||
| *.swp | *.swp | ||||||
|  | compile_commands.json | ||||||
|  |  | ||||||
|  | ### Scons | ||||||
|  | # | ||||||
|  | .sconsign.dblite | ||||||
|  |  | ||||||
|  | ### Kdevelop | ||||||
|  | # | ||||||
|  | *.kdev4 | ||||||
|  |  | ||||||
|  | ### C++ | ||||||
|  | # | ||||||
|  | # Prerequisites | ||||||
|  | *.d | ||||||
|  |  | ||||||
|  | # Compiled Object files | ||||||
|  | *.slo | ||||||
|  | *.lo | ||||||
|  | *.o | ||||||
|  | *.obj | ||||||
|  |  | ||||||
|  | # Precompiled Headers | ||||||
|  | *.gch | ||||||
|  | *.pch | ||||||
|  |  | ||||||
|  | # Compiled Dynamic libraries | ||||||
|  | *.so | ||||||
|  | *.dylib | ||||||
|  | *.dll | ||||||
|  |  | ||||||
|  | # Fortran module files | ||||||
|  | *.mod | ||||||
|  | *.smod | ||||||
|  |  | ||||||
|  | # Compiled Static libraries | ||||||
|  | *.lai | ||||||
|  | *.la | ||||||
|  | *.a | ||||||
|  | *.lib | ||||||
|  |  | ||||||
|  | # Executables | ||||||
|  | *.exe | ||||||
|  | *.out | ||||||
|  | *.app | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | [submodule "contrib/mongocxx/mongo-cxx-driver"] | ||||||
|  | 	path = contrib/mongocxx/mongo-cxx-driver | ||||||
|  | 	url = https://github.com/mongodb/mongo-cxx-driver.git | ||||||
|  | 	branch = releases/stable | ||||||
|  |  | ||||||
|  | [submodule "contrib/iniParser/inih"] | ||||||
|  | 	path = contrib/iniParser/inih | ||||||
|  | 	url = https://github.com/benhoyt/inih.git | ||||||
							
								
								
									
										124
									
								
								SConstruct
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								SConstruct
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,124 @@ | |||||||
|  | import os | ||||||
|  |  | ||||||
|  | globalEnv = Environment() | ||||||
|  |  | ||||||
|  | globalEnv["ROOTPATH"] = os.path.abspath('.') | ||||||
|  |  | ||||||
|  | basicBuildPath = os.path.join(globalEnv['ROOTPATH'], 'build') | ||||||
|  | globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'release') | ||||||
|  |  | ||||||
|  | globalEnv['CONTRIBPATH'] = os.path.join(globalEnv['ROOTPATH'], 'contrib') | ||||||
|  | globalEnv['MONGOCPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongoc') | ||||||
|  | globalEnv['MONGOCXXPATH'] = os.path.join(globalEnv['CONTRIBPATH'], 'mongocxx') | ||||||
|  | globalEnv["INIHSRC"] = os.path.join( | ||||||
|  | 					   os.path.join(globalEnv["CONTRIBPATH"], | ||||||
|  | 								   "iniParser"),  | ||||||
|  | 								   "inih") | ||||||
|  | globalEnv["INIHCPPSRC"] = os.path.join(globalEnv["INIHSRC"], "cpp") | ||||||
|  | globalEnv["MINISATSRC"] = os.path.join( | ||||||
|  | 						   os.path.join(globalEnv["CONTRIBPATH"], | ||||||
|  | 									   "minisat"),  | ||||||
|  | 									   "src") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #compiler option | ||||||
|  | AddOption('--dbg', action='store_true', dest='DEBUG') | ||||||
|  |  | ||||||
|  | if GetOption('DEBUG'): | ||||||
|  | 	globalEnv.Append(CCFLAGS="-g") | ||||||
|  | 	globalEnv['BUILDPATH'] = os.path.join(basicBuildPath, 'debug') | ||||||
|  |  | ||||||
|  | globalEnv.Append(CXXFLAGS='-std=c++11') | ||||||
|  | AddOption("--init", action="store_true", dest="INIT") | ||||||
|  |  | ||||||
|  | #build libs | ||||||
|  | # | ||||||
|  |  | ||||||
|  | globalEnv['LIB_BUILD_PATH'] = os.path.join(globalEnv['BUILDPATH'], 'libs') | ||||||
|  |  | ||||||
|  | #build mongoc | ||||||
|  | globalEnv['MONGOC_LIB_PATH'] = os.path.join(globalEnv['LIB_BUILD_PATH'], 'mongoc') | ||||||
|  |  | ||||||
|  | if GetOption("INIT"): | ||||||
|  | 	globalEnv.SConscript(os.path.join( | ||||||
|  |     	   		         os.path.join(globalEnv['CONTRIBPATH'], | ||||||
|  |         	     		              'mongoc'), | ||||||
|  |             	             		  'SConscript'), | ||||||
|  | 	   					 variant_dir=globalEnv['MONGOC_LIB_PATH'], | ||||||
|  | 	                	 duplicate=0, | ||||||
|  | 	        	         exports='globalEnv') | ||||||
|  |  | ||||||
|  | #build mongocxx | ||||||
|  | globalEnv["MONGOCXX_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "mongocxx") | ||||||
|  |  | ||||||
|  | if GetOption("INIT"): | ||||||
|  | 	globalEnv.SConscript(os.path.join( | ||||||
|  | 						 os.path.join(globalEnv["CONTRIBPATH"], | ||||||
|  | 									  "mongocxx"), | ||||||
|  | 									  "SConscript"), | ||||||
|  | 						 variant_dir=globalEnv["MONGOCXX_LIB_PATH"], | ||||||
|  | 						 duplicate=0, | ||||||
|  | 						 exports="globalEnv") | ||||||
|  |  | ||||||
|  | #build inih | ||||||
|  | globalEnv["INIH_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "inih") | ||||||
|  |  | ||||||
|  | globalEnv.SConscript(os.path.join( | ||||||
|  | 					 os.path.join(globalEnv["CONTRIBPATH"], | ||||||
|  | 								  "iniParser"), | ||||||
|  | 								  "SConscript"), | ||||||
|  | 					  variant_dir=globalEnv["INIH_LIB_PATH"], | ||||||
|  | 					  duplicate=0, | ||||||
|  | 					  exports="globalEnv") | ||||||
|  |  | ||||||
|  | #build minisat | ||||||
|  | globalEnv["MINISAT_LIB_PATH"] = os.path.join(globalEnv["LIB_BUILD_PATH"], "minisat") | ||||||
|  |  | ||||||
|  | globalEnv.SConscript(os.path.join( | ||||||
|  | 					 os.path.join(globalEnv["CONTRIBPATH"], | ||||||
|  | 								  "minisat"), | ||||||
|  | 								  "SConscript"), | ||||||
|  | 					  variant_dir=globalEnv["MINISAT_LIB_PATH"], | ||||||
|  | 					  duplicate=0, | ||||||
|  | 					  exports="globalEnv") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | mongocxxIncludeDir = os.path.join( | ||||||
|  | 					 os.path.join( | ||||||
|  | 					 os.path.join(globalEnv["MONGOCXX_LIB_PATH"], | ||||||
|  | 								 "include"), | ||||||
|  | 								 "mongocxx"), | ||||||
|  | 								 "v_noabi") | ||||||
|  |  | ||||||
|  | bsoncxxIncludeDir = os.path.join( | ||||||
|  | 				    os.path.join( | ||||||
|  | 					os.path.join(globalEnv["MONGOCXX_LIB_PATH"], | ||||||
|  | 								"include"), | ||||||
|  | 								"bsoncxx"), | ||||||
|  | 								"v_noabi") | ||||||
|  |  | ||||||
|  | inihIncludeDir = globalEnv["INIHSRC"] | ||||||
|  | inihcppIncludeDir = globalEnv["INIHCPPSRC"] | ||||||
|  |  | ||||||
|  | minisatIncludeDir = globalEnv["MINISATSRC"] | ||||||
|  |  | ||||||
|  | globalEnv.Append(CPPPATH=[mongocxxIncludeDir, | ||||||
|  | 						  bsoncxxIncludeDir, | ||||||
|  | 						  inihIncludeDir, | ||||||
|  | 						  inihcppIncludeDir, | ||||||
|  | 						  minisatIncludeDir]) | ||||||
|  |  | ||||||
|  | globalEnv.Append(LIBPATH=[os.path.join(globalEnv["MONGOCXX_LIB_PATH"], "lib"), | ||||||
|  | 						  globalEnv["INIH_LIB_PATH"], | ||||||
|  | 						  globalEnv["MINISAT_LIB_PATH"]]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #build runMinisat | ||||||
|  | globalEnv.SConscript(os.path.join( | ||||||
|  | 				     os.path.join(globalEnv['ROOTPATH'], | ||||||
|  | 								 'src'), | ||||||
|  | 								 'SConscript'), | ||||||
|  | 					 variant_dir=globalEnv['BUILDPATH'], | ||||||
|  |                      duplicate=0, | ||||||
|  |                      exports='globalEnv') | ||||||
|  | 	 | ||||||
							
								
								
									
										12
									
								
								contrib/iniParser/SConscript
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								contrib/iniParser/SConscript
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | import os | ||||||
|  |  | ||||||
|  | Import("globalEnv") | ||||||
|  |  | ||||||
|  | env = globalEnv.Clone() | ||||||
|  |  | ||||||
|  | env.Append(CPPPATH=[env["INIHCPPSRC"], env["INIHSRC"]]) | ||||||
|  |  | ||||||
|  | files = Glob(os.path.join(env["INIHCPPSRC"], "*.cpp")) | ||||||
|  | files.append(Glob(os.path.join(env["INIHSRC"], "*.c"))) | ||||||
|  |  | ||||||
|  | env.Library(target="inihcpp", source=files) | ||||||
							
								
								
									
										1
									
								
								contrib/iniParser/inih
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								contrib/iniParser/inih
									
									
									
									
									
										Submodule
									
								
							 Submodule contrib/iniParser/inih added at 2023872dff
									
								
							
							
								
								
									
										24
									
								
								contrib/minisat/SConscript
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								contrib/minisat/SConscript
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | import os | ||||||
|  |  | ||||||
|  | Import("globalEnv") | ||||||
|  |  | ||||||
|  | env = globalEnv.Clone() | ||||||
|  |  | ||||||
|  | env.Append(CPPPATH=[env["MINISATSRC"]]) | ||||||
|  |  | ||||||
|  | files = Glob(os.path.join( | ||||||
|  |              os.path.join(env["MINISATSRC"],  | ||||||
|  | 						  "core"), | ||||||
|  | 						  "*.cc")) | ||||||
|  |  | ||||||
|  | files.append(Glob(os.path.join( | ||||||
|  |              	  os.path.join(env["MINISATSRC"],  | ||||||
|  | 							  "simp"), | ||||||
|  | 							  "*.cc"))) | ||||||
|  |  | ||||||
|  | files.append(Glob(os.path.join( | ||||||
|  |              	  os.path.join(env["MINISATSRC"],  | ||||||
|  | 							  "util"), | ||||||
|  | 							  "*.cc"))) | ||||||
|  |  | ||||||
|  | env.Library(target="minisat", source=files) | ||||||
							
								
								
									
										36
									
								
								contrib/mongoc/SConscript
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								contrib/mongoc/SConscript
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | |||||||
|  | import os | ||||||
|  | import subprocess | ||||||
|  |  | ||||||
|  | Import('globalEnv') | ||||||
|  |  | ||||||
|  | env = globalEnv.Clone() | ||||||
|  |  | ||||||
|  | env['MONGOC_1_13_1_PATH'] = os.path.join(env['MONGOCPATH'], 'mongo-c-driver-1.13.1') | ||||||
|  |  | ||||||
|  | cmake_build_path = os.path.join(env['MONGOC_LIB_PATH'], 'cmake_build') | ||||||
|  |  | ||||||
|  | if not os.path.exists(cmake_build_path): | ||||||
|  | 	os.makedirs(cmake_build_path) | ||||||
|  |  | ||||||
|  | if not os.path.exists(env["MONGOC_LIB_PATH"]): | ||||||
|  | 	os.makedirs(env["MONGOC_LIB_PATH"]) | ||||||
|  |  | ||||||
|  | cwd = os.getcwd() | ||||||
|  |  | ||||||
|  | os.chdir(cmake_build_path) | ||||||
|  |  | ||||||
|  | cmakeCall = "cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF " | ||||||
|  | cmakeCall += "-DCMAKE_INSTALL_PREFIX=" + env["MONGOC_LIB_PATH"] + " " | ||||||
|  | cmakeCall += env["MONGOC_1_13_1_PATH"] | ||||||
|  |  | ||||||
|  | print(cmakeCall) | ||||||
|  |  | ||||||
|  | os.system(cmakeCall) | ||||||
|  |  | ||||||
|  | os.system("make") | ||||||
|  |  | ||||||
|  | os.system("make install") | ||||||
|  |  | ||||||
|  | os.chdir(cwd) | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										361
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										361
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,361 @@ | |||||||
|  | cmake_minimum_required (VERSION 3.1) | ||||||
|  |  | ||||||
|  | # Used in MaintainerFlags.cmake to silence errors while testing configs. | ||||||
|  | set (MESSAGES_ENABLED 1) | ||||||
|  |  | ||||||
|  | function (message) | ||||||
|  |    list (GET ARGV 0 MessageType) | ||||||
|  |    if (MESSAGES_ENABLED) | ||||||
|  |       list (REMOVE_AT ARGV 0) | ||||||
|  |       _message (${MessageType} "${ARGV}") | ||||||
|  |    endif () | ||||||
|  | endfunction () | ||||||
|  |  | ||||||
|  | set (ENABLE_SSL AUTO CACHE STRING | ||||||
|  |    "Enable TLS connections and SCRAM-SHA-1 authentication. Options are | ||||||
|  |    \"DARWIN\" to use Apple's Secure Transport, \"WINDOWS\" to use Windows | ||||||
|  |    Secure Channel, \"OPENSSL\", \"LIBRESSL\", \"AUTO\",\ or \"OFF\". These options are | ||||||
|  |    case-sensitive. The default is \"AUTO\". Note\ that SCRAM-SHA-1 is | ||||||
|  |    required for authenticating to MongoDB 3.0 and later.") | ||||||
|  |  | ||||||
|  | set (ENABLE_SASL AUTO CACHE STRING | ||||||
|  |    "Enable SASL authentication (Kerberos). Options are \"CYRUS\" to use Cyrus | ||||||
|  |    SASL, \"SSPI\" to use Windows Native SSPI, \"GSSAPI\" to use macOS Native GSS, | ||||||
|  |    \"AUTO\",\ or \"OFF\". These options are case-sensitive.") | ||||||
|  |  | ||||||
|  | set (ENABLE_STATIC AUTO CACHE STRING "Build static libmongoc. Set to ON/AUTO/OFF, default AUTO.") | ||||||
|  | option (ENABLE_TESTS "Build MongoDB C Driver tests." ON) | ||||||
|  | option (ENABLE_EXAMPLES "Build MongoDB C Driver examples." ON) | ||||||
|  | set (ENABLE_SRV AUTO CACHE STRING "Support mongodb+srv URIs. Set to ON/AUTO/OFF, default AUTO.") | ||||||
|  | option (ENABLE_MAINTAINER_FLAGS "Use strict compiler checks" OFF) | ||||||
|  | option (ENABLE_AUTOMATIC_INIT_AND_CLEANUP "Enable automatic init and cleanup (GCC only)" ON) | ||||||
|  | option (ENABLE_CRYPTO_SYSTEM_PROFILE "Use system crypto profile (OpenSSL only)" OFF) | ||||||
|  | option (ENABLE_TRACING "Turn on verbose debug output" OFF) | ||||||
|  | option (ENABLE_COVERAGE "Turn on compile options for lcov" OFF) | ||||||
|  | set (ENABLE_SHM_COUNTERS AUTO CACHE STRING "Enable memory performance counters that use shared memory on Linux. Set to ON/AUTO/OFF, default AUTO.") | ||||||
|  | set (ENABLE_MONGOC ON CACHE STRING "Whether to build libmongoc. Set to ON/OFF, default ON.") | ||||||
|  | set (ENABLE_BSON AUTO CACHE STRING "Whether to build libbson. Set to ON/AUTO/SYSTEM, default AUTO.") | ||||||
|  | set (ENABLE_SNAPPY AUTO CACHE STRING "Enable snappy support. Set to ON/AUTO/OFF, default AUTO.") | ||||||
|  | set (ENABLE_ZLIB AUTO CACHE STRING "Enable zlib support") | ||||||
|  | option (ENABLE_MAN_PAGES "Build MongoDB C Driver manual pages." OFF) | ||||||
|  | option (ENABLE_HTML_DOCS "Build MongoDB C Driver HTML documentation." OFF) | ||||||
|  | option (ENABLE_EXTRA_ALIGNMENT | ||||||
|  |    "Turn on extra alignment of libbson types. Set to ON/OFF, default ON.\ | ||||||
|  |  Required for the 1.0 ABI but better disabled." | ||||||
|  |    ON | ||||||
|  | ) | ||||||
|  | option (ENABLE_RDTSCP | ||||||
|  |    "Fast performance counters on Intel using the RDTSCP instruction" | ||||||
|  |    OFF | ||||||
|  | ) | ||||||
|  | option (ENABLE_APPLE_FRAMEWORK "Build libraries as frameworks on darwin platforms" OFF)  | ||||||
|  | set (ENABLE_ICU AUTO CACHE STRING "Enable ICU support, necessary to use non-ASCII usernames or passwords, default AUTO.") | ||||||
|  | option (ENABLE_UNINSTALL "Enable creation of uninstall script and associate uninstall build target." ON) | ||||||
|  |  | ||||||
|  | project (mongo-c-driver C) | ||||||
|  |  | ||||||
|  | if (NOT CMAKE_BUILD_TYPE) | ||||||
|  |    set (CMAKE_BUILD_TYPE "RelWithDebInfo") | ||||||
|  |    message ( | ||||||
|  |       STATUS "No CMAKE_BUILD_TYPE selected, defaulting to ${CMAKE_BUILD_TYPE}" | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | set (CMAKE_MODULE_PATH | ||||||
|  |    ${CMAKE_MODULE_PATH} | ||||||
|  |    ${PROJECT_SOURCE_DIR}/build/cmake | ||||||
|  |    ${PROJECT_SOURCE_DIR}/build/cmake/make_dist | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | include (InstallRequiredSystemLibraries) | ||||||
|  | include (GNUInstallDirs) | ||||||
|  |  | ||||||
|  | # Set MONGOC_MAJOR_VERSION, MONGOC_MINOR_VERSION, etc. | ||||||
|  | include (LoadVersion) | ||||||
|  | LoadVersion (${PROJECT_SOURCE_DIR}/VERSION_CURRENT MONGOC) | ||||||
|  | LoadVersion (${PROJECT_SOURCE_DIR}/VERSION_RELEASED MONGOC_RELEASED) | ||||||
|  |  | ||||||
|  | include (MaintainerFlags) | ||||||
|  |  | ||||||
|  | if ( (ENABLE_BUILD_DEPENDECIES STREQUAL OFF) AND (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) ) | ||||||
|  |    set (ENABLE_BUILD_DEPENDECIES ON) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_EXTRA_ALIGNMENT STREQUAL ON) | ||||||
|  |    set (BSON_EXTRA_ALIGN 1) | ||||||
|  | else () | ||||||
|  |    set (BSON_EXTRA_ALIGN 0) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_RDTSCP) | ||||||
|  |    set (MONGOC_ENABLE_RDTSCP 1) | ||||||
|  | else () | ||||||
|  |    set (MONGOC_ENABLE_RDTSCP 0) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (NOT ENABLE_MONGOC MATCHES "ON|OFF") | ||||||
|  |    message (FATAL_ERROR "ENABLE_MONGOC option must be ON or OFF") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (NOT ENABLE_BSON MATCHES "ON|AUTO|SYSTEM") | ||||||
|  |    message (FATAL_ERROR "ENABLE_BSON option must be ON, AUTO, or SYSTEM") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_BSON STREQUAL SYSTEM) | ||||||
|  |    # The input variable BSON_ROOT_DIR is respected for backwards compatibility, | ||||||
|  |    # but you should use the standard CMAKE_PREFIX_PATH instead. | ||||||
|  |    message (STATUS "Searching for libbson CMake packages") | ||||||
|  |    find_package (libbson-1.0 | ||||||
|  |       "${MONGOC_MAJOR_VERSION}.${MONGOC_MINOR_VERSION}.${MONGOC_MICRO_VERSION}" | ||||||
|  |       HINTS | ||||||
|  |       ${BSON_ROOT_DIR}) | ||||||
|  |  | ||||||
|  |    if (ENABLE_BSON STREQUAL SYSTEM AND NOT BSON_LIBRARIES) | ||||||
|  |       message (FATAL_ERROR "System libbson not found") | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  |    if (BSON_LIBRARIES) | ||||||
|  |       message ("--   libbson found version \"${BSON_VERSION}\"") | ||||||
|  |       message ("--   libbson include path \"${BSON_INCLUDE_DIRS}\"") | ||||||
|  |       message ("--   libbson libraries \"${BSON_LIBRARIES}\"") | ||||||
|  |       message ("--   disabling test-libmongoc since using system libbson") | ||||||
|  |       SET (ENABLE_TESTS OFF) | ||||||
|  |  | ||||||
|  |       if (ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |          find_package (libbson-static-1.0 | ||||||
|  |             "${MONGOC_MAJOR_VERSION}.${MONGOC_MINOR_VERSION}.${MONGOC_MICRO_VERSION}" | ||||||
|  |             HINTS | ||||||
|  |             ${BSON_ROOT_DIR}) | ||||||
|  |  | ||||||
|  |          if (ENABLE_STATIC STREQUAL ON AND NOT BSON_STATIC_LIBRARY) | ||||||
|  |             message (FATAL_ERROR "Static libbson not found. Pass -DENABLE_STATIC=OFF") | ||||||
|  |          endif () | ||||||
|  |  | ||||||
|  |          if (BSON_STATIC_LIBRARY) | ||||||
|  |             set (MONGOC_ENABLE_STATIC ON) | ||||||
|  |          endif () | ||||||
|  |  | ||||||
|  |          message ("--   libbson-static found version \"${BSON_STATIC_VERSION}\"") | ||||||
|  |          message ("--   libbson-static include path \"${BSON_STATIC_INCLUDE_DIRS}\"") | ||||||
|  |          message ("--   libbson-static libraries \"${BSON_STATIC_LIBRARIES}\"") | ||||||
|  |       endif () | ||||||
|  |    endif () | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | unset (dist_generated CACHE) | ||||||
|  | unset (dist_generated_depends CACHE) | ||||||
|  |  | ||||||
|  | set (BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) | ||||||
|  |  | ||||||
|  | include (MakeDistFiles) | ||||||
|  |  | ||||||
|  | # Ensure the default behavior: don't ignore RPATH settings. | ||||||
|  | set (CMAKE_SKIP_BUILD_RPATH OFF) | ||||||
|  |  | ||||||
|  | # Ensure the default behavior: don't use the final install destination as the | ||||||
|  | # temporary RPATH for executables (ensure we can run tests and programs from | ||||||
|  | # the build directory). | ||||||
|  | set (CMAKE_BUILD_WITH_INSTALL_RPATH OFF) | ||||||
|  |  | ||||||
|  | # Include any custom library paths in the final RPATH. | ||||||
|  | set (CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) | ||||||
|  |  | ||||||
|  | # Install libs with names like @rpath/libmongoc-1.0.0.dylib, not bare names. | ||||||
|  | set (CMAKE_MACOSX_RPATH ON) | ||||||
|  |  | ||||||
|  | # https://cmake.org/cmake/help/v3.11/policy/CMP0042.html | ||||||
|  | # Enable a CMake 3.0+ policy that sets CMAKE_MACOSX_RPATH by default, and | ||||||
|  | # silence a CMake 3.11 warning that the old behavior is deprecated. | ||||||
|  | cmake_policy (SET CMP0042 NEW) | ||||||
|  |  | ||||||
|  | if (NOT BSON_LIBRARIES) | ||||||
|  |    message ("  -- Using bundled libbson") | ||||||
|  |    if (ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |       set (MONGOC_ENABLE_STATIC ON) | ||||||
|  |    endif () | ||||||
|  |    add_subdirectory (src/libbson) | ||||||
|  |    # Defined in src/libbson/CMakeLists.txt | ||||||
|  |    set (BSON_STATIC_LIBRARIES bson_static) | ||||||
|  |    set (BSON_LIBRARIES bson_shared) | ||||||
|  |    set (BSON_STATIC_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/libbson/src" "${PROJECT_BINARY_DIR}/src/libbson/src") | ||||||
|  |    set (BSON_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/libbson/src" "${PROJECT_BINARY_DIR}/src/libbson/src") | ||||||
|  |    set (BSON_STATIC_DEFINITIONS "BSON_STATIC") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (MSVC) | ||||||
|  |    add_definitions (-D_CRT_SECURE_NO_WARNINGS) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | add_definitions (-D_GNU_SOURCE) | ||||||
|  | add_definitions (-D_BSD_SOURCE) | ||||||
|  | add_definitions (-D_DEFAULT_SOURCE) | ||||||
|  |  | ||||||
|  | if (ENABLE_MONGOC) | ||||||
|  |  | ||||||
|  |    if (ENABLE_TESTS AND NOT MONGOC_ENABLE_STATIC) | ||||||
|  |       message (FATAL_ERROR "ENABLE_TESTS requires ENABLE_STATIC") | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  |    if (NOT ENABLE_SSL MATCHES "DARWIN|WINDOWS|OPENSSL|LIBRESSL|AUTO|OFF") | ||||||
|  |       message (FATAL_ERROR | ||||||
|  |                "ENABLE_SSL option must be DARWIN, WINDOWS, OPENSSL, LIBRESSL, AUTO, or OFF") | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  |    set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/") | ||||||
|  |  | ||||||
|  |    set (ZLIB_SOURCES | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/adler32.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/crc32.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/deflate.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/infback.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/inffast.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/inflate.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/inftrees.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/trees.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/zutil.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/compress.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/uncompr.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/gzclose.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/gzlib.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/gzread.c | ||||||
|  |       ${SOURCE_DIR}/src/zlib-1.2.11/gzwrite.c | ||||||
|  |    ) | ||||||
|  |  | ||||||
|  |    set (MONGOC_ENABLE_ICU 0) | ||||||
|  |  | ||||||
|  |    set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING") | ||||||
|  |  | ||||||
|  |    include (CPack) | ||||||
|  |  | ||||||
|  |    # Ensure the default behavior: don't ignore RPATH settings. | ||||||
|  |    set (CMAKE_SKIP_BUILD_RPATH OFF) | ||||||
|  |  | ||||||
|  |    if (APPLE) | ||||||
|  |       # Until CDRIVER-520. | ||||||
|  |       add_definitions (-Wno-deprecated-declarations) | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  |    add_subdirectory (src/libmongoc) | ||||||
|  |  | ||||||
|  |    if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) | ||||||
|  |       find_package (Sphinx REQUIRED) | ||||||
|  |       add_custom_target (doc | ||||||
|  |          ALL | ||||||
|  |          DEPENDS | ||||||
|  |          $<$<STREQUAL:"${ENABLE_BSON}","ON">:bson-doc> | ||||||
|  |          $<$<STREQUAL:"${ENABLE_MONGOC}","ON">:mongoc-doc> | ||||||
|  |       ) | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  |    # Implement 'dist' and 'distcheck' targets | ||||||
|  |    # | ||||||
|  |    # CMake does not implement anything like 'dist' and 'distcheck' from autotools. | ||||||
|  |    # This implementation is based on the one in GnuCash. | ||||||
|  |  | ||||||
|  |    add_subdirectory (build) | ||||||
|  |    # sub-directory 'doc' was already included above | ||||||
|  |    add_subdirectory (orchestration_configs) | ||||||
|  |    add_subdirectory (src) | ||||||
|  |    # 'src/libbson' was already included, so 'src' will not include it directly | ||||||
|  |    # 'src/libmongoc' was already included, so 'src' will not include it directly | ||||||
|  |  | ||||||
|  |    set (PACKAGE_PREFIX "mongo-c-driver-${MONGOC_VERSION}") | ||||||
|  |    set (DIST_FILE "${PACKAGE_PREFIX}.tar.gz") | ||||||
|  |  | ||||||
|  |    set (top_DIST_local | ||||||
|  |       CMakeLists.txt | ||||||
|  |       CONTRIBUTING.md | ||||||
|  |       COPYING | ||||||
|  |       NEWS | ||||||
|  |       README.rst | ||||||
|  |       THIRD_PARTY_NOTICES | ||||||
|  |       VERSION_CURRENT | ||||||
|  |       VERSION_RELEASED | ||||||
|  |       # This sub-directory is added later, so manually include here | ||||||
|  |       generate_uninstall/CMakeLists.txt | ||||||
|  |    ) | ||||||
|  |  | ||||||
|  |    set_local_dist (top_DIST ${top_DIST_local}) | ||||||
|  |  | ||||||
|  |    set (ALL_DIST | ||||||
|  |       ${top_DIST} | ||||||
|  |       ${build_DIST} | ||||||
|  |       ${orchestration_configs_DIST} | ||||||
|  |       ${src_DIST} | ||||||
|  |       ${src_libbson_DIST} | ||||||
|  |       ${src_libmongoc_DIST} | ||||||
|  |    ) | ||||||
|  |  | ||||||
|  |    # Write a dist manifest | ||||||
|  |    string (REPLACE ";" "\n" ALL_DIST_LINES "${ALL_DIST}") | ||||||
|  |    file (WRITE ${CMAKE_BINARY_DIR}/dist_manifest.txt ${ALL_DIST_LINES}) | ||||||
|  |  | ||||||
|  |    # This is the command that produces the distribution tarball | ||||||
|  |    add_custom_command (OUTPUT ${DIST_FILE} | ||||||
|  |       COMMAND ${CMAKE_COMMAND} | ||||||
|  |          -D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/build/cmake/make_dist | ||||||
|  |          -D PACKAGE_PREFIX=${PACKAGE_PREFIX} | ||||||
|  |          -D MONGOC_SOURCE_DIR=${CMAKE_SOURCE_DIR} | ||||||
|  |          -D BUILD_SOURCE_DIR=${BUILD_SOURCE_DIR} | ||||||
|  |          -D SHELL=${SHELL} | ||||||
|  |          "-Ddist_generated=\"${dist_generated}\"" | ||||||
|  |          -P ${PROJECT_SOURCE_DIR}/build/cmake/make_dist/MakeDist.cmake | ||||||
|  |  | ||||||
|  |       DEPENDS | ||||||
|  |          ${ALL_DIST} ${dist_generated_depends} | ||||||
|  |    ) | ||||||
|  |  | ||||||
|  |    if (ENABLE_BSON MATCHES "ON|AUTO" AND ENABLE_MAN_PAGES STREQUAL ON AND ENABLE_HTML_DOCS STREQUAL ON) | ||||||
|  |       # Since our 'dist' implementation does not add top-level targets for every | ||||||
|  |       # file to be included, we declare a dependency on the 'mongo-doc' target so | ||||||
|  |       # that documentation is built before the distribution tarball is generated. | ||||||
|  |       add_custom_target (dist DEPENDS doc ${DIST_FILE}) | ||||||
|  |  | ||||||
|  |       add_custom_target (distcheck DEPENDS dist | ||||||
|  |          COMMAND ${CMAKE_COMMAND} | ||||||
|  |             -D CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/build/cmake/make_dist | ||||||
|  |             -D CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} | ||||||
|  |             -D PACKAGE_PREFIX=${PACKAGE_PREFIX} | ||||||
|  |             -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||||||
|  |             -D CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||||||
|  |             -P ${PROJECT_SOURCE_DIR}/build/cmake/make_dist/MakeDistCheck.cmake | ||||||
|  |       ) | ||||||
|  |    else () | ||||||
|  |       string (CONCAT DISTERRMSG | ||||||
|  |          "The dist and distcheck targets disabled. Set ENABLE_BSON=ON, " | ||||||
|  |          "ENABLE_MAN_PAGES=ON, and ENABLE_HTML_DOCS=ON to enable." | ||||||
|  |       ) | ||||||
|  |  | ||||||
|  |       add_custom_target (dist | ||||||
|  |          COMMAND ${CMAKE_COMMAND} -E echo "${DISTERRMSG}" | ||||||
|  |       ) | ||||||
|  |  | ||||||
|  |       add_custom_target (distcheck | ||||||
|  |          COMMAND ${CMAKE_COMMAND} -E echo "${DISTERRMSG}" | ||||||
|  |       ) | ||||||
|  |    endif () | ||||||
|  |  | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_UNINSTALL) | ||||||
|  |    if (WIN32) | ||||||
|  |       if (ENABLE_MONGOC) | ||||||
|  |          set (UNINSTALL_PROG "uninstall.cmd") | ||||||
|  |       else () | ||||||
|  |          set (UNINSTALL_PROG "uninstall-bson.cmd") | ||||||
|  |       endif () | ||||||
|  |    else () | ||||||
|  |       if (ENABLE_MONGOC) | ||||||
|  |          set (UNINSTALL_PROG "uninstall.sh") | ||||||
|  |       else () | ||||||
|  |          set (UNINSTALL_PROG "uninstall-bson.sh") | ||||||
|  |       endif () | ||||||
|  |    endif () | ||||||
|  |    set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR}/mongo-c-driver") | ||||||
|  |  | ||||||
|  |    # Create uninstall program and associated uninstall target | ||||||
|  |    # | ||||||
|  |    # This needs to be last (after all other add_subdirectory calls) to ensure that | ||||||
|  |    # the generated uninstall program is complete and correct | ||||||
|  |    add_subdirectory (generate_uninstall) | ||||||
|  | endif () | ||||||
							
								
								
									
										258
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/CONTRIBUTING.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										258
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/CONTRIBUTING.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,258 @@ | |||||||
|  | # Contributing to mongo-c-driver | ||||||
|  |  | ||||||
|  | Thanks for considering contributing to the mongo-c-driver! | ||||||
|  |  | ||||||
|  | This document intends to be a short guide to helping you contribute to the codebase. | ||||||
|  | It expects a familiarity with the C programming language and writing portable software. | ||||||
|  | Whenever in doubt, feel free to ask others that have contributed or look at the existing body of code. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Guidelines | ||||||
|  |  | ||||||
|  | The mongo-c-driver has a few guidelines that help direct the process. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### Portability | ||||||
|  |  | ||||||
|  | mongo-c-driver is portable software. It needs to run on a multitude of | ||||||
|  | operating systems and architectures. | ||||||
|  |  | ||||||
|  |  * Linux (RHEL 5 and newer) | ||||||
|  |  * FreeBSD (10 and newer) | ||||||
|  |  * Windows (Vista and newer) | ||||||
|  |  * macOS (10.8 and newer) | ||||||
|  |  * ARM/SPARC/x86/x86_64 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### Licensing | ||||||
|  |  | ||||||
|  | Some of the mongo-c-driver users embed the library statically in their | ||||||
|  | products.  Therefore, the driver and all contributions must be liberally | ||||||
|  | licensed.  As a policy, we have chosen Apache 2.0 as the license for the | ||||||
|  | project. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### Coding Style | ||||||
|  |  | ||||||
|  | We try not to be pedantic with taking contributions that are not properly | ||||||
|  | formatted, but we will likely perform a followup commit that cleans things up. | ||||||
|  | The basics are, in vim: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  |  : set ts=3 sw=3 et | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 3 space tabs, insert spaces instead of tabs. | ||||||
|  |  | ||||||
|  | For all the gory details, see [.clang-format](.clang-format) | ||||||
|  |  | ||||||
|  | ### Adding a new error code or domain                                               | ||||||
|  |                                                                                     | ||||||
|  | When adding a new error code or domain, you must do the following. This is most | ||||||
|  | applicable if you are adding a new symbol with a bson_error_t as a parameter, | ||||||
|  | and the existing codes or domains are inappropriate.                                | ||||||
|  |                                                                                     | ||||||
|  |  - Add the domain to `mongoc_error_domain_t` in `src/mongoc/mongoc-error.h`         | ||||||
|  |  - Add the code to `mongoc_error_code_t` in `src/mongoc/mongoc-error.h`             | ||||||
|  |  - Add documentation for the domain or code to the table in `doc/mongoc_errors.rst` | ||||||
|  |                                | ||||||
|  | ### Adding a new symbol | ||||||
|  |  | ||||||
|  | This should be done rarely but there are several things that you need to do | ||||||
|  | when adding a new symbol. | ||||||
|  |  | ||||||
|  |  - Add documentation for the new symbol in `doc/mongoc_your_new_symbol_name.rst` | ||||||
|  |  | ||||||
|  | ### Documentation | ||||||
|  |  | ||||||
|  | We strive to document all symbols. See doc/ for documentation examples. If you | ||||||
|  | add a new public function, add a new .rst file describing the function so that | ||||||
|  | we can generate man pages and HTML for it. | ||||||
|  |  | ||||||
|  | For complex internal functions, comment above the function definition with | ||||||
|  | a block comment like the following: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | /*-------------------------------------------------------------------------- | ||||||
|  |  * | ||||||
|  |  * mongoc_cmd_parts_append_read_write -- | ||||||
|  |  * | ||||||
|  |  *       Append user-supplied options to @parts->command_extra, taking the | ||||||
|  |  *       selected server's max wire version into account. | ||||||
|  |  * | ||||||
|  |  * Return: | ||||||
|  |  *       True if the options were successfully applied. If any options are | ||||||
|  |  *       invalid, returns false and fills out @error. In that case @parts is | ||||||
|  |  *       invalid and must not be used. | ||||||
|  |  * | ||||||
|  |  * Side effects: | ||||||
|  |  *       May partly apply options before returning an error. | ||||||
|  |  * | ||||||
|  |  *-------------------------------------------------------------------------- | ||||||
|  |  */ | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Public functions do not need these comment blocks, since they are documented in | ||||||
|  | the .rst files. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ### Testing | ||||||
|  |  | ||||||
|  | To run the entire test suite, including authentication tests, | ||||||
|  | start `mongod` with auth enabled: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | $ mongod --auth | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | In another terminal, use the `mongo` shell to create a user: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | $ mongo --eval "db.createUser({user: 'admin', pwd: 'pass', roles: ['root']})" admin | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Authentication in MongoDB 3.0 and later uses SCRAM-SHA-1, which in turn | ||||||
|  | requires a driver built with SSL. | ||||||
|  |  | ||||||
|  | Set the user and password environment variables, then build and run the tests: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | $ export MONGOC_TEST_USER=admin | ||||||
|  | $ export MONGOC_TEST_PASSWORD=pass | ||||||
|  | $ ./test-libmongoc | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Additional environment variables: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_HOST`: default `localhost`, the host running MongoDB. | ||||||
|  | * `MONGOC_TEST_PORT`: default 27017, MongoDB's listening port. | ||||||
|  | * `MONGOC_TEST_URI`: override both host and port with a full connection string, | ||||||
|  |   like "mongodb://server1,server2". | ||||||
|  | * `MONGOC_TEST_SERVER_LOG`: set to `stdout` or `stderr` for wire protocol  | ||||||
|  |   logging from tests that use `mock_server_t`. Set to `json` to include these | ||||||
|  |   logs in the test framework's JSON output, in a format compatible with | ||||||
|  |   [Evergreen](https://github.com/evergreen-ci/evergreen). | ||||||
|  | * `MONGOC_TEST_MONITORING_VERBOSE`: set to `on` for verbose output from | ||||||
|  |   Application Performance Monitoring tests. | ||||||
|  | * `MONGOC_TEST_COMPRESSORS=snappy,zlib`: wire protocol compressors to use | ||||||
|  |  | ||||||
|  | If you start `mongod` with SSL, set these variables to configure how | ||||||
|  | `test-libmongoc` connects to it: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_SSL`: set to `on` to connect to the server with SSL. | ||||||
|  | * `MONGOC_TEST_SSL_PEM_FILE`: path to a client PEM file. | ||||||
|  | * `MONGOC_TEST_SSL_PEM_PWD`: the PEM file's password. | ||||||
|  | * `MONGOC_TEST_SSL_CA_FILE`: path to a certificate authority file. | ||||||
|  | * `MONGOC_TEST_SSL_CA_DIR`: path to a certificate authority directory. | ||||||
|  | * `MONGOC_TEST_SSL_CRL_FILE`: path to a certificate revocation list. | ||||||
|  | * `MONGOC_TEST_SSL_WEAK_CERT_VALIDATION`: set to `on` to relax the client's | ||||||
|  |   validation of the server's certificate. | ||||||
|  |  | ||||||
|  | The SASL / GSSAPI / Kerberos tests are skipped by default. To run them, set up a | ||||||
|  | separate `mongod` with Kerberos and set its host and Kerberos principal name | ||||||
|  | as environment variables: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_GSSAPI_HOST`  | ||||||
|  | * `MONGOC_TEST_GSSAPI_USER`  | ||||||
|  |  | ||||||
|  | URI-escape the username, for example write "user@realm" as "user%40realm". | ||||||
|  | The user must be authorized to query `kerberos.test`. | ||||||
|  |  | ||||||
|  | MongoDB 3.2 adds support for readConcern, but does not enable support for | ||||||
|  | read concern majority by default. mongod must be launched using | ||||||
|  | `--enableMajorityReadConcern`. | ||||||
|  | The test framework does not (and can't) automatically discover if this option was | ||||||
|  | provided to MongoDB, so an additional variable must be set to enable these tests: | ||||||
|  |  | ||||||
|  | * `MONGOC_ENABLE_MAJORITY_READ_CONCERN` | ||||||
|  |  | ||||||
|  | Set this environment variable to `on` if MongoDB has enabled majority read concern. | ||||||
|  |  | ||||||
|  | Some tests require Internet access, e.g. to check the error message when failing | ||||||
|  | to open a MongoDB connection to example.com. Skip them with: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_OFFLINE=on` | ||||||
|  |  | ||||||
|  | Some tests require a running MongoDB server. Skip them with: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_SKIP_LIVE=on` | ||||||
|  |  | ||||||
|  | For quick checks during development, disable long-running tests: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_SKIP_SLOW=on` | ||||||
|  |  | ||||||
|  | Some tests run against a local mock server, these can be skipped with: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_SKIP_MOCK=on` | ||||||
|  |  | ||||||
|  | If you have started with MongoDB with `--ipv6`, you can test IPv6 with: | ||||||
|  |  | ||||||
|  | * `MONGOC_CHECK_IPV6=on` | ||||||
|  |  | ||||||
|  | The tests for mongodb+srv:// connection strings require some setup, see the | ||||||
|  | Initial DNS Seedlist Discovery Spec. By default these connection strings are | ||||||
|  | NOT tested, enable them with: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_DNS=on` | ||||||
|  |  | ||||||
|  | The mock server timeout threshold for future functions can be set with: | ||||||
|  |  | ||||||
|  | * `MONGOC_TEST_FUTURE_TIMEOUT_MS=<int>` | ||||||
|  |  | ||||||
|  | This is useful for debugging, so future calls don't timeout when stepping through code. | ||||||
|  |  | ||||||
|  | All tests should pass before submitting a patch. | ||||||
|  |  | ||||||
|  | ## Configuring the test runner | ||||||
|  |  | ||||||
|  | The test runner can be configured with command-line options. Run `test-libmongoc | ||||||
|  | --help` for details. | ||||||
|  |  | ||||||
|  | To run just a specific portion of the test suite use the -l option like so: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | $ ./test-libmongoc -l "/server_selection/*" | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | The full list of tests is shown in the help. | ||||||
|  |  | ||||||
|  | ## Creating and checking a distribution tarball | ||||||
|  |  | ||||||
|  | The `make distcheck` command can be used to confirm that any modifications are | ||||||
|  | able to be packaged into the distribution tarball and that the resulting | ||||||
|  | distribution tarball can be used to successfully build the project. | ||||||
|  |  | ||||||
|  | A failure of the `make distcheck` target is an indicator of an oversight in the | ||||||
|  | modification to the project. For example, if a new source file is added to the | ||||||
|  | project but it is not added to the proper distribution list, it is possible that | ||||||
|  | the distribution tarball will be created without that file. An attempt to build | ||||||
|  | the project without the file is likely to fail. | ||||||
|  |  | ||||||
|  | When `make distcheck` is invoked, several things happen. The `dist` target is | ||||||
|  | executed to create a distribution tarball. Then the tarball is unpacked, | ||||||
|  | configured (with an invocation of `cmake`), built (by calling `make`), installed | ||||||
|  | (by calling `make install`), and tested (by calling `make check`). Three | ||||||
|  | environment variables can be used to modify these steps. | ||||||
|  |  | ||||||
|  | To adjust the options passed to `make` during the build step, set: | ||||||
|  |  | ||||||
|  | * `DISTCHECK_BUILD_OPTS` | ||||||
|  |  | ||||||
|  | If this variable is not set, then `make` is called with a default of "-j 8". | ||||||
|  |  | ||||||
|  | To adjust the options passed to `make install` during the installation step, | ||||||
|  | set: | ||||||
|  |  | ||||||
|  | * `DISTCHECK_INSTALL_OPTS` | ||||||
|  |  | ||||||
|  | To adjust the options passed to `make check` during the test step, set: | ||||||
|  |  | ||||||
|  | * `DISTCHECK_CHECK_OPTS` | ||||||
|  |  | ||||||
|  | Remember, if you want to modify the top-level `make` invocation, you will need | ||||||
|  | to pass options on the command line as normal. | ||||||
|  |  | ||||||
|  | For example, the command `make -j 6 distcheck DISTCHECK_BUILD_OPTS="-j 4"` will | ||||||
|  | call the standard sequence of targets depended upon by `distcheck` with a | ||||||
|  | parallelism level of 6, while the build step that is later called by the | ||||||
|  | `distcheck` target will be executed with a parallelism level of 4. | ||||||
							
								
								
									
										177
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/COPYING
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/COPYING
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | |||||||
|  |  | ||||||
|  |                                  Apache License | ||||||
|  |                            Version 2.0, January 2004 | ||||||
|  |                         http://www.apache.org/licenses/ | ||||||
|  |  | ||||||
|  |    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||||||
|  |  | ||||||
|  |    1. Definitions. | ||||||
|  |  | ||||||
|  |       "License" shall mean the terms and conditions for use, reproduction, | ||||||
|  |       and distribution as defined by Sections 1 through 9 of this document. | ||||||
|  |  | ||||||
|  |       "Licensor" shall mean the copyright owner or entity authorized by | ||||||
|  |       the copyright owner that is granting the License. | ||||||
|  |  | ||||||
|  |       "Legal Entity" shall mean the union of the acting entity and all | ||||||
|  |       other entities that control, are controlled by, or are under common | ||||||
|  |       control with that entity. For the purposes of this definition, | ||||||
|  |       "control" means (i) the power, direct or indirect, to cause the | ||||||
|  |       direction or management of such entity, whether by contract or | ||||||
|  |       otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||||||
|  |       outstanding shares, or (iii) beneficial ownership of such entity. | ||||||
|  |  | ||||||
|  |       "You" (or "Your") shall mean an individual or Legal Entity | ||||||
|  |       exercising permissions granted by this License. | ||||||
|  |  | ||||||
|  |       "Source" form shall mean the preferred form for making modifications, | ||||||
|  |       including but not limited to software source code, documentation | ||||||
|  |       source, and configuration files. | ||||||
|  |  | ||||||
|  |       "Object" form shall mean any form resulting from mechanical | ||||||
|  |       transformation or translation of a Source form, including but | ||||||
|  |       not limited to compiled object code, generated documentation, | ||||||
|  |       and conversions to other media types. | ||||||
|  |  | ||||||
|  |       "Work" shall mean the work of authorship, whether in Source or | ||||||
|  |       Object form, made available under the License, as indicated by a | ||||||
|  |       copyright notice that is included in or attached to the work | ||||||
|  |       (an example is provided in the Appendix below). | ||||||
|  |  | ||||||
|  |       "Derivative Works" shall mean any work, whether in Source or Object | ||||||
|  |       form, that is based on (or derived from) the Work and for which the | ||||||
|  |       editorial revisions, annotations, elaborations, or other modifications | ||||||
|  |       represent, as a whole, an original work of authorship. For the purposes | ||||||
|  |       of this License, Derivative Works shall not include works that remain | ||||||
|  |       separable from, or merely link (or bind by name) to the interfaces of, | ||||||
|  |       the Work and Derivative Works thereof. | ||||||
|  |  | ||||||
|  |       "Contribution" shall mean any work of authorship, including | ||||||
|  |       the original version of the Work and any modifications or additions | ||||||
|  |       to that Work or Derivative Works thereof, that is intentionally | ||||||
|  |       submitted to Licensor for inclusion in the Work by the copyright owner | ||||||
|  |       or by an individual or Legal Entity authorized to submit on behalf of | ||||||
|  |       the copyright owner. For the purposes of this definition, "submitted" | ||||||
|  |       means any form of electronic, verbal, or written communication sent | ||||||
|  |       to the Licensor or its representatives, including but not limited to | ||||||
|  |       communication on electronic mailing lists, source code control systems, | ||||||
|  |       and issue tracking systems that are managed by, or on behalf of, the | ||||||
|  |       Licensor for the purpose of discussing and improving the Work, but | ||||||
|  |       excluding communication that is conspicuously marked or otherwise | ||||||
|  |       designated in writing by the copyright owner as "Not a Contribution." | ||||||
|  |  | ||||||
|  |       "Contributor" shall mean Licensor and any individual or Legal Entity | ||||||
|  |       on behalf of whom a Contribution has been received by Licensor and | ||||||
|  |       subsequently incorporated within the Work. | ||||||
|  |  | ||||||
|  |    2. Grant of Copyright License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       copyright license to reproduce, prepare Derivative Works of, | ||||||
|  |       publicly display, publicly perform, sublicense, and distribute the | ||||||
|  |       Work and such Derivative Works in Source or Object form. | ||||||
|  |  | ||||||
|  |    3. Grant of Patent License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       (except as stated in this section) patent license to make, have made, | ||||||
|  |       use, offer to sell, sell, import, and otherwise transfer the Work, | ||||||
|  |       where such license applies only to those patent claims licensable | ||||||
|  |       by such Contributor that are necessarily infringed by their | ||||||
|  |       Contribution(s) alone or by combination of their Contribution(s) | ||||||
|  |       with the Work to which such Contribution(s) was submitted. If You | ||||||
|  |       institute patent litigation against any entity (including a | ||||||
|  |       cross-claim or counterclaim in a lawsuit) alleging that the Work | ||||||
|  |       or a Contribution incorporated within the Work constitutes direct | ||||||
|  |       or contributory patent infringement, then any patent licenses | ||||||
|  |       granted to You under this License for that Work shall terminate | ||||||
|  |       as of the date such litigation is filed. | ||||||
|  |  | ||||||
|  |    4. Redistribution. You may reproduce and distribute copies of the | ||||||
|  |       Work or Derivative Works thereof in any medium, with or without | ||||||
|  |       modifications, and in Source or Object form, provided that You | ||||||
|  |       meet the following conditions: | ||||||
|  |  | ||||||
|  |       (a) You must give any other recipients of the Work or | ||||||
|  |           Derivative Works a copy of this License; and | ||||||
|  |  | ||||||
|  |       (b) You must cause any modified files to carry prominent notices | ||||||
|  |           stating that You changed the files; and | ||||||
|  |  | ||||||
|  |       (c) You must retain, in the Source form of any Derivative Works | ||||||
|  |           that You distribute, all copyright, patent, trademark, and | ||||||
|  |           attribution notices from the Source form of the Work, | ||||||
|  |           excluding those notices that do not pertain to any part of | ||||||
|  |           the Derivative Works; and | ||||||
|  |  | ||||||
|  |       (d) If the Work includes a "NOTICE" text file as part of its | ||||||
|  |           distribution, then any Derivative Works that You distribute must | ||||||
|  |           include a readable copy of the attribution notices contained | ||||||
|  |           within such NOTICE file, excluding those notices that do not | ||||||
|  |           pertain to any part of the Derivative Works, in at least one | ||||||
|  |           of the following places: within a NOTICE text file distributed | ||||||
|  |           as part of the Derivative Works; within the Source form or | ||||||
|  |           documentation, if provided along with the Derivative Works; or, | ||||||
|  |           within a display generated by the Derivative Works, if and | ||||||
|  |           wherever such third-party notices normally appear. The contents | ||||||
|  |           of the NOTICE file are for informational purposes only and | ||||||
|  |           do not modify the License. You may add Your own attribution | ||||||
|  |           notices within Derivative Works that You distribute, alongside | ||||||
|  |           or as an addendum to the NOTICE text from the Work, provided | ||||||
|  |           that such additional attribution notices cannot be construed | ||||||
|  |           as modifying the License. | ||||||
|  |  | ||||||
|  |       You may add Your own copyright statement to Your modifications and | ||||||
|  |       may provide additional or different license terms and conditions | ||||||
|  |       for use, reproduction, or distribution of Your modifications, or | ||||||
|  |       for any such Derivative Works as a whole, provided Your use, | ||||||
|  |       reproduction, and distribution of the Work otherwise complies with | ||||||
|  |       the conditions stated in this License. | ||||||
|  |  | ||||||
|  |    5. Submission of Contributions. Unless You explicitly state otherwise, | ||||||
|  |       any Contribution intentionally submitted for inclusion in the Work | ||||||
|  |       by You to the Licensor shall be under the terms and conditions of | ||||||
|  |       this License, without any additional terms or conditions. | ||||||
|  |       Notwithstanding the above, nothing herein shall supersede or modify | ||||||
|  |       the terms of any separate license agreement you may have executed | ||||||
|  |       with Licensor regarding such Contributions. | ||||||
|  |  | ||||||
|  |    6. Trademarks. This License does not grant permission to use the trade | ||||||
|  |       names, trademarks, service marks, or product names of the Licensor, | ||||||
|  |       except as required for reasonable and customary use in describing the | ||||||
|  |       origin of the Work and reproducing the content of the NOTICE file. | ||||||
|  |  | ||||||
|  |    7. Disclaimer of Warranty. Unless required by applicable law or | ||||||
|  |       agreed to in writing, Licensor provides the Work (and each | ||||||
|  |       Contributor provides its Contributions) on an "AS IS" BASIS, | ||||||
|  |       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||
|  |       implied, including, without limitation, any warranties or conditions | ||||||
|  |       of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||||||
|  |       PARTICULAR PURPOSE. You are solely responsible for determining the | ||||||
|  |       appropriateness of using or redistributing the Work and assume any | ||||||
|  |       risks associated with Your exercise of permissions under this License. | ||||||
|  |  | ||||||
|  |    8. Limitation of Liability. In no event and under no legal theory, | ||||||
|  |       whether in tort (including negligence), contract, or otherwise, | ||||||
|  |       unless required by applicable law (such as deliberate and grossly | ||||||
|  |       negligent acts) or agreed to in writing, shall any Contributor be | ||||||
|  |       liable to You for damages, including any direct, indirect, special, | ||||||
|  |       incidental, or consequential damages of any character arising as a | ||||||
|  |       result of this License or out of the use or inability to use the | ||||||
|  |       Work (including but not limited to damages for loss of goodwill, | ||||||
|  |       work stoppage, computer failure or malfunction, or any and all | ||||||
|  |       other commercial damages or losses), even if such Contributor | ||||||
|  |       has been advised of the possibility of such damages. | ||||||
|  |  | ||||||
|  |    9. Accepting Warranty or Additional Liability. While redistributing | ||||||
|  |       the Work or Derivative Works thereof, You may choose to offer, | ||||||
|  |       and charge a fee for, acceptance of support, warranty, indemnity, | ||||||
|  |       or other liability obligations and/or rights consistent with this | ||||||
|  |       License. However, in accepting such obligations, You may act only | ||||||
|  |       on Your own behalf and on Your sole responsibility, not on behalf | ||||||
|  |       of any other Contributor, and only if You agree to indemnify, | ||||||
|  |       defend, and hold each Contributor harmless for any liability | ||||||
|  |       incurred by, or claims asserted against, such Contributor by reason | ||||||
|  |       of your accepting any such warranty or additional liability. | ||||||
|  |  | ||||||
|  |    END OF TERMS AND CONDITIONS | ||||||
							
								
								
									
										2413
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/NEWS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2413
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/NEWS
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										90
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/README.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/README.rst
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | |||||||
|  | ============== | ||||||
|  | mongo-c-driver | ||||||
|  | ============== | ||||||
|  |  | ||||||
|  | About | ||||||
|  | ===== | ||||||
|  |  | ||||||
|  | mongo-c-driver is a project that includes two libraries: | ||||||
|  |  | ||||||
|  | - libmongoc, a client library written in C for MongoDB. | ||||||
|  | - libbson, a library providing useful routines related to building, parsing, and iterating BSON documents. | ||||||
|  |  | ||||||
|  | If libmongoc is not needed, it is possible to build and install only libbson. | ||||||
|  |  | ||||||
|  | Documentation / Support / Feedback | ||||||
|  | ================================== | ||||||
|  |  | ||||||
|  | The documentation is available at http://mongoc.org/. | ||||||
|  | For issues with, questions about, or feedback for libmongoc, please look into | ||||||
|  | our `support channels <http://www.mongodb.org/about/support>`_. Please | ||||||
|  | do not email any of the libmongoc developers directly with issues or | ||||||
|  | questions - you're more likely to get an answer on the `mongodb-user list`_ | ||||||
|  | on Google Groups. | ||||||
|  |  | ||||||
|  | Bugs / Feature Requests | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | Think you’ve found a bug? Want to see a new feature in libmongoc? Please open a | ||||||
|  | case in our issue management tool, JIRA: | ||||||
|  |  | ||||||
|  | - `Create an account and login <https://jira.mongodb.org>`_. | ||||||
|  | - Navigate to `the CDRIVER project <https://jira.mongodb.org/browse/CDRIVER>`_. | ||||||
|  | - Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. | ||||||
|  |  | ||||||
|  | Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the | ||||||
|  | Core Server (i.e. SERVER) project are **public**. | ||||||
|  |  | ||||||
|  | How To Ask For Help | ||||||
|  | ------------------- | ||||||
|  |  | ||||||
|  | If you are having difficulty building the driver after reading the below instructions, please email | ||||||
|  | the `mongodb-user list`_ to ask for help. Please include in your email all of the following | ||||||
|  | information: | ||||||
|  |  | ||||||
|  | - The version of the driver you are trying to build (branch or tag). | ||||||
|  |     - Examples: master branch, 1.9.5 tag | ||||||
|  | - Host OS, version, and architecture. | ||||||
|  |     - Examples: Windows 10 64-bit x86, Ubuntu 16.04 64-bit x86, macOS 10.13 | ||||||
|  | - C Compiler and version. | ||||||
|  |     - Examples: GCC 7.3.0, Visual Studio Community 2017, clang 3.9, XCode 9.3 | ||||||
|  | - The output of ``cmake``. | ||||||
|  | - The text of the error you encountered. | ||||||
|  |  | ||||||
|  | Failure to include the relevant information will delay a useful response. | ||||||
|  | Here is a made-up example of a help request that provides the relevant | ||||||
|  | information: | ||||||
|  |  | ||||||
|  |   Hello, I'm trying to build the C driver with Kerberos support, from | ||||||
|  |   mongo-c-driver-1.9.5.tar.gz. I'm on Ubuntu 16.04, 64-bit Intel, with gcc | ||||||
|  |   5.4.0. I run CMake like:: | ||||||
|  |  | ||||||
|  |     $ cmake . | ||||||
|  |     -- The C compiler identification is ;GNU 5.4.0 | ||||||
|  |     -- Check for working C compiler: /usr/bin/cc | ||||||
|  |     -- Check for working C compiler: /usr/bin/cc -- works | ||||||
|  |  | ||||||
|  |     ... SNIPPED OUTPUT, but when you ask for help, include full output without any omissions ... | ||||||
|  |  | ||||||
|  |     -- Searching for libsasl2 | ||||||
|  |     --   Not found (specify -DCMAKE_LIBRARY_PATH=/path/to/sasl/lib for SASL support) | ||||||
|  |     CMake Error at CMakeLists.txt:10 (_message): | ||||||
|  |         SASL not found | ||||||
|  |  | ||||||
|  |   Can you tell me what I need to install? Thanks! | ||||||
|  |  | ||||||
|  | .. _mongodb-user list: http://groups.google.com/group/mongodb-user | ||||||
|  |  | ||||||
|  | Security Vulnerabilities | ||||||
|  | ------------------------ | ||||||
|  |  | ||||||
|  | If you’ve identified a security vulnerability in a driver or any other | ||||||
|  | MongoDB project, please report it according to the `instructions here | ||||||
|  | <http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report>`_. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Installation | ||||||
|  | ============ | ||||||
|  |  | ||||||
|  | Detailed installation instructions are in the manual: | ||||||
|  | http://mongoc.org/libmongoc/current/installing.html | ||||||
							
								
								
									
										157
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/THIRD_PARTY_NOTICES
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/THIRD_PARTY_NOTICES
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,157 @@ | |||||||
|  | The MongoDB C Driver uses third-party code distributed under different licenses. | ||||||
|  |  | ||||||
|  | License notice for common-b64.c | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | ISC License | ||||||
|  |  | ||||||
|  | Copyright: 1996, 1998 Internet Software Consortium | ||||||
|  |            1995 International Business Machines, Inc. | ||||||
|  |  | ||||||
|  | Permission to use, copy, modify, and/or distribute this software for any | ||||||
|  | purpose with or without fee is hereby granted, provided that the above | ||||||
|  | copyright notice and this permission notice appear in all copies. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||||||
|  | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||||
|  | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||||||
|  | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||||||
|  | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||||||
|  | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||||||
|  | PERFORMANCE OF THIS SOFTWARE. | ||||||
|  |  | ||||||
|  | Portions Copyright (c) 1995 by International Business Machines, Inc. | ||||||
|  |  | ||||||
|  | International Business Machines, Inc. (hereinafter called IBM) grants | ||||||
|  | permission under its copyrights to use, copy, modify, and distribute this | ||||||
|  | Software with or without fee, provided that the above copyright notice and | ||||||
|  | all paragraphs of this notice appear in all copies, and that the name of IBM | ||||||
|  | not be used in connection with the marketing of any product incorporating | ||||||
|  | the Software or modifications thereof, without specific, written prior | ||||||
|  | permission. | ||||||
|  |  | ||||||
|  | To the extent it has a right to do so, IBM grants an immunity from suit | ||||||
|  | under its patents, if any, for the use, sale or manufacture of products to | ||||||
|  | the extent that such products are used for performing Domain Name System | ||||||
|  | dynamic updates in TCP/IP networks by means of the Software.  No immunity is | ||||||
|  | granted for any product per se or for any other function of any product. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, | ||||||
|  | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||||||
|  | PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, | ||||||
|  | DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING | ||||||
|  | OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN | ||||||
|  | IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | License notice for taglist.py | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | MIT License | ||||||
|  |  | ||||||
|  | Portions Copyright 2007-2009 by the Sphinx team. | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining | ||||||
|  | a copy of this software and associated documentation files (the | ||||||
|  | "Software"), to deal in the Software without restriction, including | ||||||
|  | without limitation the rights to use, copy, modify, merge, publish, | ||||||
|  | distribute, sublicense, and/or sell copies of the Software, and to | ||||||
|  | permit persons to whom the Software is furnished to do so, subject to | ||||||
|  | the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be | ||||||
|  | included in all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||||
|  | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||||
|  | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||||
|  | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||||||
|  | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||||||
|  | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||||||
|  | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | License notice for mongoc.css_t | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | MIT License | ||||||
|  |  | ||||||
|  | Portions Copyright 2013 by Ignacy Sokolowski. | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining | ||||||
|  | a copy of this software and associated documentation files (the | ||||||
|  | "Software"), to deal in the Software without restriction, including | ||||||
|  | without limitation the rights to use, copy, modify, merge, publish, | ||||||
|  | distribute, sublicense, and/or sell copies of the Software, and to | ||||||
|  | permit persons to whom the Software is furnished to do so, subject to | ||||||
|  | the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be | ||||||
|  | included in all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||||
|  | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||||
|  | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||||
|  | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||||||
|  | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||||||
|  | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||||||
|  | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | License notice for zlib | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | /* zlib.h -- interface of the 'zlib' general purpose compression library | ||||||
|  |   version 1.2.11, January 15th, 2017 | ||||||
|  |  | ||||||
|  |   Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler | ||||||
|  |  | ||||||
|  |   This software is provided 'as-is', without any express or implied | ||||||
|  |   warranty.  In no event will the authors be held liable for any damages | ||||||
|  |   arising from the use of this software. | ||||||
|  |  | ||||||
|  |   Permission is granted to anyone to use this software for any purpose, | ||||||
|  |   including commercial applications, and to alter it and redistribute it | ||||||
|  |   freely, subject to the following restrictions: | ||||||
|  |  | ||||||
|  |   1. The origin of this software must not be misrepresented; you must not | ||||||
|  |      claim that you wrote the original software. If you use this software | ||||||
|  |      in a product, an acknowledgment in the product documentation would be | ||||||
|  |      appreciated but is not required. | ||||||
|  |   2. Altered source versions must be plainly marked as such, and must not be | ||||||
|  |      misrepresented as being the original software. | ||||||
|  |   3. This notice may not be removed or altered from any source distribution. | ||||||
|  |  | ||||||
|  |   Jean-loup Gailly        Mark Adler | ||||||
|  |   jloup@gzip.org          madler@alumni.caltech.edu | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   The data format used by the zlib library is described by RFCs (Request for | ||||||
|  |   Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 | ||||||
|  |   (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | License notice for common-md5.c | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | ZLib License | ||||||
|  |  | ||||||
|  | Copyright (C) 1999, 2002 Aladdin Enterprises.  All rights reserved. | ||||||
|  |  | ||||||
|  | This software is provided 'as-is', without any express or implied | ||||||
|  | warranty.  In no event will the authors be held liable for any damages | ||||||
|  | arising from the use of this software. | ||||||
|  |  | ||||||
|  | Permission is granted to anyone to use this software for any purpose, | ||||||
|  | including commercial applications, and to alter it and redistribute it | ||||||
|  | freely, subject to the following restrictions: | ||||||
|  |  | ||||||
|  | 1. The origin of this software must not be misrepresented; you must not | ||||||
|  |  claim that you wrote the original software. If you use this software | ||||||
|  |  in a product, an acknowledgment in the product documentation would be | ||||||
|  |  appreciated but is not required. | ||||||
|  | 2. Altered source versions must be plainly marked as such, and must not be | ||||||
|  |  misrepresented as being the original software. | ||||||
|  | 3. This notice may not be removed or altered from any source distribution. | ||||||
|  |  | ||||||
|  | L. Peter Deutsch | ||||||
|  | ghost@aladdin.com | ||||||
							
								
								
									
										1
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/VERSION_CURRENT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/VERSION_CURRENT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | 1.13.1 | ||||||
							
								
								
									
										1
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/VERSION_RELEASED
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/VERSION_RELEASED
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | 1.13.1 | ||||||
| @@ -0,0 +1,56 @@ | |||||||
|  | # Fabricate our own copy of the install manifest, since the installation has not | ||||||
|  | # generated the final version yet at this point | ||||||
|  |  | ||||||
|  | set (UNINSTALL_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||||||
|  |  | ||||||
|  | if (WIN32) | ||||||
|  |    string (REPLACE "/" "\\\\" CMAKE_INSTALL_PREFIX_WIN32 | ||||||
|  |       "${CMAKE_INSTALL_PREFIX}" | ||||||
|  |    ) | ||||||
|  |    install (CODE " | ||||||
|  |       string(REPLACE \";\" \"\\n\" MONGOC_INSTALL_MANIFEST_CONTENT | ||||||
|  |          \"\${CMAKE_INSTALL_MANIFEST_FILES}\") | ||||||
|  |       string(REPLACE \"/\" \"\\\\\" MONGOC_INSTALL_MANIFEST_CONTENT_WIN32 | ||||||
|  |          \"\${MONGOC_INSTALL_MANIFEST_CONTENT}\") | ||||||
|  |       file(WRITE \"mongoc_install_manifest.txt\" | ||||||
|  |          \"\${MONGOC_INSTALL_MANIFEST_CONTENT_WIN32}\") | ||||||
|  |       execute_process ( | ||||||
|  |          COMMAND | ||||||
|  |             ${CMAKE_COMMAND} -E env | ||||||
|  |             ENABLE_MONGOC=${ENABLE_MONGOC} | ||||||
|  |             cmd.exe /c | ||||||
|  |             \"${PROJECT_SOURCE_DIR}/build/generate-uninstall.cmd\" | ||||||
|  |             mongoc_install_manifest.txt | ||||||
|  |             ${CMAKE_INSTALL_PREFIX_WIN32} | ||||||
|  |          OUTPUT_FILE | ||||||
|  |             \"${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}\" | ||||||
|  |       ) | ||||||
|  |    ") | ||||||
|  |    install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS}) | ||||||
|  |  | ||||||
|  |    add_custom_target (uninstall | ||||||
|  |       COMMAND call "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" | ||||||
|  |    ) | ||||||
|  | else () | ||||||
|  |    install (CODE " | ||||||
|  |       string(REPLACE \";\" \"\\n\" MONGOC_INSTALL_MANIFEST_CONTENT | ||||||
|  |          \"\${CMAKE_INSTALL_MANIFEST_FILES}\") | ||||||
|  |       file(WRITE \"mongoc_install_manifest.txt\" | ||||||
|  |          \"\${MONGOC_INSTALL_MANIFEST_CONTENT}\") | ||||||
|  |       execute_process ( | ||||||
|  |          COMMAND | ||||||
|  |             ${CMAKE_COMMAND} -E env | ||||||
|  |             ENABLE_MONGOC=${ENABLE_MONGOC} | ||||||
|  |             \"${PROJECT_SOURCE_DIR}/build/generate-uninstall.sh\" | ||||||
|  |             mongoc_install_manifest.txt | ||||||
|  |             ${CMAKE_INSTALL_PREFIX} | ||||||
|  |          OUTPUT_FILE | ||||||
|  |             \"${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}\" | ||||||
|  |       ) | ||||||
|  |    ") | ||||||
|  |    install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" DESTINATION "${UNINSTALL_PROG_DIR}" PERMISSIONS ${UNINSTALL_PERMISSIONS}) | ||||||
|  |  | ||||||
|  |    add_custom_target (uninstall | ||||||
|  |       COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/${UNINSTALL_PROG}" | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | file (GLOB_RECURSE orchestration_configs_DIST_pems RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.pem) | ||||||
|  | file (GLOB_RECURSE orchestration_configs_DIST_jsons RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.json) | ||||||
|  |  | ||||||
|  | set_dist_list (orchestration_configs_DIST | ||||||
|  |    CMakeLists.txt | ||||||
|  |    ${orchestration_configs_DIST_pems} | ||||||
|  |    ${orchestration_configs_DIST_jsons} | ||||||
|  | ) | ||||||
|  |  | ||||||
| @@ -0,0 +1,57 @@ | |||||||
|  | { | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "id": "repl0", | ||||||
|  |   "login": "bob", | ||||||
|  |   "password": "pwd123", | ||||||
|  |   "members": [ | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "one", | ||||||
|  |           "dc": "ny" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27018, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "two", | ||||||
|  |           "dc": "pa" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27019, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "arbiterOnly": true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "sslParams": { | ||||||
|  |       "sslMode": "requireSSL", | ||||||
|  |       "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |       "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |       "sslAllowInvalidCertificates": true, | ||||||
|  |       "sslWeakCertificateValidation" : true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,58 @@ | |||||||
|  | { | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "id": "repl0", | ||||||
|  |   "login": "bob", | ||||||
|  |   "password": "pwd123", | ||||||
|  |   "authSource": "thisDB", | ||||||
|  |   "members": [ | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "one", | ||||||
|  |           "dc": "ny" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27018, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "two", | ||||||
|  |           "dc": "pa" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27019, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "arbiterOnly": true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "sslParams": { | ||||||
|  |     "sslMode": "requireSSL", | ||||||
|  |     "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |     "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |     "sslAllowInvalidCertificates": true, | ||||||
|  |     "sslWeakCertificateValidation" : true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,50 @@ | |||||||
|  | { | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "id": "repl0", | ||||||
|  |   "login": "bob", | ||||||
|  |   "members": [ | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "one", | ||||||
|  |           "dc": "ny" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27018, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "two", | ||||||
|  |           "dc": "pa" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27019, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "arbiterOnly": true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "password": "pwd123" | ||||||
|  | } | ||||||
| @@ -0,0 +1,54 @@ | |||||||
|  | { | ||||||
|  |   "id": "repl0", | ||||||
|  |   "members": [ | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "one", | ||||||
|  |           "dc": "ny" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27018, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "two", | ||||||
|  |           "dc": "pa" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27019, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "arbiterOnly": true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "sslParams": { | ||||||
|  |       "sslMode": "requireSSL", | ||||||
|  |       "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |       "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |       "sslAllowInvalidCertificates": true, | ||||||
|  |       "sslWeakCertificateValidation" : true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,47 @@ | |||||||
|  | { | ||||||
|  |   "id": "repl0", | ||||||
|  |   "members": [ | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "one", | ||||||
|  |           "dc": "ny" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27018, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "tags": { | ||||||
|  |           "ordinal": "two", | ||||||
|  |           "dc": "pa" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27019, | ||||||
|  |         "setParameter" : { "enableTestCommands": 1 } | ||||||
|  |       }, | ||||||
|  |       "rsParams": { | ||||||
|  |         "arbiterOnly": true | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -0,0 +1,20 @@ | |||||||
|  | { | ||||||
|  |     "id" : "standalonessl", | ||||||
|  |     "name": "mongod", | ||||||
|  |     "login": "bob", | ||||||
|  |     "password": "pwd123", | ||||||
|  |     "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "logappend": true, | ||||||
|  |         "journal": true, | ||||||
|  |         "port": 27017 | ||||||
|  |     }, | ||||||
|  |     "sslParams": { | ||||||
|  |        "sslMode": "requireSSL", | ||||||
|  |        "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |        "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |        "sslAllowInvalidCertificates": true, | ||||||
|  |        "sslWeakCertificateValidation" : true | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | { | ||||||
|  |   "id": "standalone", | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "login": "bob", | ||||||
|  |   "name": "mongod", | ||||||
|  |   "password": "pwd123", | ||||||
|  |   "procParams": { | ||||||
|  |     "ipv6": true, | ||||||
|  |     "bind_ip": "127.0.0.1,::1", | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |   "name": "mongod", | ||||||
|  |   "procParams": { | ||||||
|  |     "ipv6": false, | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,18 @@ | |||||||
|  | { | ||||||
|  |    "id" : "standalonenoauthssl", | ||||||
|  |    "name": "mongod", | ||||||
|  |    "procParams": { | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1", | ||||||
|  |       "logappend": true, | ||||||
|  |       "journal": true, | ||||||
|  |       "port": 27017 | ||||||
|  |    }, | ||||||
|  |    "sslParams": { | ||||||
|  |       "sslMode": "requireSSL", | ||||||
|  |       "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |       "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |       "sslAllowInvalidCertificates": true, | ||||||
|  |       "sslWeakCertificateValidation" : true | ||||||
|  |    } | ||||||
|  | } | ||||||
| @@ -0,0 +1,10 @@ | |||||||
|  | { | ||||||
|  |   "name": "mongod", | ||||||
|  |   "procParams": { | ||||||
|  |     "ipv6": true, | ||||||
|  |     "bind_ip": "127.0.0.1,::1", | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |     "name": "mongod", | ||||||
|  |     "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "logappend": true, | ||||||
|  |         "journal": true, | ||||||
|  |         "storageEngine": "mmapv1", | ||||||
|  |         "port": 27017 | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |   "name": "mongod", | ||||||
|  |   "procParams": { | ||||||
|  |     "networkMessageCompressors": "snappy,zlib", | ||||||
|  |     "ipv6": true, | ||||||
|  |     "bind_ip": "127.0.0.1,::1", | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |   "name": "mongod", | ||||||
|  |   "procParams": { | ||||||
|  |     "networkMessageCompressors": "snappy", | ||||||
|  |     "ipv6": true, | ||||||
|  |     "bind_ip": "127.0.0.1,::1", | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |     "name": "mongod", | ||||||
|  |     "procParams": { | ||||||
|  |         "ipv6": true, | ||||||
|  |         "bind_ip": "127.0.0.1,::1", | ||||||
|  |         "logappend": true, | ||||||
|  |         "journal": true, | ||||||
|  |         "storageEngine": "wiredTiger", | ||||||
|  |         "port": 27017 | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |   "name": "mongod", | ||||||
|  |   "procParams": { | ||||||
|  |     "networkMessageCompressors": "zlib", | ||||||
|  |     "ipv6": true, | ||||||
|  |     "bind_ip": "127.0.0.1,::1", | ||||||
|  |     "logappend": true, | ||||||
|  |     "journal": true, | ||||||
|  |     "port": 27017 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,56 @@ | |||||||
|  | { | ||||||
|  |   "id": "shard_cluster_1", | ||||||
|  |   "login": "bob", | ||||||
|  |   "password": "pwd123", | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "shards": [ | ||||||
|  |     { | ||||||
|  |       "id": "sh01", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [{ | ||||||
|  |           "procParams": { | ||||||
|  |             "ipv6": true, | ||||||
|  |             "bind_ip": "127.0.0.1,::1", | ||||||
|  |             "shardsvr": true, | ||||||
|  |             "setParameter" : { "enableTestCommands": 1 }, | ||||||
|  |             "port": 27217 | ||||||
|  |           } | ||||||
|  |         }] | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "id": "sh02", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [{ | ||||||
|  |           "procParams": { | ||||||
|  |             "ipv6": true, | ||||||
|  |             "bind_ip": "127.0.0.1,::1", | ||||||
|  |             "shardsvr": true, | ||||||
|  |             "setParameter" : { "enableTestCommands": 1 }, | ||||||
|  |             "port": 27218 | ||||||
|  |           } | ||||||
|  |         }] | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "routers": [ | ||||||
|  |     { | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1", | ||||||
|  |       "setParameter" : { "enableTestCommands": 1 }, | ||||||
|  |       "port": 27017 | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1", | ||||||
|  |       "setParameter" : { "enableTestCommands": 1 }, | ||||||
|  |       "port": 27018 | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "sslParams": { | ||||||
|  |     "sslOnNormalPorts": true, | ||||||
|  |     "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |     "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |     "sslWeakCertificateValidation" : true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,58 @@ | |||||||
|  | { | ||||||
|  |   "id": "shard_cluster_1", | ||||||
|  |   "login": "bob", | ||||||
|  |   "password": "pwd123", | ||||||
|  |   "auth_key": "secret", | ||||||
|  |   "shards": [ | ||||||
|  |     { | ||||||
|  |       "id": "sh01", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27217 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27218 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "id": "sh02", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27219 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27220 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "routers": [ | ||||||
|  |     { | ||||||
|  |       "port": 27017, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "port": 27018, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -0,0 +1,62 @@ | |||||||
|  | { | ||||||
|  |   "id": "shard_cluster_1", | ||||||
|  |   "shards": [ | ||||||
|  |     { | ||||||
|  |       "id": "sh01", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27217 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27218 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "id": "sh02", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27219 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27220 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "routers": [ | ||||||
|  |     { | ||||||
|  |       "port": 27017, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "port": 27018, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "sslParams": { | ||||||
|  |       "sslMode": "requireSSL", | ||||||
|  |       "sslPEMKeyFile": "/tmp/orchestration-home/server.pem", | ||||||
|  |       "sslCAFile": "/tmp/orchestration-home/ca.pem", | ||||||
|  |       "sslAllowInvalidCertificates": true, | ||||||
|  |       "sslWeakCertificateValidation" : true | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,55 @@ | |||||||
|  | { | ||||||
|  |   "id": "shard_cluster_1", | ||||||
|  |   "shards": [ | ||||||
|  |     { | ||||||
|  |       "id": "sh01", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27217 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27218 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "id": "sh02", | ||||||
|  |       "shardParams": { | ||||||
|  |         "members": [ | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27219 | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |           { | ||||||
|  |             "procParams": { | ||||||
|  |               "shardsvr": true, | ||||||
|  |               "port": 27220 | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         ] | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "routers": [ | ||||||
|  |     { | ||||||
|  |       "port": 27017, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "port": 27018, | ||||||
|  |       "ipv6": true, | ||||||
|  |       "bind_ip": "127.0.0.1,::1" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | # sub-directory 'libbson' was already included at the top-level | ||||||
|  | # sub-directory 'libmongoc' was already included at the top-level | ||||||
|  | add_subdirectory (tools) | ||||||
|  | add_subdirectory (common) | ||||||
|  |  | ||||||
|  | # zconf.h is generated by configure_file() in the parent CMakeLists.txt | ||||||
|  | extra_dist_generated (zlib-1.2.11/zconf.h) | ||||||
|  | set (src_zlib_DIST | ||||||
|  |    src/zlib-1.2.11/crc32.h | ||||||
|  |    src/zlib-1.2.11/deflate.h | ||||||
|  |    src/zlib-1.2.11/gzguts.h | ||||||
|  |    src/zlib-1.2.11/inffast.h | ||||||
|  |    src/zlib-1.2.11/inffixed.h | ||||||
|  |    src/zlib-1.2.11/inflate.h | ||||||
|  |    src/zlib-1.2.11/inftrees.h | ||||||
|  |    src/zlib-1.2.11/trees.h | ||||||
|  |    src/zlib-1.2.11/zconf.h.in | ||||||
|  |    src/zlib-1.2.11/zlib.h | ||||||
|  |    src/zlib-1.2.11/zutil.h | ||||||
|  | ) | ||||||
|  | # Strip leading directory components to make the paths relative for MakeDist. | ||||||
|  | # The ZLIB_SOURCES list is set in the top-level CMakeLists.txt. | ||||||
|  | foreach (zlib_src IN LISTS ZLIB_SOURCES) | ||||||
|  |    string (REPLACE "${SOURCE_DIR}/" "" zlib_src_rel ${zlib_src}) | ||||||
|  |    list (APPEND src_zlib_DIST ${zlib_src_rel}) | ||||||
|  | endforeach () | ||||||
|  |  | ||||||
|  | set_local_dist (src_DIST_local | ||||||
|  |    CMakeLists.txt | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (src_DIST | ||||||
|  |    ${src_DIST_local} | ||||||
|  |    ${src_tools_DIST} | ||||||
|  |    ${src_zlib_DIST} | ||||||
|  |    ${src_common_DIST} | ||||||
|  |    PARENT_SCOPE | ||||||
|  | ) | ||||||
| @@ -0,0 +1,16 @@ | |||||||
|  | set (src_common_DIST_noinst_hs | ||||||
|  |    common-b64-private.h | ||||||
|  |    common-md5-private.h | ||||||
|  |    common-thread-private.h | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (src_common_DIST_cs | ||||||
|  |    common-b64.c | ||||||
|  |    common-md5.c | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set_dist_list (src_common_DIST | ||||||
|  |    CMakeLists.txt | ||||||
|  |    ${src_common_DIST_cs} | ||||||
|  |    ${src_common_DIST_noinst_hs} | ||||||
|  | ) | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright 2018-present MongoDB Inc. | ||||||
|  |  * | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef COMMON_B64_PRIVATE_H | ||||||
|  | #define COMMON_B64_PRIVATE_H | ||||||
|  |  | ||||||
|  | #if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ | ||||||
|  |    !defined(BSON_INSIDE) | ||||||
|  | #error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly." | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include <bson/bson.h> | ||||||
|  |  | ||||||
|  | int | ||||||
|  | bson_b64_ntop (uint8_t const *src, | ||||||
|  |                size_t srclength, | ||||||
|  |                char *target, | ||||||
|  |                size_t targsize); | ||||||
|  |  | ||||||
|  | int | ||||||
|  | bson_b64_pton (char const *src, uint8_t *target, size_t targsize); | ||||||
|  |  | ||||||
|  | #endif /* COMMON_B64_PRIVATE_H */ | ||||||
							
								
								
									
										528
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										528
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-b64.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,528 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright (c) 1996, 1998 by Internet Software Consortium. | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this software for any | ||||||
|  |  * purpose with or without fee is hereby granted, provided that the above | ||||||
|  |  * copyright notice and this permission notice appear in all copies. | ||||||
|  |  * | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS | ||||||
|  |  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | ||||||
|  |  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE | ||||||
|  |  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | ||||||
|  |  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | ||||||
|  |  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | ||||||
|  |  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||||||
|  |  * SOFTWARE. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Portions Copyright (c) 1995 by International Business Machines, Inc. | ||||||
|  |  * | ||||||
|  |  * International Business Machines, Inc. (hereinafter called IBM) grants | ||||||
|  |  * permission under its copyrights to use, copy, modify, and distribute this | ||||||
|  |  * Software with or without fee, provided that the above copyright notice and | ||||||
|  |  * all paragraphs of this notice appear in all copies, and that the name of IBM | ||||||
|  |  * not be used in connection with the marketing of any product incorporating | ||||||
|  |  * the Software or modifications thereof, without specific, written prior | ||||||
|  |  * permission. | ||||||
|  |  * | ||||||
|  |  * To the extent it has a right to do so, IBM grants an immunity from suit | ||||||
|  |  * under its patents, if any, for the use, sale or manufacture of products to | ||||||
|  |  * the extent that such products are used for performing Domain Name System | ||||||
|  |  * dynamic updates in TCP/IP networks by means of the Software.  No immunity is | ||||||
|  |  * granted for any product per se or for any other function of any product. | ||||||
|  |  * | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, | ||||||
|  |  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||||||
|  |  * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, | ||||||
|  |  * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING | ||||||
|  |  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN | ||||||
|  |  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "bson/bson.h" | ||||||
|  | #include "common-b64-private.h" | ||||||
|  |  | ||||||
|  | #define Assert(Cond) \ | ||||||
|  |    if (!(Cond))      \ | ||||||
|  |    abort () | ||||||
|  |  | ||||||
|  | static const char Base64[] = | ||||||
|  |    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||||||
|  | static const char Pad64 = '='; | ||||||
|  |  | ||||||
|  | /* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) | ||||||
|  |  * The following encoding technique is taken from RFC 1521 by Borenstein | ||||||
|  |  * and Freed.  It is reproduced here in a slightly edited form for | ||||||
|  |  * convenience. | ||||||
|  |  * | ||||||
|  |  * A 65-character subset of US-ASCII is used, enabling 6 bits to be | ||||||
|  |  * represented per printable character. (The extra 65th character, "=", | ||||||
|  |  * is used to signify a special processing function.) | ||||||
|  |  * | ||||||
|  |  * The encoding process represents 24-bit groups of input bits as output | ||||||
|  |  * strings of 4 encoded characters. Proceeding from left to right, a | ||||||
|  |  * 24-bit input group is formed by concatenating 3 8-bit input groups. | ||||||
|  |  * These 24 bits are then treated as 4 concatenated 6-bit groups, each | ||||||
|  |  * of which is translated into a single digit in the base64 alphabet. | ||||||
|  |  * | ||||||
|  |  * Each 6-bit group is used as an index into an array of 64 printable | ||||||
|  |  * characters. The character referenced by the index is placed in the | ||||||
|  |  * output string. | ||||||
|  |  * | ||||||
|  |  *                       Table 1: The Base64 Alphabet | ||||||
|  |  * | ||||||
|  |  *    Value Encoding  Value Encoding  Value Encoding  Value Encoding | ||||||
|  |  *        0 A            17 R            34 i            51 z | ||||||
|  |  *        1 B            18 S            35 j            52 0 | ||||||
|  |  *        2 C            19 T            36 k            53 1 | ||||||
|  |  *        3 D            20 U            37 l            54 2 | ||||||
|  |  *        4 E            21 V            38 m            55 3 | ||||||
|  |  *        5 F            22 W            39 n            56 4 | ||||||
|  |  *        6 G            23 X            40 o            57 5 | ||||||
|  |  *        7 H            24 Y            41 p            58 6 | ||||||
|  |  *        8 I            25 Z            42 q            59 7 | ||||||
|  |  *        9 J            26 a            43 r            60 8 | ||||||
|  |  *       10 K            27 b            44 s            61 9 | ||||||
|  |  *       11 L            28 c            45 t            62 + | ||||||
|  |  *       12 M            29 d            46 u            63 / | ||||||
|  |  *       13 N            30 e            47 v | ||||||
|  |  *       14 O            31 f            48 w         (pad) = | ||||||
|  |  *       15 P            32 g            49 x | ||||||
|  |  *       16 Q            33 h            50 y | ||||||
|  |  * | ||||||
|  |  * Special processing is performed if fewer than 24 bits are available | ||||||
|  |  * at the end of the data being encoded.  A full encoding quantum is | ||||||
|  |  * always completed at the end of a quantity.  When fewer than 24 input | ||||||
|  |  * bits are available in an input group, zero bits are added (on the | ||||||
|  |  * right) to form an integral number of 6-bit groups.  Padding at the | ||||||
|  |  * end of the data is performed using the '=' character. | ||||||
|  |  * | ||||||
|  |  * Since all base64 input is an integral number of octets, only the | ||||||
|  |  * following cases can arise: | ||||||
|  |  * | ||||||
|  |  *     (1) the final quantum of encoding input is an integral | ||||||
|  |  *         multiple of 24 bits; here, the final unit of encoded | ||||||
|  |  *    output will be an integral multiple of 4 characters | ||||||
|  |  *    with no "=" padding, | ||||||
|  |  *     (2) the final quantum of encoding input is exactly 8 bits; | ||||||
|  |  *         here, the final unit of encoded output will be two | ||||||
|  |  *    characters followed by two "=" padding characters, or | ||||||
|  |  *     (3) the final quantum of encoding input is exactly 16 bits; | ||||||
|  |  *         here, the final unit of encoded output will be three | ||||||
|  |  *    characters followed by one "=" padding character. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | int | ||||||
|  | bson_b64_ntop (uint8_t const *src, | ||||||
|  |                size_t srclength, | ||||||
|  |                char *target, | ||||||
|  |                size_t targsize) | ||||||
|  | { | ||||||
|  |    size_t datalength = 0; | ||||||
|  |    uint8_t input[3]; | ||||||
|  |    uint8_t output[4]; | ||||||
|  |    size_t i; | ||||||
|  |  | ||||||
|  |    while (2 < srclength) { | ||||||
|  |       input[0] = *src++; | ||||||
|  |       input[1] = *src++; | ||||||
|  |       input[2] = *src++; | ||||||
|  |       srclength -= 3; | ||||||
|  |  | ||||||
|  |       output[0] = input[0] >> 2; | ||||||
|  |       output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); | ||||||
|  |       output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); | ||||||
|  |       output[3] = input[2] & 0x3f; | ||||||
|  |       Assert (output[0] < 64); | ||||||
|  |       Assert (output[1] < 64); | ||||||
|  |       Assert (output[2] < 64); | ||||||
|  |       Assert (output[3] < 64); | ||||||
|  |  | ||||||
|  |       if (datalength + 4 > targsize) { | ||||||
|  |          return -1; | ||||||
|  |       } | ||||||
|  |       target[datalength++] = Base64[output[0]]; | ||||||
|  |       target[datalength++] = Base64[output[1]]; | ||||||
|  |       target[datalength++] = Base64[output[2]]; | ||||||
|  |       target[datalength++] = Base64[output[3]]; | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    /* Now we worry about padding. */ | ||||||
|  |    if (0 != srclength) { | ||||||
|  |       /* Get what's left. */ | ||||||
|  |       input[0] = input[1] = input[2] = '\0'; | ||||||
|  |  | ||||||
|  |       for (i = 0; i < srclength; i++) { | ||||||
|  |          input[i] = *src++; | ||||||
|  |       } | ||||||
|  |       output[0] = input[0] >> 2; | ||||||
|  |       output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); | ||||||
|  |       output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); | ||||||
|  |       Assert (output[0] < 64); | ||||||
|  |       Assert (output[1] < 64); | ||||||
|  |       Assert (output[2] < 64); | ||||||
|  |  | ||||||
|  |       if (datalength + 4 > targsize) { | ||||||
|  |          return -1; | ||||||
|  |       } | ||||||
|  |       target[datalength++] = Base64[output[0]]; | ||||||
|  |       target[datalength++] = Base64[output[1]]; | ||||||
|  |  | ||||||
|  |       if (srclength == 1) { | ||||||
|  |          target[datalength++] = Pad64; | ||||||
|  |       } else { | ||||||
|  |          target[datalength++] = Base64[output[2]]; | ||||||
|  |       } | ||||||
|  |       target[datalength++] = Pad64; | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    if (datalength >= targsize) { | ||||||
|  |       return -1; | ||||||
|  |    } | ||||||
|  |    target[datalength] = '\0'; /* Returned value doesn't count \0. */ | ||||||
|  |    return (int) datalength; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) | ||||||
|  |    The following encoding technique is taken from RFC 1521 by Borenstein | ||||||
|  |    and Freed.  It is reproduced here in a slightly edited form for | ||||||
|  |    convenience. | ||||||
|  |  | ||||||
|  |    A 65-character subset of US-ASCII is used, enabling 6 bits to be | ||||||
|  |    represented per printable character. (The extra 65th character, "=", | ||||||
|  |    is used to signify a special processing function.) | ||||||
|  |  | ||||||
|  |    The encoding process represents 24-bit groups of input bits as output | ||||||
|  |    strings of 4 encoded characters. Proceeding from left to right, a | ||||||
|  |    24-bit input group is formed by concatenating 3 8-bit input groups. | ||||||
|  |    These 24 bits are then treated as 4 concatenated 6-bit groups, each | ||||||
|  |    of which is translated into a single digit in the base64 alphabet. | ||||||
|  |  | ||||||
|  |    Each 6-bit group is used as an index into an array of 64 printable | ||||||
|  |    characters. The character referenced by the index is placed in the | ||||||
|  |    output string. | ||||||
|  |  | ||||||
|  |                          Table 1: The Base64 Alphabet | ||||||
|  |  | ||||||
|  |       Value Encoding  Value Encoding  Value Encoding  Value Encoding | ||||||
|  |           0 A            17 R            34 i            51 z | ||||||
|  |           1 B            18 S            35 j            52 0 | ||||||
|  |           2 C            19 T            36 k            53 1 | ||||||
|  |           3 D            20 U            37 l            54 2 | ||||||
|  |           4 E            21 V            38 m            55 3 | ||||||
|  |           5 F            22 W            39 n            56 4 | ||||||
|  |           6 G            23 X            40 o            57 5 | ||||||
|  |           7 H            24 Y            41 p            58 6 | ||||||
|  |           8 I            25 Z            42 q            59 7 | ||||||
|  |           9 J            26 a            43 r            60 8 | ||||||
|  |          10 K            27 b            44 s            61 9 | ||||||
|  |          11 L            28 c            45 t            62 + | ||||||
|  |          12 M            29 d            46 u            63 / | ||||||
|  |          13 N            30 e            47 v | ||||||
|  |          14 O            31 f            48 w         (pad) = | ||||||
|  |          15 P            32 g            49 x | ||||||
|  |          16 Q            33 h            50 y | ||||||
|  |  | ||||||
|  |    Special processing is performed if fewer than 24 bits are available | ||||||
|  |    at the end of the data being encoded.  A full encoding quantum is | ||||||
|  |    always completed at the end of a quantity.  When fewer than 24 input | ||||||
|  |    bits are available in an input group, zero bits are added (on the | ||||||
|  |    right) to form an integral number of 6-bit groups.  Padding at the | ||||||
|  |    end of the data is performed using the '=' character. | ||||||
|  |  | ||||||
|  |    Since all base64 input is an integral number of octets, only the | ||||||
|  |    following cases can arise: | ||||||
|  |  | ||||||
|  |        (1) the final quantum of encoding input is an integral | ||||||
|  |            multiple of 24 bits; here, the final unit of encoded | ||||||
|  |       output will be an integral multiple of 4 characters | ||||||
|  |       with no "=" padding, | ||||||
|  |        (2) the final quantum of encoding input is exactly 8 bits; | ||||||
|  |            here, the final unit of encoded output will be two | ||||||
|  |       characters followed by two "=" padding characters, or | ||||||
|  |        (3) the final quantum of encoding input is exactly 16 bits; | ||||||
|  |            here, the final unit of encoded output will be three | ||||||
|  |       characters followed by one "=" padding character. | ||||||
|  |    */ | ||||||
|  |  | ||||||
|  | /* skips all whitespace anywhere. | ||||||
|  |    converts characters, four at a time, starting at (or after) | ||||||
|  |    src from base - 64 numbers into three 8 bit bytes in the target area. | ||||||
|  |    it returns the number of data bytes stored at the target, or -1 on error. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | static uint8_t mongoc_b64rmap[256]; | ||||||
|  |  | ||||||
|  | static const uint8_t mongoc_b64rmap_special = 0xf0; | ||||||
|  | static const uint8_t mongoc_b64rmap_end = 0xfd; | ||||||
|  | static const uint8_t mongoc_b64rmap_space = 0xfe; | ||||||
|  | static const uint8_t mongoc_b64rmap_invalid = 0xff; | ||||||
|  |  | ||||||
|  | /* initializing the reverse map isn't thread safe, do it in pthread_once */ | ||||||
|  | #if defined(BSON_OS_UNIX) | ||||||
|  | #include <pthread.h> | ||||||
|  | #define mongoc_common_once_t pthread_once_t | ||||||
|  | #define mongoc_common_once pthread_once | ||||||
|  | #define MONGOC_COMMON_ONCE_FUN(n) void n (void) | ||||||
|  | #define MONGOC_COMMON_ONCE_RETURN return | ||||||
|  | #define MONGOC_COMMON_ONCE_INIT PTHREAD_ONCE_INIT | ||||||
|  | #else | ||||||
|  | #define mongoc_common_once_t INIT_ONCE | ||||||
|  | #define MONGOC_COMMON_ONCE_INIT INIT_ONCE_STATIC_INIT | ||||||
|  | #define mongoc_common_once(o, c) InitOnceExecuteOnce (o, c, NULL, NULL) | ||||||
|  | #define MONGOC_COMMON_ONCE_FUN(n) \ | ||||||
|  |    BOOL CALLBACK n (PINIT_ONCE _ignored_a, PVOID _ignored_b, PVOID *_ignored_c) | ||||||
|  | #define MONGOC_COMMON_ONCE_RETURN return true | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | static MONGOC_COMMON_ONCE_FUN (bson_b64_initialize_rmap) | ||||||
|  | { | ||||||
|  |    int i; | ||||||
|  |    unsigned char ch; | ||||||
|  |  | ||||||
|  |    /* Null: end of string, stop parsing */ | ||||||
|  |    mongoc_b64rmap[0] = mongoc_b64rmap_end; | ||||||
|  |  | ||||||
|  |    for (i = 1; i < 256; ++i) { | ||||||
|  |       ch = (unsigned char) i; | ||||||
|  |       /* Whitespaces */ | ||||||
|  |       if (isspace (ch)) | ||||||
|  |          mongoc_b64rmap[i] = mongoc_b64rmap_space; | ||||||
|  |       /* Padding: stop parsing */ | ||||||
|  |       else if (ch == Pad64) | ||||||
|  |          mongoc_b64rmap[i] = mongoc_b64rmap_end; | ||||||
|  |       /* Non-base64 char */ | ||||||
|  |       else | ||||||
|  |          mongoc_b64rmap[i] = mongoc_b64rmap_invalid; | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    /* Fill reverse mapping for base64 chars */ | ||||||
|  |    for (i = 0; Base64[i] != '\0'; ++i) | ||||||
|  |       mongoc_b64rmap[(uint8_t) Base64[i]] = i; | ||||||
|  |  | ||||||
|  |    MONGOC_COMMON_ONCE_RETURN; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | mongoc_b64_pton_do (char const *src, uint8_t *target, size_t targsize) | ||||||
|  | { | ||||||
|  |    int tarindex, state, ch; | ||||||
|  |    uint8_t ofs; | ||||||
|  |  | ||||||
|  |    state = 0; | ||||||
|  |    tarindex = 0; | ||||||
|  |  | ||||||
|  |    while (1) { | ||||||
|  |       ch = *src++; | ||||||
|  |       ofs = mongoc_b64rmap[ch]; | ||||||
|  |  | ||||||
|  |       if (ofs >= mongoc_b64rmap_special) { | ||||||
|  |          /* Ignore whitespaces */ | ||||||
|  |          if (ofs == mongoc_b64rmap_space) | ||||||
|  |             continue; | ||||||
|  |          /* End of base64 characters */ | ||||||
|  |          if (ofs == mongoc_b64rmap_end) | ||||||
|  |             break; | ||||||
|  |          /* A non-base64 character. */ | ||||||
|  |          return (-1); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       switch (state) { | ||||||
|  |       case 0: | ||||||
|  |          if ((size_t) tarindex >= targsize) | ||||||
|  |             return (-1); | ||||||
|  |          target[tarindex] = ofs << 2; | ||||||
|  |          state = 1; | ||||||
|  |          break; | ||||||
|  |       case 1: | ||||||
|  |          if ((size_t) tarindex + 1 >= targsize) | ||||||
|  |             return (-1); | ||||||
|  |          target[tarindex] |= ofs >> 4; | ||||||
|  |          target[tarindex + 1] = (ofs & 0x0f) << 4; | ||||||
|  |          tarindex++; | ||||||
|  |          state = 2; | ||||||
|  |          break; | ||||||
|  |       case 2: | ||||||
|  |          if ((size_t) tarindex + 1 >= targsize) | ||||||
|  |             return (-1); | ||||||
|  |          target[tarindex] |= ofs >> 2; | ||||||
|  |          target[tarindex + 1] = (ofs & 0x03) << 6; | ||||||
|  |          tarindex++; | ||||||
|  |          state = 3; | ||||||
|  |          break; | ||||||
|  |       case 3: | ||||||
|  |          if ((size_t) tarindex >= targsize) | ||||||
|  |             return (-1); | ||||||
|  |          target[tarindex] |= ofs; | ||||||
|  |          tarindex++; | ||||||
|  |          state = 0; | ||||||
|  |          break; | ||||||
|  |       default: | ||||||
|  |          abort (); | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    /* | ||||||
|  |     * We are done decoding Base-64 chars.  Let's see if we ended | ||||||
|  |     * on a byte boundary, and/or with erroneous trailing characters. | ||||||
|  |     */ | ||||||
|  |  | ||||||
|  |    if (ch == Pad64) { /* We got a pad char. */ | ||||||
|  |       ch = *src++;    /* Skip it, get next. */ | ||||||
|  |       switch (state) { | ||||||
|  |       case 0: /* Invalid = in first position */ | ||||||
|  |       case 1: /* Invalid = in second position */ | ||||||
|  |          return (-1); | ||||||
|  |  | ||||||
|  |       case 2: /* Valid, means one byte of info */ | ||||||
|  |          /* Skip any number of spaces. */ | ||||||
|  |          for ((void) NULL; ch != '\0'; ch = *src++) | ||||||
|  |             if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) | ||||||
|  |                break; | ||||||
|  |          /* Make sure there is another trailing = sign. */ | ||||||
|  |          if (ch != Pad64) | ||||||
|  |             return (-1); | ||||||
|  |          ch = *src++; /* Skip the = */ | ||||||
|  |       /* Fall through to "single trailing =" case. */ | ||||||
|  |       /* FALLTHROUGH */ | ||||||
|  |  | ||||||
|  |       case 3: /* Valid, means two bytes of info */ | ||||||
|  |          /* | ||||||
|  |           * We know this char is an =.  Is there anything but | ||||||
|  |           * whitespace after it? | ||||||
|  |           */ | ||||||
|  |          for ((void) NULL; ch != '\0'; ch = *src++) | ||||||
|  |             if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) | ||||||
|  |                return (-1); | ||||||
|  |  | ||||||
|  |          /* | ||||||
|  |           * Now make sure for cases 2 and 3 that the "extra" | ||||||
|  |           * bits that slopped past the last full byte were | ||||||
|  |           * zeros.  If we don't check them, they become a | ||||||
|  |           * subliminal channel. | ||||||
|  |           */ | ||||||
|  |          if (target[tarindex] != 0) | ||||||
|  |             return (-1); | ||||||
|  |       default: | ||||||
|  |          break; | ||||||
|  |       } | ||||||
|  |    } else { | ||||||
|  |       /* | ||||||
|  |        * We ended by seeing the end of the string.  Make sure we | ||||||
|  |        * have no partial bytes lying around. | ||||||
|  |        */ | ||||||
|  |       if (state != 0) | ||||||
|  |          return (-1); | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    return (tarindex); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static int | ||||||
|  | mongoc_b64_pton_len (char const *src) | ||||||
|  | { | ||||||
|  |    int tarindex, state, ch; | ||||||
|  |    uint8_t ofs; | ||||||
|  |  | ||||||
|  |    state = 0; | ||||||
|  |    tarindex = 0; | ||||||
|  |  | ||||||
|  |    while (1) { | ||||||
|  |       ch = *src++; | ||||||
|  |       ofs = mongoc_b64rmap[ch]; | ||||||
|  |  | ||||||
|  |       if (ofs >= mongoc_b64rmap_special) { | ||||||
|  |          /* Ignore whitespaces */ | ||||||
|  |          if (ofs == mongoc_b64rmap_space) | ||||||
|  |             continue; | ||||||
|  |          /* End of base64 characters */ | ||||||
|  |          if (ofs == mongoc_b64rmap_end) | ||||||
|  |             break; | ||||||
|  |          /* A non-base64 character. */ | ||||||
|  |          return (-1); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       switch (state) { | ||||||
|  |       case 0: | ||||||
|  |          state = 1; | ||||||
|  |          break; | ||||||
|  |       case 1: | ||||||
|  |          tarindex++; | ||||||
|  |          state = 2; | ||||||
|  |          break; | ||||||
|  |       case 2: | ||||||
|  |          tarindex++; | ||||||
|  |          state = 3; | ||||||
|  |          break; | ||||||
|  |       case 3: | ||||||
|  |          tarindex++; | ||||||
|  |          state = 0; | ||||||
|  |          break; | ||||||
|  |       default: | ||||||
|  |          abort (); | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    /* | ||||||
|  |     * We are done decoding Base-64 chars.  Let's see if we ended | ||||||
|  |     * on a byte boundary, and/or with erroneous trailing characters. | ||||||
|  |     */ | ||||||
|  |  | ||||||
|  |    if (ch == Pad64) { /* We got a pad char. */ | ||||||
|  |       ch = *src++;    /* Skip it, get next. */ | ||||||
|  |       switch (state) { | ||||||
|  |       case 0: /* Invalid = in first position */ | ||||||
|  |       case 1: /* Invalid = in second position */ | ||||||
|  |          return (-1); | ||||||
|  |  | ||||||
|  |       case 2: /* Valid, means one byte of info */ | ||||||
|  |          /* Skip any number of spaces. */ | ||||||
|  |          for ((void) NULL; ch != '\0'; ch = *src++) | ||||||
|  |             if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) | ||||||
|  |                break; | ||||||
|  |          /* Make sure there is another trailing = sign. */ | ||||||
|  |          if (ch != Pad64) | ||||||
|  |             return (-1); | ||||||
|  |          ch = *src++; /* Skip the = */ | ||||||
|  |       /* Fall through to "single trailing =" case. */ | ||||||
|  |       /* FALLTHROUGH */ | ||||||
|  |  | ||||||
|  |       case 3: /* Valid, means two bytes of info */ | ||||||
|  |          /* | ||||||
|  |           * We know this char is an =.  Is there anything but | ||||||
|  |           * whitespace after it? | ||||||
|  |           */ | ||||||
|  |          for ((void) NULL; ch != '\0'; ch = *src++) | ||||||
|  |             if (mongoc_b64rmap[ch] != mongoc_b64rmap_space) | ||||||
|  |                return (-1); | ||||||
|  |  | ||||||
|  |       default: | ||||||
|  |          break; | ||||||
|  |       } | ||||||
|  |    } else { | ||||||
|  |       /* | ||||||
|  |        * We ended by seeing the end of the string.  Make sure we | ||||||
|  |        * have no partial bytes lying around. | ||||||
|  |        */ | ||||||
|  |       if (state != 0) | ||||||
|  |          return (-1); | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    return (tarindex); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int | ||||||
|  | bson_b64_pton (char const *src, uint8_t *target, size_t targsize) | ||||||
|  | { | ||||||
|  |    static mongoc_common_once_t once = MONGOC_COMMON_ONCE_INIT; | ||||||
|  |  | ||||||
|  |    mongoc_common_once (&once, bson_b64_initialize_rmap); | ||||||
|  |  | ||||||
|  |    if (target) | ||||||
|  |       return mongoc_b64_pton_do (src, target, targsize); | ||||||
|  |    else | ||||||
|  |       return mongoc_b64_pton_len (src); | ||||||
|  | } | ||||||
| @@ -0,0 +1,39 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright 2018-present MongoDB, Inc. | ||||||
|  |  * | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef COMMON_MD5_PRIVATE_H | ||||||
|  | #define COMMON_MD5_PRIVATE_H | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ | ||||||
|  |    !defined(BSON_INSIDE) | ||||||
|  | #error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly." | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include "bson/bson.h" | ||||||
|  |  | ||||||
|  | BSON_BEGIN_DECLS | ||||||
|  |  | ||||||
|  | void | ||||||
|  | _bson_md5_init (bson_md5_t *pms); | ||||||
|  | void | ||||||
|  | _bson_md5_append (bson_md5_t *pms, const uint8_t *data, uint32_t nbytes); | ||||||
|  | void | ||||||
|  | _bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]); | ||||||
|  |  | ||||||
|  | BSON_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* COMMON_MD5_PRIVATE_H */ | ||||||
							
								
								
									
										395
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										395
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/common/common-md5.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,395 @@ | |||||||
|  | /* | ||||||
|  |   Copyright (C) 1999, 2000, 2002 Aladdin Enterprises.  All rights reserved. | ||||||
|  |  | ||||||
|  |   This software is provided 'as-is', without any express or implied | ||||||
|  |   warranty.  In no event will the authors be held liable for any damages | ||||||
|  |   arising from the use of this software. | ||||||
|  |  | ||||||
|  |   Permission is granted to anyone to use this software for any purpose, | ||||||
|  |   including commercial applications, and to alter it and redistribute it | ||||||
|  |   freely, subject to the following restrictions: | ||||||
|  |  | ||||||
|  |   1. The origin of this software must not be misrepresented; you must not | ||||||
|  |      claim that you wrote the original software. If you use this software | ||||||
|  |      in a product, an acknowledgement in the product documentation would be | ||||||
|  |      appreciated but is not required. | ||||||
|  |   2. Altered source versions must be plainly marked as such, and must not be | ||||||
|  |      misrepresented as being the original software. | ||||||
|  |   3. This notice may not be removed or altered from any source distribution. | ||||||
|  |  | ||||||
|  |   L. Peter Deutsch | ||||||
|  |   ghost@aladdin.com | ||||||
|  |  | ||||||
|  |  */ | ||||||
|  | /* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ | ||||||
|  | /* | ||||||
|  |   Independent implementation of MD5 (RFC 1321). | ||||||
|  |  | ||||||
|  |   This code implements the MD5 Algorithm defined in RFC 1321, whose | ||||||
|  |   text is available at | ||||||
|  |     http://www.ietf.org/rfc/rfc1321.txt | ||||||
|  |   The code is derived from the text of the RFC, including the test suite | ||||||
|  |   (section A.5) but excluding the rest of Appendix A.  It does not include | ||||||
|  |   any code or documentation that is identified in the RFC as being | ||||||
|  |   copyrighted. | ||||||
|  |  | ||||||
|  |   The original and principal author of md5.c is L. Peter Deutsch | ||||||
|  |   <ghost@aladdin.com>.  Other authors are noted in the change history | ||||||
|  |   that follows (in reverse chronological order): | ||||||
|  |  | ||||||
|  |   2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order | ||||||
|  |     either statically or dynamically; added missing #include <string.h> | ||||||
|  |     in library. | ||||||
|  |   2002-03-11 lpd Corrected argument list for main(), and added int return | ||||||
|  |     type, in test program and T value program. | ||||||
|  |   2002-02-21 lpd Added missing #include <stdio.h> in test program. | ||||||
|  |   2000-07-03 lpd Patched to eliminate warnings about "constant is | ||||||
|  |     unsigned in ANSI C, signed in traditional"; made test program | ||||||
|  |     self-checking. | ||||||
|  |   1999-11-04 lpd Edited comments slightly for automatic TOC extraction. | ||||||
|  |   1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). | ||||||
|  |   1999-05-03 lpd Original version. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * The following MD5 implementation has been modified to use types as | ||||||
|  |  * specified in libbson. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include <string.h> | ||||||
|  |  | ||||||
|  | #include "common-md5-private.h" | ||||||
|  |  | ||||||
|  | #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ | ||||||
|  | #if BSON_BYTE_ORDER == BSON_BIG_ENDIAN | ||||||
|  | #define BYTE_ORDER 1 | ||||||
|  | #else | ||||||
|  | #define BYTE_ORDER -1 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #define T_MASK ((uint32_t) ~0) | ||||||
|  | #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) | ||||||
|  | #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) | ||||||
|  | #define T3 0x242070db | ||||||
|  | #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) | ||||||
|  | #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) | ||||||
|  | #define T6 0x4787c62a | ||||||
|  | #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) | ||||||
|  | #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) | ||||||
|  | #define T9 0x698098d8 | ||||||
|  | #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) | ||||||
|  | #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) | ||||||
|  | #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) | ||||||
|  | #define T13 0x6b901122 | ||||||
|  | #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) | ||||||
|  | #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) | ||||||
|  | #define T16 0x49b40821 | ||||||
|  | #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) | ||||||
|  | #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) | ||||||
|  | #define T19 0x265e5a51 | ||||||
|  | #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) | ||||||
|  | #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) | ||||||
|  | #define T22 0x02441453 | ||||||
|  | #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) | ||||||
|  | #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) | ||||||
|  | #define T25 0x21e1cde6 | ||||||
|  | #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) | ||||||
|  | #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) | ||||||
|  | #define T28 0x455a14ed | ||||||
|  | #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) | ||||||
|  | #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) | ||||||
|  | #define T31 0x676f02d9 | ||||||
|  | #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) | ||||||
|  | #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) | ||||||
|  | #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) | ||||||
|  | #define T35 0x6d9d6122 | ||||||
|  | #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) | ||||||
|  | #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) | ||||||
|  | #define T38 0x4bdecfa9 | ||||||
|  | #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) | ||||||
|  | #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) | ||||||
|  | #define T41 0x289b7ec6 | ||||||
|  | #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) | ||||||
|  | #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) | ||||||
|  | #define T44 0x04881d05 | ||||||
|  | #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) | ||||||
|  | #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) | ||||||
|  | #define T47 0x1fa27cf8 | ||||||
|  | #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) | ||||||
|  | #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) | ||||||
|  | #define T50 0x432aff97 | ||||||
|  | #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) | ||||||
|  | #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) | ||||||
|  | #define T53 0x655b59c3 | ||||||
|  | #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) | ||||||
|  | #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) | ||||||
|  | #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) | ||||||
|  | #define T57 0x6fa87e4f | ||||||
|  | #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) | ||||||
|  | #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) | ||||||
|  | #define T60 0x4e0811a1 | ||||||
|  | #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) | ||||||
|  | #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) | ||||||
|  | #define T63 0x2ad7d2bb | ||||||
|  | #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static void | ||||||
|  | bson_md5_process (bson_md5_t *md5, const uint8_t *data) | ||||||
|  | { | ||||||
|  |    uint32_t a = md5->abcd[0]; | ||||||
|  |    uint32_t b = md5->abcd[1]; | ||||||
|  |    uint32_t c = md5->abcd[2]; | ||||||
|  |    uint32_t d = md5->abcd[3]; | ||||||
|  |    uint32_t t; | ||||||
|  |  | ||||||
|  | #if BYTE_ORDER > 0 | ||||||
|  |    /* Define storage only for big-endian CPUs. */ | ||||||
|  |    uint32_t X[16]; | ||||||
|  | #else | ||||||
|  |    /* Define storage for little-endian or both types of CPUs. */ | ||||||
|  |    uint32_t xbuf[16]; | ||||||
|  |    const uint32_t *X; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |    { | ||||||
|  | #if BYTE_ORDER == 0 | ||||||
|  |       /* | ||||||
|  |        * Determine dynamically whether this is a big-endian or | ||||||
|  |        * little-endian machine, since we can use a more efficient | ||||||
|  |        * algorithm on the latter. | ||||||
|  |        */ | ||||||
|  |       static const int w = 1; | ||||||
|  |  | ||||||
|  |       if (*((const uint8_t *) &w)) /* dynamic little-endian */ | ||||||
|  | #endif | ||||||
|  | #if BYTE_ORDER <= 0 /* little-endian */ | ||||||
|  |       { | ||||||
|  |          /* | ||||||
|  |           * On little-endian machines, we can process properly aligned | ||||||
|  |           * data without copying it. | ||||||
|  |           */ | ||||||
|  |          if (!((data - (const uint8_t *) 0) & 3)) { | ||||||
|  | /* data are properly aligned */ | ||||||
|  | #ifdef __clang__ | ||||||
|  | #pragma clang diagnostic push | ||||||
|  | #pragma clang diagnostic ignored "-Wcast-align" | ||||||
|  | #endif | ||||||
|  |             X = (const uint32_t *) data; | ||||||
|  | #ifdef __clang__ | ||||||
|  | #pragma clang diagnostic pop | ||||||
|  | #endif | ||||||
|  |          } else { | ||||||
|  |             /* not aligned */ | ||||||
|  |             memcpy (xbuf, data, sizeof (xbuf)); | ||||||
|  |             X = xbuf; | ||||||
|  |          } | ||||||
|  |       } | ||||||
|  | #endif | ||||||
|  | #if BYTE_ORDER == 0 | ||||||
|  |       else /* dynamic big-endian */ | ||||||
|  | #endif | ||||||
|  | #if BYTE_ORDER >= 0 /* big-endian */ | ||||||
|  |       { | ||||||
|  |          /* | ||||||
|  |           * On big-endian machines, we must arrange the bytes in the | ||||||
|  |           * right order. | ||||||
|  |           */ | ||||||
|  |          const uint8_t *xp = data; | ||||||
|  |          int i; | ||||||
|  |  | ||||||
|  | #if BYTE_ORDER == 0 | ||||||
|  |          X = xbuf; /* (dynamic only) */ | ||||||
|  | #else | ||||||
|  | #define xbuf X /* (static only) */ | ||||||
|  | #endif | ||||||
|  |          for (i = 0; i < 16; ++i, xp += 4) | ||||||
|  |             xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); | ||||||
|  |       } | ||||||
|  | #endif | ||||||
|  |    } | ||||||
|  |  | ||||||
|  | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) | ||||||
|  |  | ||||||
|  | /* Round 1. */ | ||||||
|  | /* Let [abcd k s i] denote the operation | ||||||
|  |    a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ | ||||||
|  | #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) | ||||||
|  | #define SET(a, b, c, d, k, s, Ti)   \ | ||||||
|  |    t = a + F (b, c, d) + X[k] + Ti; \ | ||||||
|  |    a = ROTATE_LEFT (t, s) + b | ||||||
|  |    /* Do the following 16 operations. */ | ||||||
|  |    SET (a, b, c, d, 0, 7, T1); | ||||||
|  |    SET (d, a, b, c, 1, 12, T2); | ||||||
|  |    SET (c, d, a, b, 2, 17, T3); | ||||||
|  |    SET (b, c, d, a, 3, 22, T4); | ||||||
|  |    SET (a, b, c, d, 4, 7, T5); | ||||||
|  |    SET (d, a, b, c, 5, 12, T6); | ||||||
|  |    SET (c, d, a, b, 6, 17, T7); | ||||||
|  |    SET (b, c, d, a, 7, 22, T8); | ||||||
|  |    SET (a, b, c, d, 8, 7, T9); | ||||||
|  |    SET (d, a, b, c, 9, 12, T10); | ||||||
|  |    SET (c, d, a, b, 10, 17, T11); | ||||||
|  |    SET (b, c, d, a, 11, 22, T12); | ||||||
|  |    SET (a, b, c, d, 12, 7, T13); | ||||||
|  |    SET (d, a, b, c, 13, 12, T14); | ||||||
|  |    SET (c, d, a, b, 14, 17, T15); | ||||||
|  |    SET (b, c, d, a, 15, 22, T16); | ||||||
|  | #undef SET | ||||||
|  |  | ||||||
|  | /* Round 2. */ | ||||||
|  | /* Let [abcd k s i] denote the operation | ||||||
|  |      a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ | ||||||
|  | #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) | ||||||
|  | #define SET(a, b, c, d, k, s, Ti)   \ | ||||||
|  |    t = a + G (b, c, d) + X[k] + Ti; \ | ||||||
|  |    a = ROTATE_LEFT (t, s) + b | ||||||
|  |    /* Do the following 16 operations. */ | ||||||
|  |    SET (a, b, c, d, 1, 5, T17); | ||||||
|  |    SET (d, a, b, c, 6, 9, T18); | ||||||
|  |    SET (c, d, a, b, 11, 14, T19); | ||||||
|  |    SET (b, c, d, a, 0, 20, T20); | ||||||
|  |    SET (a, b, c, d, 5, 5, T21); | ||||||
|  |    SET (d, a, b, c, 10, 9, T22); | ||||||
|  |    SET (c, d, a, b, 15, 14, T23); | ||||||
|  |    SET (b, c, d, a, 4, 20, T24); | ||||||
|  |    SET (a, b, c, d, 9, 5, T25); | ||||||
|  |    SET (d, a, b, c, 14, 9, T26); | ||||||
|  |    SET (c, d, a, b, 3, 14, T27); | ||||||
|  |    SET (b, c, d, a, 8, 20, T28); | ||||||
|  |    SET (a, b, c, d, 13, 5, T29); | ||||||
|  |    SET (d, a, b, c, 2, 9, T30); | ||||||
|  |    SET (c, d, a, b, 7, 14, T31); | ||||||
|  |    SET (b, c, d, a, 12, 20, T32); | ||||||
|  | #undef SET | ||||||
|  |  | ||||||
|  | /* Round 3. */ | ||||||
|  | /* Let [abcd k s t] denote the operation | ||||||
|  |      a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ | ||||||
|  | #define H(x, y, z) ((x) ^ (y) ^ (z)) | ||||||
|  | #define SET(a, b, c, d, k, s, Ti)   \ | ||||||
|  |    t = a + H (b, c, d) + X[k] + Ti; \ | ||||||
|  |    a = ROTATE_LEFT (t, s) + b | ||||||
|  |    /* Do the following 16 operations. */ | ||||||
|  |    SET (a, b, c, d, 5, 4, T33); | ||||||
|  |    SET (d, a, b, c, 8, 11, T34); | ||||||
|  |    SET (c, d, a, b, 11, 16, T35); | ||||||
|  |    SET (b, c, d, a, 14, 23, T36); | ||||||
|  |    SET (a, b, c, d, 1, 4, T37); | ||||||
|  |    SET (d, a, b, c, 4, 11, T38); | ||||||
|  |    SET (c, d, a, b, 7, 16, T39); | ||||||
|  |    SET (b, c, d, a, 10, 23, T40); | ||||||
|  |    SET (a, b, c, d, 13, 4, T41); | ||||||
|  |    SET (d, a, b, c, 0, 11, T42); | ||||||
|  |    SET (c, d, a, b, 3, 16, T43); | ||||||
|  |    SET (b, c, d, a, 6, 23, T44); | ||||||
|  |    SET (a, b, c, d, 9, 4, T45); | ||||||
|  |    SET (d, a, b, c, 12, 11, T46); | ||||||
|  |    SET (c, d, a, b, 15, 16, T47); | ||||||
|  |    SET (b, c, d, a, 2, 23, T48); | ||||||
|  | #undef SET | ||||||
|  |  | ||||||
|  | /* Round 4. */ | ||||||
|  | /* Let [abcd k s t] denote the operation | ||||||
|  |      a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ | ||||||
|  | #define I(x, y, z) ((y) ^ ((x) | ~(z))) | ||||||
|  | #define SET(a, b, c, d, k, s, Ti)   \ | ||||||
|  |    t = a + I (b, c, d) + X[k] + Ti; \ | ||||||
|  |    a = ROTATE_LEFT (t, s) + b | ||||||
|  |    /* Do the following 16 operations. */ | ||||||
|  |    SET (a, b, c, d, 0, 6, T49); | ||||||
|  |    SET (d, a, b, c, 7, 10, T50); | ||||||
|  |    SET (c, d, a, b, 14, 15, T51); | ||||||
|  |    SET (b, c, d, a, 5, 21, T52); | ||||||
|  |    SET (a, b, c, d, 12, 6, T53); | ||||||
|  |    SET (d, a, b, c, 3, 10, T54); | ||||||
|  |    SET (c, d, a, b, 10, 15, T55); | ||||||
|  |    SET (b, c, d, a, 1, 21, T56); | ||||||
|  |    SET (a, b, c, d, 8, 6, T57); | ||||||
|  |    SET (d, a, b, c, 15, 10, T58); | ||||||
|  |    SET (c, d, a, b, 6, 15, T59); | ||||||
|  |    SET (b, c, d, a, 13, 21, T60); | ||||||
|  |    SET (a, b, c, d, 4, 6, T61); | ||||||
|  |    SET (d, a, b, c, 11, 10, T62); | ||||||
|  |    SET (c, d, a, b, 2, 15, T63); | ||||||
|  |    SET (b, c, d, a, 9, 21, T64); | ||||||
|  | #undef SET | ||||||
|  |  | ||||||
|  |    /* Then perform the following additions. (That is increment each | ||||||
|  |       of the four registers by the value it had before this block | ||||||
|  |       was started.) */ | ||||||
|  |    md5->abcd[0] += a; | ||||||
|  |    md5->abcd[1] += b; | ||||||
|  |    md5->abcd[2] += c; | ||||||
|  |    md5->abcd[3] += d; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void | ||||||
|  | _bson_md5_init (bson_md5_t *pms) | ||||||
|  | { | ||||||
|  |    pms->count[0] = pms->count[1] = 0; | ||||||
|  |    pms->abcd[0] = 0x67452301; | ||||||
|  |    pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; | ||||||
|  |    pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; | ||||||
|  |    pms->abcd[3] = 0x10325476; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void | ||||||
|  | _bson_md5_append (bson_md5_t *pms, const uint8_t *data, uint32_t nbytes) | ||||||
|  | { | ||||||
|  |    const uint8_t *p = data; | ||||||
|  |    int left = nbytes; | ||||||
|  |    int offset = (pms->count[0] >> 3) & 63; | ||||||
|  |    uint32_t nbits = (uint32_t) (nbytes << 3); | ||||||
|  |  | ||||||
|  |    if (nbytes <= 0) | ||||||
|  |       return; | ||||||
|  |  | ||||||
|  |    /* Update the message length. */ | ||||||
|  |    pms->count[1] += nbytes >> 29; | ||||||
|  |    pms->count[0] += nbits; | ||||||
|  |    if (pms->count[0] < nbits) | ||||||
|  |       pms->count[1]++; | ||||||
|  |  | ||||||
|  |    /* Process an initial partial block. */ | ||||||
|  |    if (offset) { | ||||||
|  |       int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); | ||||||
|  |  | ||||||
|  |       memcpy (pms->buf + offset, p, copy); | ||||||
|  |       if (offset + copy < 64) | ||||||
|  |          return; | ||||||
|  |       p += copy; | ||||||
|  |       left -= copy; | ||||||
|  |       bson_md5_process (pms, pms->buf); | ||||||
|  |    } | ||||||
|  |  | ||||||
|  |    /* Process full blocks. */ | ||||||
|  |    for (; left >= 64; p += 64, left -= 64) | ||||||
|  |       bson_md5_process (pms, p); | ||||||
|  |  | ||||||
|  |    /* Process a final partial block. */ | ||||||
|  |    if (left) | ||||||
|  |       memcpy (pms->buf, p, left); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void | ||||||
|  | _bson_md5_finish (bson_md5_t *pms, uint8_t digest[16]) | ||||||
|  | { | ||||||
|  |    static const uint8_t pad[64] = { | ||||||
|  |       0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||||||
|  |       0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||||||
|  |       0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | ||||||
|  |    uint8_t data[8]; | ||||||
|  |    int i; | ||||||
|  |  | ||||||
|  |    /* Save the length before padding. */ | ||||||
|  |    for (i = 0; i < 8; ++i) | ||||||
|  |       data[i] = (uint8_t) (pms->count[i >> 2] >> ((i & 3) << 3)); | ||||||
|  |    /* Pad to 56 bytes mod 64. */ | ||||||
|  |    _bson_md5_append (pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); | ||||||
|  |    /* Append the length. */ | ||||||
|  |    _bson_md5_append (pms, data, sizeof (data)); | ||||||
|  |    for (i = 0; i < 16; ++i) | ||||||
|  |       digest[i] = (uint8_t) (pms->abcd[i >> 2] >> ((i & 3) << 3)); | ||||||
|  | } | ||||||
| @@ -0,0 +1,66 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright 2013-present MongoDB, Inc. | ||||||
|  |  * | ||||||
|  |  * 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. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef COMMON_THREAD_PRIVATE_H | ||||||
|  | #define COMMON_THREAD_PRIVATE_H | ||||||
|  |  | ||||||
|  | #if !defined(MONGOC_COMPILATION) && !defined(BSON_COMPILATION) && \ | ||||||
|  |    !defined(BSON_INSIDE) | ||||||
|  | #error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly." | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include "bson/bson-compat.h" | ||||||
|  | #include "bson/bson-config.h" | ||||||
|  | #include "bson/bson-macros.h" | ||||||
|  |  | ||||||
|  | BSON_BEGIN_DECLS | ||||||
|  |  | ||||||
|  | #if defined(BSON_OS_UNIX) | ||||||
|  | #include <pthread.h> | ||||||
|  | #define BSON_ONCE_FUN(n) void n (void) | ||||||
|  | #define BSON_ONCE_RETURN return | ||||||
|  | #define BSON_ONCE_INIT PTHREAD_ONCE_INIT | ||||||
|  | #define bson_mutex_destroy pthread_mutex_destroy | ||||||
|  | #define bson_mutex_init(_n) pthread_mutex_init ((_n), NULL) | ||||||
|  | #define bson_mutex_lock pthread_mutex_lock | ||||||
|  | #define bson_mutex_t pthread_mutex_t | ||||||
|  | #define bson_mutex_unlock pthread_mutex_unlock | ||||||
|  | #define bson_once pthread_once | ||||||
|  | #define bson_once_t pthread_once_t | ||||||
|  | #define bson_thread_create(_t, _f, _d) pthread_create ((_t), NULL, (_f), (_d)) | ||||||
|  | #define bson_thread_join(_n) pthread_join ((_n), NULL) | ||||||
|  | #define bson_thread_t pthread_t | ||||||
|  | #else | ||||||
|  | #define BSON_ONCE_FUN(n) \ | ||||||
|  |    BOOL CALLBACK n (PINIT_ONCE _ignored_a, PVOID _ignored_b, PVOID *_ignored_c) | ||||||
|  | #define BSON_ONCE_INIT INIT_ONCE_STATIC_INIT | ||||||
|  | #define BSON_ONCE_RETURN return true | ||||||
|  | #define bson_mutex_destroy DeleteCriticalSection | ||||||
|  | #define bson_mutex_init InitializeCriticalSection | ||||||
|  | #define bson_mutex_lock EnterCriticalSection | ||||||
|  | #define bson_mutex_t CRITICAL_SECTION | ||||||
|  | #define bson_mutex_unlock LeaveCriticalSection | ||||||
|  | #define bson_once(o, c) InitOnceExecuteOnce (o, c, NULL, NULL) | ||||||
|  | #define bson_once_t INIT_ONCE | ||||||
|  | #define bson_thread_create(_t, _f, _d) \ | ||||||
|  |    (!(*(_t) = CreateThread (NULL, 0, (void *) _f, _d, 0, NULL))) | ||||||
|  | #define bson_thread_join(_n) WaitForSingleObject ((_n), INFINITE) | ||||||
|  | #define bson_thread_t HANDLE | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | BSON_END_DECLS | ||||||
|  |  | ||||||
|  | #endif /* COMMON_THREAD_PRIVATE_H */ | ||||||
							
								
								
									
										414
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										414
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,414 @@ | |||||||
|  | cmake_minimum_required (VERSION 3.1) | ||||||
|  |  | ||||||
|  | project (libbson C) | ||||||
|  |  | ||||||
|  | # In the future we may need to check whether static dependencies are | ||||||
|  | # available. For now, AUTO means ON. | ||||||
|  | if (ENABLE_TESTS AND NOT ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |    message (FATAL_ERROR "-DENABLE_STATIC=OFF also requires -DENABLE_TESTS=OFF") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include (CheckFunctionExists) | ||||||
|  | include (CheckIncludeFile) | ||||||
|  | include (CheckStructHasMember) | ||||||
|  | include (CheckSymbolExists) | ||||||
|  | include (TestBigEndian) | ||||||
|  | include (InstallRequiredSystemLibraries) | ||||||
|  |  | ||||||
|  | set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake) | ||||||
|  |  | ||||||
|  | # Set BSON_MAJOR_VERSION, BSON_MINOR_VERSION, etc. | ||||||
|  | set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../build/cmake) | ||||||
|  | include (LoadVersion) | ||||||
|  | LoadVersion (${PROJECT_SOURCE_DIR}/../../VERSION_CURRENT BSON) | ||||||
|  | LoadVersion (${PROJECT_SOURCE_DIR}/../../VERSION_RELEASED BSON_RELEASED) | ||||||
|  |  | ||||||
|  | message ("libbson version (from VERSION_CURRENT file): ${BSON_VERSION}") | ||||||
|  | if (NOT ${BSON_VERSION} STREQUAL ${BSON_RELEASED_VERSION}) | ||||||
|  |    message ("libbson previous release (from VERSION_RELEASED file): ${BSON_RELEASED_VERSION}") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | set (BSON_API_VERSION 1.0) | ||||||
|  |  | ||||||
|  | set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION}) | ||||||
|  | set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION}) | ||||||
|  |  | ||||||
|  | include (CPack) | ||||||
|  | TEST_BIG_ENDIAN (BSON_BIG_ENDIAN) | ||||||
|  |  | ||||||
|  | #librt needed on linux for clock_gettime | ||||||
|  | find_library (RT_LIBRARY rt) | ||||||
|  | if (RT_LIBRARY) | ||||||
|  |    #set required libraries for CHECK_FUNCTION_EXISTS | ||||||
|  |    set (CMAKE_REQUIRED_LIBRARIES ${RT_LIBRARY}) | ||||||
|  |    set (BSON_LIBRARIES ${BSON_LIBRARIES} ${RT_LIBRARY}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | # See https://public.kitware.com/Bug/view.php?id=15659 | ||||||
|  | CHECK_SYMBOL_EXISTS (snprintf stdio.h BSON_HAVE_SNPRINTF) | ||||||
|  | if (NOT BSON_HAVE_SNPRINTF) | ||||||
|  |    set (BSON_HAVE_SNPRINTF 0) | ||||||
|  | else () | ||||||
|  |    set (BSON_HAVE_SNPRINTF 1) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | CHECK_FUNCTION_EXISTS (reallocf BSON_HAVE_REALLOCF) | ||||||
|  | if (NOT BSON_HAVE_REALLOCF) | ||||||
|  |    set (BSON_HAVE_REALLOCF 0) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | CHECK_STRUCT_HAS_MEMBER ("struct timespec" tv_sec time.h BSON_HAVE_TIMESPEC) | ||||||
|  | if (NOT BSON_HAVE_TIMESPEC) | ||||||
|  |    message (STATUS "    no timespec struct") | ||||||
|  |    set (BSON_HAVE_TIMESPEC 0) | ||||||
|  | else () | ||||||
|  |    message (STATUS "    struct timespec found") | ||||||
|  |    set (BSON_HAVE_TIMESPEC 1) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | CHECK_SYMBOL_EXISTS (gmtime_r time.h BSON_HAVE_GMTIME_R) | ||||||
|  | if (NOT BSON_HAVE_GMTIME_R) | ||||||
|  |    set (BSON_HAVE_GMTIME_R 0) | ||||||
|  | else () | ||||||
|  |    set (BSON_HAVE_GMTIME_R 1) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | CHECK_FUNCTION_EXISTS (rand_r BSON_HAVE_RAND_R) | ||||||
|  | if (NOT BSON_HAVE_RAND_R) | ||||||
|  |    set (BSON_HAVE_RAND_R 0) | ||||||
|  | else () | ||||||
|  |    set (BSON_HAVE_RAND_R 1) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (WIN32) | ||||||
|  |    set (BSON_OS 2) | ||||||
|  | else () | ||||||
|  |    set (BSON_OS 1) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include (CheckIncludeFiles) | ||||||
|  |  | ||||||
|  | CHECK_INCLUDE_FILE (strings.h BSON_HAVE_STRINGS_H) | ||||||
|  | if (NOT BSON_HAVE_STRINGS_H) | ||||||
|  |    set (BSON_HAVE_STRINGS_H 0) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (MSVC) | ||||||
|  |    set (BSON_HAVE_CLOCK_GETTIME 0) | ||||||
|  |    set (BSON_HAVE_STDBOOL_H 0) | ||||||
|  |    set (BSON_HAVE_STRNLEN 0) | ||||||
|  |    set (BSON_HAVE_SYSCALL_TID 0) | ||||||
|  | else () | ||||||
|  |    check_symbol_exists (clock_gettime time.h BSON_HAVE_CLOCK_GETTIME) | ||||||
|  |    if (NOT BSON_HAVE_CLOCK_GETTIME) | ||||||
|  |       set (BSON_HAVE_CLOCK_GETTIME 0) | ||||||
|  |    endif () | ||||||
|  |    check_symbol_exists (strnlen string.h BSON_HAVE_STRNLEN) | ||||||
|  |    if (NOT BSON_HAVE_STRNLEN) | ||||||
|  |       set (BSON_HAVE_STRNLEN 0) | ||||||
|  |    endif () | ||||||
|  |    CHECK_INCLUDE_FILE (stdbool.h BSON_HAVE_STDBOOL_H) | ||||||
|  |    if (NOT BSON_HAVE_STDBOOL_H) | ||||||
|  |       set (BSON_HAVE_STDBOOL_H 0) | ||||||
|  |    endif () | ||||||
|  |    CHECK_SYMBOL_EXISTS (SYS_gettid sys/syscall.h BSON_HAVE_SYSCALL_TID) | ||||||
|  |    check_symbol_exists (syscall unistd.h _TMP_HAVE_SYSCALL) | ||||||
|  |    if (NOT BSON_HAVE_SYSCALL_TID OR NOT _TMP_HAVE_SYSCALL OR APPLE OR ANDROID) | ||||||
|  |       set (BSON_HAVE_SYSCALL_TID 0) | ||||||
|  |    endif () | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (BSON_BIG_ENDIAN) | ||||||
|  |    set (BSON_BYTE_ORDER 4321) | ||||||
|  | else () | ||||||
|  |    set (BSON_BYTE_ORDER 1234) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include (CheckAtomics) | ||||||
|  |  | ||||||
|  | configure_file ( | ||||||
|  |    "${PROJECT_SOURCE_DIR}/src/bson/bson-config.h.in" | ||||||
|  |    "${PROJECT_BINARY_DIR}/src/bson/bson-config.h" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | configure_file ( | ||||||
|  |    "${PROJECT_SOURCE_DIR}/src/bson/bson-version.h.in" | ||||||
|  |    "${PROJECT_BINARY_DIR}/src/bson/bson-version.h" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | if (ENABLE_APPLE_FRAMEWORK) | ||||||
|  |    configure_file ( | ||||||
|  |       "${PROJECT_SOURCE_DIR}/src/bson/modules/module.modulemap.in" | ||||||
|  |       "${PROJECT_BINARY_DIR}/src/bson/modules/module.modulemap" | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include_directories ("${PROJECT_BINARY_DIR}/src") | ||||||
|  | include_directories ("${PROJECT_SOURCE_DIR}/src") | ||||||
|  | include_directories ("${PROJECT_SOURCE_DIR}/../../src/common") | ||||||
|  |  | ||||||
|  | if (APPLE) | ||||||
|  |    cmake_policy (SET CMP0042 OLD) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include (MaintainerFlags) | ||||||
|  |  | ||||||
|  | if (ENABLE_COVERAGE) | ||||||
|  |    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage") | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | set (SOURCES | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bcon.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-atomic.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-clock.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-context.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-decimal128.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-error.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-fnv.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-iso8601.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-iter.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-json.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-keys.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-md5.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-memory.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-oid.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-reader.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-string.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-timegm.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-utf8.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-value.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-version-functions.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-writer.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/jsonsl/jsonsl.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/../../src/common/common-b64.c | ||||||
|  |    ${PROJECT_SOURCE_DIR}/../../src/common/common-md5.c | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (HEADERS | ||||||
|  |    ${PROJECT_BINARY_DIR}/src/bson/bson-config.h | ||||||
|  |    ${PROJECT_BINARY_DIR}/src/bson/bson-version.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bcon.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-atomic.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-clock.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-compat.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-context.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-decimal128.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-endian.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-error.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-iter.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-json.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-keys.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-macros.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-md5.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-memory.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-oid.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-reader.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-string.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-types.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-utf8.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-value.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-version-functions.h | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/bson-writer.h | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (HEADERS_FORWARDING | ||||||
|  |    ${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) | ||||||
|  | set (CMAKE_CXX_VISIBILITY_PRESET hidden) | ||||||
|  | set_target_properties (bson_shared PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;JSONSL_PARSE_NAN") | ||||||
|  | set_target_properties (bson_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) | ||||||
|  | set_target_properties (bson_shared PROPERTIES OUTPUT_NAME "bson-${BSON_API_VERSION}" PREFIX "lib") | ||||||
|  |  | ||||||
|  | if (ENABLE_APPLE_FRAMEWORK) | ||||||
|  |    set_target_properties(bson_shared PROPERTIES  | ||||||
|  |       FRAMEWORK TRUE  | ||||||
|  |       MACOSX_FRAMEWORK_BUNDLE_VERSION ${MONGOC_VERSION}  | ||||||
|  |       MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MONGOC_VERSION} | ||||||
|  |       MACOSX_FRAMEWORK_IDENTIFIER org.mongodb.bson | ||||||
|  |       OUTPUT_NAME "bson" | ||||||
|  |       PUBLIC_HEADER "${HEADERS}"  | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (RT_LIBRARY) | ||||||
|  |    target_link_libraries (bson_shared ${RT_LIBRARY}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | find_library (M_LIBRARY m) | ||||||
|  | if (M_LIBRARY) | ||||||
|  |    target_link_libraries (bson_shared ${M_LIBRARY}) | ||||||
|  |    set (BSON_LIBRARIES ${BSON_LIBRARIES} ${M_LIBRARY}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | set (THREADS_PREFER_PTHREAD_FLAG 1) | ||||||
|  | find_package (Threads REQUIRED) | ||||||
|  | target_link_libraries (bson_shared Threads::Threads) | ||||||
|  | if (CMAKE_USE_PTHREADS_INIT) | ||||||
|  |    set (BSON_LIBRARIES ${BSON_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (WIN32) | ||||||
|  |    # gethostbyname | ||||||
|  |    target_link_libraries (bson_shared ws2_32) | ||||||
|  |    # Can't find_library () system dependencies | ||||||
|  |    # must be handled specially since we can't resolve them | ||||||
|  |    set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |    add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) | ||||||
|  |    set_target_properties (bson_static PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;BSON_STATIC;JSONSL_PARSE_NAN") | ||||||
|  |    set_target_properties (bson_static PROPERTIES VERSION 0.0.0) | ||||||
|  |    set_target_properties (bson_static PROPERTIES OUTPUT_NAME "bson-static-${BSON_API_VERSION}") | ||||||
|  |    target_link_libraries (bson_static Threads::Threads) | ||||||
|  |    if (RT_LIBRARY) | ||||||
|  |       target_link_libraries (bson_static ${RT_LIBRARY}) | ||||||
|  |    endif () | ||||||
|  |    if (M_LIBRARY) | ||||||
|  |       target_link_libraries (bson_static ${M_LIBRARY}) | ||||||
|  |    endif () | ||||||
|  |    if (NOT UNIX) | ||||||
|  |       # gethostbyname | ||||||
|  |       target_link_libraries (bson_static ws2_32) | ||||||
|  |    endif () | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | function (add_example bin src) | ||||||
|  |    set (BSON_EXAMPLE_SOURCES ${PROJECT_SOURCE_DIR}/${src}) | ||||||
|  |    add_executable (${bin} ${BSON_EXAMPLE_SOURCES}) | ||||||
|  |  | ||||||
|  |    # Link against the shared lib like normal apps | ||||||
|  |    target_link_libraries (${bin} bson_shared) | ||||||
|  |  | ||||||
|  |    set (EXAMPLES ${EXAMPLES} ${bin}) | ||||||
|  | endfunction () | ||||||
|  |  | ||||||
|  | if (ENABLE_EXAMPLES) | ||||||
|  |    add_example (bcon-col-view examples/bcon-col-view.c) | ||||||
|  |    add_example (bcon-speed examples/bcon-speed.c) | ||||||
|  |    add_example (bson-metrics examples/bson-metrics.c) | ||||||
|  |    if (NOT WIN32) | ||||||
|  |       target_link_libraries (bson-metrics m) | ||||||
|  |       add_example (bson-streaming-reader examples/bson-streaming-reader.c) | ||||||
|  |    endif () | ||||||
|  |    add_example (bson-to-json examples/bson-to-json.c) | ||||||
|  |    add_example (bson-validate examples/bson-validate.c) | ||||||
|  |    add_example (json-to-bson examples/json-to-bson.c) | ||||||
|  | endif () # ENABLE_EXAMPLES | ||||||
|  |  | ||||||
|  | set (BSON_HEADER_INSTALL_DIR | ||||||
|  |    "${CMAKE_INSTALL_INCLUDEDIR}/libbson-${BSON_API_VERSION}" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | install ( | ||||||
|  |    TARGETS bson_shared ${EXAMPLES} | ||||||
|  |    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||||||
|  |    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||||||
|  |    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||||||
|  |    FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}  | ||||||
|  | ) | ||||||
|  | if (ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |    install ( | ||||||
|  |       TARGETS bson_static ${EXAMPLES} | ||||||
|  |       LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||||||
|  |       ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||||||
|  |       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||||||
|  |       FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}  | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  | install ( | ||||||
|  |    FILES ${HEADERS} | ||||||
|  |    DESTINATION "${BSON_HEADER_INSTALL_DIR}/bson" | ||||||
|  | ) | ||||||
|  | install ( | ||||||
|  |    FILES ${HEADERS_FORWARDING} | ||||||
|  |    DESTINATION "${BSON_HEADER_INSTALL_DIR}" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | if (ENABLE_APPLE_FRAMEWORK) | ||||||
|  |    install ( | ||||||
|  |       FILES "${PROJECT_BINARY_DIR}/src/bson/modules/module.modulemap" | ||||||
|  |       DESTINATION "${CMAKE_INSTALL_BINDIR}/bson.framework/Modules/" | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | set (LIBBSON_LIBRARIES "") | ||||||
|  | foreach (_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${BSON_LIBRARIES}) | ||||||
|  |    if (_lib MATCHES ".*/.*" OR _lib MATCHES "^-") | ||||||
|  |       set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") | ||||||
|  |    else () | ||||||
|  |       set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} -l${_lib}") | ||||||
|  |    endif () | ||||||
|  | endforeach () | ||||||
|  | # System dependencies don't match the above regexs, but also don't want the -l | ||||||
|  | foreach (_lib ${BSON_SYSTEM_LIBRARIES}) | ||||||
|  |    set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") | ||||||
|  | endforeach () | ||||||
|  |  | ||||||
|  | set (VERSION "${BSON_VERSION}") | ||||||
|  | set (prefix "${CMAKE_INSTALL_PREFIX}") | ||||||
|  | set (libdir "\${prefix}/lib") | ||||||
|  | configure_file ( | ||||||
|  |    ${CMAKE_CURRENT_SOURCE_DIR}/src/libbson-1.0.pc.in | ||||||
|  |    ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-1.0.pc | ||||||
|  |    @ONLY) | ||||||
|  |  | ||||||
|  | install ( | ||||||
|  |    FILES | ||||||
|  |       ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-1.0.pc | ||||||
|  |    DESTINATION | ||||||
|  |       ${CMAKE_INSTALL_LIBDIR}/pkgconfig | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | if (ENABLE_STATIC MATCHES "ON|AUTO") | ||||||
|  |    configure_file ( | ||||||
|  |       ${CMAKE_CURRENT_SOURCE_DIR}/src/libbson-static-1.0.pc.in | ||||||
|  |       ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-static-1.0.pc | ||||||
|  |       @ONLY) | ||||||
|  |  | ||||||
|  |    install ( | ||||||
|  |       FILES | ||||||
|  |          ${CMAKE_CURRENT_BINARY_DIR}/src/libbson-static-1.0.pc | ||||||
|  |       DESTINATION | ||||||
|  |          ${CMAKE_INSTALL_LIBDIR}/pkgconfig | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | include (build/cmake/BSONPackage.cmake) | ||||||
|  |  | ||||||
|  | if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) | ||||||
|  |    find_package (Sphinx REQUIRED) | ||||||
|  |    add_subdirectory (doc) | ||||||
|  |    add_custom_target (bson-doc | ||||||
|  |       ALL | ||||||
|  |       DEPENDS | ||||||
|  |       $<$<STREQUAL:"${ENABLE_MAN_PAGES}","ON">:bson-man> | ||||||
|  |       $<$<STREQUAL:"${ENABLE_HTML_DOCS}","ON">:bson-html> | ||||||
|  |    ) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | add_subdirectory (build) | ||||||
|  | # sub-directory 'doc' was already included above | ||||||
|  | add_subdirectory (examples) | ||||||
|  | add_subdirectory (src) | ||||||
|  | add_subdirectory (tests) | ||||||
|  |  | ||||||
|  | set_local_dist (src_libbson_DIST_local | ||||||
|  |    CMakeLists.txt | ||||||
|  |    NEWS | ||||||
|  |    THIRD_PARTY_NOTICES | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (src_libbson_DIST | ||||||
|  |    ${src_libbson_DIST_local} | ||||||
|  |    ${src_libbson_build_DIST} | ||||||
|  |    ${src_libbson_doc_DIST} | ||||||
|  |    ${src_libbson_examples_DIST} | ||||||
|  |    ${src_libbson_src_DIST} | ||||||
|  |    ${src_libbson_tests_DIST} | ||||||
|  |    PARENT_SCOPE | ||||||
|  | ) | ||||||
							
								
								
									
										1328
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/NEWS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1328
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/NEWS
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -0,0 +1,45 @@ | |||||||
|  | Libbson uses third-party libraries distributed under different licenses. | ||||||
|  |  | ||||||
|  | License notice for jsonsl | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | MIT License | ||||||
|  |  | ||||||
|  | Copyright (c) 2012-2015 M. Nunberg, mnunberg@haskalah.org | ||||||
|  |  | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining | ||||||
|  | a copy of this software and associated documentation files (the | ||||||
|  | "Software"), to deal in the Software without restriction, including | ||||||
|  | without limitation the rights to use, copy, modify, merge, publish, | ||||||
|  | distribute, sublicense, and/or sell copies of the Software, and to | ||||||
|  | permit persons to whom the Software is furnished to do so, subject to | ||||||
|  | the following conditions: | ||||||
|  |  | ||||||
|  | The above copyright notice and this permission notice shall be | ||||||
|  | included in all copies or substantial portions of the Software. | ||||||
|  |  | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||||
|  | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||||
|  | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||||
|  | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||||||
|  | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||||||
|  | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||||||
|  | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | License notice for bson-fnv-private.h, bson-fnv.c and test-fnv.c | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | Please do not copyright this code.  This code is in the public domain. | ||||||
|  |  | ||||||
|  | LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||||||
|  | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO | ||||||
|  | EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||||||
|  | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | ||||||
|  | USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||||||
|  | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||||||
|  | PERFORMANCE OF THIS SOFTWARE. | ||||||
|  |  | ||||||
|  | By: | ||||||
|  |  chongo <Landon Curt Noll> /\oo/\ | ||||||
|  |      http://www.isthe.com/chongo/ | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | include (SphinxBuild) | ||||||
|  |  | ||||||
|  | if (ENABLE_HTML_DOCS) | ||||||
|  |    sphinx_build_html (bson-html libbson) | ||||||
|  |    set (src_libbson_doc_DIST_htmls ${doc_DIST_htmls}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | if (ENABLE_MAN_PAGES) | ||||||
|  |    sphinx_build_man (bson-man) | ||||||
|  |    set (src_libbson_doc_DIST_mans ${doc_DIST_mans}) | ||||||
|  | endif () | ||||||
|  |  | ||||||
|  | add_subdirectory (html) | ||||||
|  | add_subdirectory (man) | ||||||
|  |  | ||||||
|  | file (GLOB src_libbson_doc_DIST_rsts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rst) | ||||||
|  |  | ||||||
|  | extra_dist_generated ( | ||||||
|  |    ${src_libbson_doc_DIST_htmls} | ||||||
|  |    ${src_libbson_doc_DIST_mans} | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set_local_dist (src_libbson_doc_DIST_local | ||||||
|  |    CMakeLists.txt | ||||||
|  |    ${src_libbson_doc_DIST_rsts} | ||||||
|  |    conf.py | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | set (src_libbson_doc_DIST | ||||||
|  |    ${src_libbson_doc_DIST_local} | ||||||
|  |    ${src_libbson_doc_html_DIST} | ||||||
|  |    ${src_libbson_doc_man_DIST} | ||||||
|  |    ${src_libbson_doc_mongoc_DIST} | ||||||
|  |    ${src_libbson_doc_mongoc-theme_DIST} | ||||||
|  |    PARENT_SCOPE | ||||||
|  | ) | ||||||
							
								
								
									
										27
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/api.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								contrib/mongoc/mongo-c-driver-1.13.1/src/libbson/doc/api.rst
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | API Reference | ||||||
|  | ============= | ||||||
|  |  | ||||||
|  | .. toctree:: | ||||||
|  |   :titlesonly: | ||||||
|  |   :maxdepth: 2 | ||||||
|  |  | ||||||
|  |   bson_t | ||||||
|  |   bson_context_t | ||||||
|  |   bson_decimal128_t | ||||||
|  |   bson_error_t | ||||||
|  |   bson_iter_t | ||||||
|  |   bson_json_reader_t | ||||||
|  |   bson_md5_t | ||||||
|  |   bson_oid_t | ||||||
|  |   bson_reader_t | ||||||
|  |   character_and_string_routines | ||||||
|  |   bson_string_t | ||||||
|  |   bson_subtype_t | ||||||
|  |   bson_type_t | ||||||
|  |   bson_unichar_t | ||||||
|  |   bson_value_t | ||||||
|  |   bson_visitor_t | ||||||
|  |   bson_writer_t | ||||||
|  |   bson_get_monotonic_time | ||||||
|  |   bson_memory | ||||||
|  |   version | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_array | ||||||
|  |  | ||||||
|  | bson_append_array() | ||||||
|  | =================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_ARRAY(b, key, val) \ | ||||||
|  |      bson_append_array (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_array (bson_t *bson, | ||||||
|  |                      const char *key, | ||||||
|  |                      int key_length, | ||||||
|  |                      const bson_t *array); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``array``: A :symbol:`bson_t`. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_array()` function shall append ``array`` to ``bson`` using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of ``array`` are properly formatted with string keys such as "0", "1", "2" and so forth. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function fails if appending the array grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,39 @@ | |||||||
|  | :man_page: bson_append_array_begin | ||||||
|  |  | ||||||
|  | bson_append_array_begin() | ||||||
|  | ========================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_ARRAY_BEGIN(b, key, child) \ | ||||||
|  |      bson_append_array_begin (b, key, (int) strlen (key), child) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_array_begin (bson_t *bson, | ||||||
|  |                            const char *key, | ||||||
|  |                            int key_length, | ||||||
|  |                            bson_t *child); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: A string containing the name for the key. | ||||||
|  | * ``key_length``: The length of ``key`` or -1 to call ``strlen()``. | ||||||
|  | * ``child``: A :symbol:`bson_t`. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_array_begin()` function shall begin appending an array field to ``bson``. This allows for incrementally building a sub-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub-array, the caller *MUST* call :symbol:`bson_append_array_end()`. | ||||||
|  |  | ||||||
|  | For generating array element keys, see :symbol:`bson_uint32_to_string`. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the array grows ``bson`` larger than INT32_MAX. | ||||||
|  |  | ||||||
| @@ -0,0 +1,28 @@ | |||||||
|  | :man_page: bson_append_array_end | ||||||
|  |  | ||||||
|  | bson_append_array_end() | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_array_end (bson_t *bson, bson_t *child); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``child``: The :symbol:`bson_t` initialized in a call to :symbol:`bson_append_array_begin()`. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_array_end()` function shall complete the appending of an array field started with :symbol:`bson_append_array_begin()`. ``child`` is invalid after calling this function. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if successful. | ||||||
| @@ -0,0 +1,40 @@ | |||||||
|  | :man_page: bson_append_binary | ||||||
|  |  | ||||||
|  | bson_append_binary() | ||||||
|  | ==================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_BINARY(b, key, subtype, val, len) \ | ||||||
|  |      bson_append_binary (b, key, (int) strlen (key), subtype, val, len) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_binary (bson_t *bson, | ||||||
|  |                       const char *key, | ||||||
|  |                       int key_length, | ||||||
|  |                       bson_subtype_t subtype, | ||||||
|  |                       const uint8_t *binary, | ||||||
|  |                       uint32_t length); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: The key name. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes or -1 to use strlen(). | ||||||
|  | * ``subtype``: A bson_subtype_t indicating the binary subtype. | ||||||
|  | * ``binary``: A buffer to embed as binary data. Must not be ``NULL``. | ||||||
|  | * ``length``: The length of ``buffer`` in bytes. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_binary()` function shall append a new element to ``bson`` containing the binary data provided. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``binary`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,33 @@ | |||||||
|  | :man_page: bson_append_bool | ||||||
|  |  | ||||||
|  | bson_append_bool() | ||||||
|  | ================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_BOOL(b, key, val) \ | ||||||
|  |      bson_append_bool (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_bool (bson_t *bson, const char *key, int key_length, bool value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: The name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` or -1 to use strlen(). | ||||||
|  | * ``value``: true or false. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_bool()` function shall append a new element to ``bson`` containing the boolean provided. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_code | ||||||
|  |  | ||||||
|  | bson_append_code() | ||||||
|  | ================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_CODE(b, key, val) \ | ||||||
|  |      bson_append_code (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_code (bson_t *bson, | ||||||
|  |                     const char *key, | ||||||
|  |                     int key_length, | ||||||
|  |                     const char *javascript); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: The key name. | ||||||
|  | * ``key_length``: The length of ``key`` or -1 to use strlen(). | ||||||
|  | * ``javascript``: A UTF-8 encoded string containing the javascript. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_code()` function shall append a new element to ``bson`` using the UTF-8 encoded ``javascript`` provided. ``javascript`` must be a NULL terminated C string. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``javascript`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,40 @@ | |||||||
|  | :man_page: bson_append_code_with_scope | ||||||
|  |  | ||||||
|  | bson_append_code_with_scope() | ||||||
|  | ============================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \ | ||||||
|  |      bson_append_code_with_scope (b, key, (int) strlen (key), val, scope) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_code_with_scope (bson_t *bson, | ||||||
|  |                                const char *key, | ||||||
|  |                                int key_length, | ||||||
|  |                                const char *javascript, | ||||||
|  |                                const bson_t *scope); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``javascript``: A NULL-terminated UTF-8 encoded string containing the javascript fragment. | ||||||
|  | * ``scope``: Optional :symbol:`bson_t` containing the scope for ``javascript``. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_code_with_scope()` function shall perform like :symbol:`bson_append_code()` except it allows providing a scope to the javascript function in the form of a bson document. | ||||||
|  |  | ||||||
|  | If ``scope`` is NULL, this function appends an element with BSON type "code", otherwise with BSON type "code with scope". | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``javascript`` and ``scope`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_date_time | ||||||
|  |  | ||||||
|  | bson_append_date_time() | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DATE_TIME(b, key, val) \ | ||||||
|  |      bson_append_date_time (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_date_time (bson_t *bson, | ||||||
|  |                          const char *key, | ||||||
|  |                          int key_length, | ||||||
|  |                          int64_t value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: The date and time as specified in milliseconds since the UNIX epoch. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_date_time()` function shall append a new element to a ``bson`` document containing a date and time with no timezone information. ``value`` is assumed to be in UTC format of milliseconds since the UNIX epoch. ``value`` *MAY* be negative. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,40 @@ | |||||||
|  | :man_page: bson_append_dbpointer | ||||||
|  |  | ||||||
|  | bson_append_dbpointer() | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DBPOINTER(b, key, coll, oid) \ | ||||||
|  |      bson_append_dbpointer (b, key, (int) strlen (key), coll, oid) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_dbpointer (bson_t *bson, | ||||||
|  |                          const char *key, | ||||||
|  |                          int key_length, | ||||||
|  |                          const char *collection, | ||||||
|  |                          const bson_oid_t *oid); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``collection``: The target collection name. | ||||||
|  | * ``oid``: The target document identifier. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | .. warning:: | ||||||
|  |  | ||||||
|  |   The dbpointer field type is *DEPRECATED* and should only be used when interacting with legacy systems. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the array grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_decimal128 | ||||||
|  |  | ||||||
|  | bson_append_decimal128() | ||||||
|  | ======================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DECIMAL128(b, key, val) \ | ||||||
|  |      bson_append_decimal128 (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_decimal128 (bson_t *bson, | ||||||
|  |                           const char *key, | ||||||
|  |                           int key_length, | ||||||
|  |                           const bson_decimal128_t *value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: A :symbol:`bson_decimal128_t`. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_decimal128()` function shall append a new element to ``bson`` containing a Decimal 128. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_document | ||||||
|  |  | ||||||
|  | bson_append_document() | ||||||
|  | ====================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DOCUMENT(b, key, val) \ | ||||||
|  |      bson_append_document (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_document (bson_t *bson, | ||||||
|  |                         const char *key, | ||||||
|  |                         int key_length, | ||||||
|  |                         const bson_t *value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: A :symbol:`bson_t` containing the sub-document to append. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_document()` function shall append ``child`` to ``bson`` using the specified key. The type of the field will be a document. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,38 @@ | |||||||
|  | :man_page: bson_append_document_begin | ||||||
|  |  | ||||||
|  | bson_append_document_begin() | ||||||
|  | ============================ | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \ | ||||||
|  |      bson_append_document_begin (b, key, (int) strlen (key), child) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_document_begin (bson_t *bson, | ||||||
|  |                               const char *key, | ||||||
|  |                               int key_length, | ||||||
|  |                               bson_t *child); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``child``: An uninitialized :symbol:`bson_t` to be initialized as the sub-document. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_document_begin()` function shall begin appending a sub-document to ``bson``. Use ``child`` to add fields to the sub-document. When completed, call :symbol:`bson_append_document_end()` to complete the element. | ||||||
|  |  | ||||||
|  | ``child`` *MUST* be an uninitialized :symbol:`bson_t` to avoid leaking memory. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if ``bson`` must grow larger than INT32_MAX. | ||||||
| @@ -0,0 +1,28 @@ | |||||||
|  | :man_page: bson_append_document_end | ||||||
|  |  | ||||||
|  | bson_append_document_end() | ||||||
|  | ========================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_document_end (bson_t *bson, bson_t *child); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``child``: The child :symbol:`bson_t` initialized in a call to :symbol:`bson_append_document_begin()`. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_document_end()` function shall complete the appending of a document with :symbol:`bson_append_document_begin()`. ``child`` is invalid after calling this function. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if successful. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_double | ||||||
|  |  | ||||||
|  | bson_append_double() | ||||||
|  | ==================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_DOUBLE(b, key, val) \ | ||||||
|  |      bson_append_double (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_double (bson_t *bson, | ||||||
|  |                       const char *key, | ||||||
|  |                       int key_length, | ||||||
|  |                       double value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: A double value to append. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_double()` function shall append a new element to a bson document of type ``double``. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_int32 | ||||||
|  |  | ||||||
|  | bson_append_int32() | ||||||
|  | =================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_INT32(b, key, val) \ | ||||||
|  |      bson_append_int32 (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_int32 (bson_t *bson, | ||||||
|  |                      const char *key, | ||||||
|  |                      int key_length, | ||||||
|  |                      int32_t value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: An int32_t. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_int32()` function shall append a new element to ``bson`` containing a 32-bit signed integer. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_int64 | ||||||
|  |  | ||||||
|  | bson_append_int64() | ||||||
|  | =================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_INT64(b, key, val) \ | ||||||
|  |      bson_append_int64 (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_int64 (bson_t *bson, | ||||||
|  |                      const char *key, | ||||||
|  |                      int key_length, | ||||||
|  |                      int64_t value); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``value``: An int64_t. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_int64()` function shall append a new element to ``bson`` containing a 64-bit signed integer. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``value`` grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,33 @@ | |||||||
|  | :man_page: bson_append_iter | ||||||
|  |  | ||||||
|  | bson_append_iter() | ||||||
|  | ================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_iter (bson_t *bson, | ||||||
|  |                     const char *key, | ||||||
|  |                     int key_length, | ||||||
|  |                     const bson_iter_t *iter); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: Optional field name. If NULL, uses :symbol:`bson_iter_key(iter) <bson_iter_key>`. | ||||||
|  | * ``key_length``: The length of ``key`` or -1 to use strlen(). | ||||||
|  | * ``iter``: A :symbol:`bson_iter_t` located on the position of the element to append. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | Appends the value at the current position of ``iter`` to the document. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if successful; ``false`` if the operation would overflow the maximum document size or another invalid state is detected. | ||||||
| @@ -0,0 +1,32 @@ | |||||||
|  | :man_page: bson_append_maxkey | ||||||
|  |  | ||||||
|  | bson_append_maxkey() | ||||||
|  | ==================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_MAXKEY(b, key) \ | ||||||
|  |      bson_append_maxkey (b, key, (int) strlen (key)) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_maxkey (bson_t *bson, const char *key, int key_length); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_maxkey()` function shall append an element of type BSON_TYPE_MAXKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,32 @@ | |||||||
|  | :man_page: bson_append_minkey | ||||||
|  |  | ||||||
|  | bson_append_minkey() | ||||||
|  | ==================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_MINKEY(b, key) \ | ||||||
|  |      bson_append_minkey (b, key, (int) strlen (key)) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_minkey (bson_t *bson, const char *key, int key_length); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_minkey()` function shall append an element of type BSON_TYPE_MINKEY to a bson document. This is primarily used in queries and unlikely to be used when storing a document to MongoDB. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,31 @@ | |||||||
|  | :man_page: bson_append_now_utc | ||||||
|  |  | ||||||
|  | bson_append_now_utc() | ||||||
|  | ===================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_now_utc (bson_t *bson, const char *key, int key_length); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_now_utc()` function is a helper to get the current date and time in UTC and append it to ``bson`` as a BSON_TYPE_DATE_TIME element. | ||||||
|  |  | ||||||
|  | This function calls :symbol:`bson_append_date_time()` internally. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,31 @@ | |||||||
|  | :man_page: bson_append_null | ||||||
|  |  | ||||||
|  | bson_append_null() | ||||||
|  | ================== | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key)) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_null (bson_t *bson, const char *key, int key_length); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_null()` function shall append a new element to ``bson`` of type BSON_TYPE_NULL. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending the value grows ``bson`` larger than INT32_MAX. | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | :man_page: bson_append_oid | ||||||
|  |  | ||||||
|  | bson_append_oid() | ||||||
|  | ================= | ||||||
|  |  | ||||||
|  | Synopsis | ||||||
|  | -------- | ||||||
|  |  | ||||||
|  | .. code-block:: c | ||||||
|  |  | ||||||
|  |   #define BSON_APPEND_OID(b, key, val) \ | ||||||
|  |      bson_append_oid (b, key, (int) strlen (key), val) | ||||||
|  |  | ||||||
|  |   bool | ||||||
|  |   bson_append_oid (bson_t *bson, | ||||||
|  |                    const char *key, | ||||||
|  |                    int key_length, | ||||||
|  |                    const bson_oid_t *oid); | ||||||
|  |  | ||||||
|  | Parameters | ||||||
|  | ---------- | ||||||
|  |  | ||||||
|  | * ``bson``: A :symbol:`bson_t`. | ||||||
|  | * ``key``: An ASCII C string containing the name of the field. | ||||||
|  | * ``key_length``: The length of ``key`` in bytes, or -1 to determine the length with ``strlen()``. | ||||||
|  | * ``oid``: A bson_oid_t. | ||||||
|  |  | ||||||
|  | Description | ||||||
|  | ----------- | ||||||
|  |  | ||||||
|  | The :symbol:`bson_append_oid()` function shall append a new element to ``bson`` of type BSON_TYPE_OID. ``oid`` *MUST* be a pointer to a :symbol:`bson_oid_t`. | ||||||
|  |  | ||||||
|  | Returns | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | Returns ``true`` if the operation was applied successfully. The function will fail if appending ``oid`` grows ``bson`` larger than INT32_MAX. | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user