├── .gitattributes ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── SECURITY.MD ├── adapters ├── README.md ├── agenttime.c ├── condition_pthreads.c ├── condition_rtx_mbed.cpp ├── condition_win32.c ├── envvariable.c ├── httpapi_compact.c ├── httpapi_curl.c ├── httpapi_tirtos.c ├── httpapi_winhttp.c ├── linux_time.c ├── linux_time.h ├── lock_pthreads.c ├── lock_rtx_mbed.cpp ├── lock_win32.c ├── platform_freertos.c ├── platform_linux.c ├── platform_stub.c ├── platform_tizenrt.c ├── platform_win32.c ├── random_posix.c ├── random_stub.c ├── socketio_berkeley.c ├── socketio_win32.c ├── srw_lock.c ├── string_utils.c ├── tcpsocketconnection_c.cpp ├── threadapi_pthreads.c ├── threadapi_win32.c ├── tickcounter_linux.c ├── tickcounter_tirtos.c ├── tickcounter_win32.c ├── timer.c ├── tlsio_bearssl.c ├── tlsio_mbedtls.c ├── tlsio_openssl.c ├── tlsio_schannel.c ├── tlsio_template.c ├── tlsio_wolfssl.c ├── uniqueid_azsphere.c ├── uniqueid_linux.c ├── uniqueid_stub.c ├── uniqueid_win32.c ├── x509_openssl.c └── x509_schannel.c ├── archive └── cyclonessl │ ├── CMakeLists-cyclone.txt │ ├── readme.md │ ├── tlsio_cyclonessl.c │ ├── tlsio_cyclonessl_socket.c │ └── tlsio_cyclonessl_socket_bsd.c ├── build └── .vsts-ci.yml ├── build_all ├── linux │ ├── build.sh │ └── run_tests.sh ├── packaging │ ├── linux │ │ └── debian │ │ │ ├── azure-c-shared-util-dev.dirs │ │ │ ├── azure-c-shared-util-dev.install │ │ │ ├── azure-c-shared-util-lib.dirs │ │ │ ├── azure-c-shared-util-lib.install │ │ │ ├── changelog-trusty │ │ │ ├── changelog-vivid │ │ │ ├── changelog-wily │ │ │ ├── changelog-xenial │ │ │ ├── compat │ │ │ ├── control │ │ │ ├── copyright │ │ │ ├── docs │ │ │ ├── rules │ │ │ └── source │ │ │ └── format │ └── windows │ │ ├── Microsoft.Azure.C.SharedUtility.nuspec │ │ ├── Microsoft.Azure.C.SharedUtility.targets │ │ ├── Microsoft.Azure.C.SharedUtility_thirdpartynotice.txt │ │ └── rebuild_nugets.cmd ├── tirtos │ ├── package.bld │ └── package.xdc └── windows │ └── build.cmd ├── configs ├── azure_c_shared_utilityConfig.cmake ├── azure_c_shared_utilityFunctions.cmake ├── azure_iot_build_rules.cmake └── azure_iot_external_pal_unit_test_setup.cmake ├── dependencies-test.cmake ├── dependencies.cmake ├── devdoc ├── agenttime_requirements.md ├── azure_base64_requirements.md ├── base32_requirements.md ├── buffer_requirements.md ├── condition_requirements.md ├── connectionstringparser_requirements.md ├── constbuffer_array_batcher_requirements.md ├── constbuffer_array_requirements.md ├── constbuffer_requirements.md ├── constmap_requirements.md ├── crt_abstraction_requirements.md ├── dns_async.md ├── doublylinkedlist_requirements.md ├── gballoc_requirements.md ├── http_proxy_io_requirements.md ├── httpapi_compact_requirements.md ├── httpapiex_requirements.md ├── httpapiex_retry_mechanism.vsdx ├── httpapiexsas_requirements.md ├── httpheaders_requirements.md ├── img │ ├── porting_guide_overview.png │ ├── readme.txt │ ├── tlsio_state_diagram.png │ └── xio_chain.png ├── img_src │ ├── porting_guide_overview.vsdx │ ├── readme.txt │ ├── tlsio_state_diagram.pptx │ └── xio_chain.pptx ├── lock_requirements.md ├── map_requirements.md ├── memory_data_requirements.md ├── optionhandler_requirements.md ├── platform_requirements.md ├── porting_guide.md ├── refcount_requirements.md ├── sastoken_requirements.md ├── singlylinkedlist_requirements.md ├── sntp_lwip_requirements.md ├── socket_async.md ├── srw_lock_requirements.md ├── ssl_socket_compact.md ├── string_token_requirements.md ├── string_tokenizer_requirements.md ├── strings_requirements.md ├── template_requirements.md ├── threadapi_and_sleep_requirements.md ├── threadapi_freertos_requirements.md ├── tickcounter_freertos_requirement.md ├── tlsio_cyclonessl_requirements.md ├── tlsio_cyclonessl_socket_bsd_requirements.md ├── tlsio_cyclonessl_socket_requirements.md ├── tlsio_requirements.md ├── tlsio_ssl_esp8266.md ├── uniqueid_requirements.md ├── url_encode_requirements.md ├── utf8_checker_requirements.md ├── uuid_requirements.md ├── uws_client_requirements.md ├── uws_frame_encoder_requirements.md ├── vector_requirements.md ├── ws_url_requirements.md ├── wsio_requirements.md ├── x509_openssl.md ├── x509_schannel.md └── xio_requirements.md ├── inc └── azure_c_shared_utility │ ├── agenttime.h │ ├── azure_base32.h │ ├── azure_base64.h │ ├── buffer_.h │ ├── condition.h │ ├── connection_string_parser.h │ ├── consolelogger.h │ ├── const_defines.h │ ├── constbuffer.h │ ├── constbuffer_array.h │ ├── constbuffer_array_batcher.h │ ├── constmap.h │ ├── crt_abstractions.h │ ├── dns_resolver.h │ ├── doublylinkedlist.h │ ├── envvariable.h │ ├── etwlogger_driver.h │ ├── gb_stdio.h │ ├── gb_time.h │ ├── gballoc.h │ ├── gbnetwork.h │ ├── hmac.h │ ├── hmacsha256.h │ ├── http_proxy_io.h │ ├── httpapi.h │ ├── httpapiex.h │ ├── httpapiexsas.h │ ├── httpheaders.h │ ├── lock.h │ ├── logging_stacktrace.h │ ├── map.h │ ├── memory_data.h │ ├── optimize_size.h │ ├── optionhandler.h │ ├── platform.h │ ├── random.h │ ├── refcount.h │ ├── safe_math.h │ ├── sastoken.h │ ├── sha-private.h │ ├── sha.h │ ├── shared_util_options.h │ ├── singlylinkedlist.h │ ├── socketio.h │ ├── srw_lock.h │ ├── stdint_ce6.h │ ├── string_token.h │ ├── string_tokenizer.h │ ├── string_tokenizer_types.h │ ├── string_utils.h │ ├── strings.h │ ├── strings_types.h │ ├── tcpsocketconnection_c.h │ ├── threadapi.h │ ├── tickcounter.h │ ├── timer.h │ ├── tlsio.h │ ├── tlsio_bearssl.h │ ├── tlsio_cyclonessl.h │ ├── tlsio_cyclonessl_socket.h │ ├── tlsio_mbedtls.h │ ├── tlsio_openssl.h │ ├── tlsio_options.h │ ├── tlsio_schannel.h │ ├── tlsio_wolfssl.h │ ├── uniqueid.h │ ├── urlencode.h │ ├── utf8_checker.h │ ├── uuid.h │ ├── uws_client.h │ ├── uws_frame_encoder.h │ ├── vector.h │ ├── vector_types.h │ ├── vector_types_internal.h │ ├── ws_url.h │ ├── wsio.h │ ├── x509_openssl.h │ ├── x509_schannel.h │ ├── xio.h │ └── xlogging.h ├── jenkins ├── debian_c.sh ├── linux_bearssl.sh ├── linux_bearssl_clang_buildonly.sh ├── linux_c_option_test.sh ├── linux_cares.sh ├── linux_install_deps.sh ├── linux_mbed.sh ├── linux_mbed_clang_buildonly.sh ├── linux_wolfssl.sh ├── linux_wolfssl_clang_buildonly.sh ├── osx_gcc_openssl.sh ├── osx_xcode_native.sh ├── raspberrypi_c.sh ├── raspberrypi_c_buster.sh ├── ubuntu_c.sh ├── ubuntu_clang.sh ├── windows_c.cmd ├── windows_c_VsDevCmd.cmd ├── windows_c_build_as_dynamic.cmd └── windows_vs2008_c.cmd ├── nuget.config ├── pal ├── README.md ├── agenttime.c ├── freertos │ ├── lock.c │ ├── threadapi.c │ └── tickcounter.c ├── generic │ └── refcount_os.h ├── inc │ ├── sntp.h │ └── socket_async.h ├── ios-osx │ ├── platform_appleios.c │ ├── socket_async_os.h │ ├── tlsio_appleios.c │ └── tlsio_appleios.h ├── linux │ ├── refcount_os.h │ └── socket_async_os.h ├── lwip │ ├── sntp_lwip.c │ └── sntp_os.h ├── mbed_os5 │ └── refcount_os.h ├── socket_async.c ├── tickcounter.c ├── tlsio_options.c └── windows │ ├── refcount_os.h │ └── socket_async_os.h ├── samples ├── CMakeLists.txt ├── iot_c_utility │ ├── CMakeLists.txt │ └── iot_c_utility.c ├── socketio_connect │ ├── CMakeLists.txt │ └── main.c └── tlsio_connect │ ├── CMakeLists.txt │ └── main.c ├── src ├── README.md ├── aziotsharedutil.def ├── aziotsharedutil_http.def ├── aziotsharedutil_wsio.def ├── azure_base32.c ├── azure_base64.c ├── buffer.c ├── connection_string_parser.c ├── consolelogger.c ├── constbuffer.c ├── constbuffer_array.c ├── constbuffer_array_batcher.c ├── constmap.c ├── crt_abstractions.c ├── dns_resolver_ares.c ├── dns_resolver_sync.c ├── doublylinkedlist.c ├── etwlogger_driver.c ├── etwxlogging.c ├── gb_stdio.c ├── gb_time.c ├── gballoc.c ├── gbnetwork.c ├── hmac.c ├── hmacsha256.c ├── http_proxy_io.c ├── http_proxy_stub.c ├── httpapiex.c ├── httpapiexsas.c ├── httpheaders.c ├── logging_stacktrace.c ├── map.c ├── memory_data.c ├── optionhandler.c ├── sastoken.c ├── sha1.c ├── sha224.c ├── sha384-512.c ├── singlylinkedlist.c ├── string_token.c ├── string_tokenizer.c ├── strings.c ├── urlencode.c ├── usha.c ├── utf8_checker.c ├── uuid.c ├── uws_client.c ├── uws_frame_encoder.c ├── vector.c ├── ws_url.c ├── wsio.c ├── xio.c └── xlogging.c ├── tests ├── CMakeLists.txt ├── agenttime_ut │ ├── CMakeLists.txt │ ├── agenttime_ut.c │ └── main.c ├── azure_base32_ut │ ├── CMakeLists.txt │ ├── azure_base32_ut.c │ └── main.c ├── azure_base64_ut │ ├── CMakeLists.txt │ ├── azure_base64_ut.c │ └── main.c ├── buffer_ut │ ├── CMakeLists.txt │ ├── buffer_ut.c │ └── main.c ├── condition_ut │ ├── CMakeLists.txt │ ├── condition_ut.c │ └── main.c ├── connectionstringparser_ut │ ├── CMakeLists.txt │ ├── connectionstringparser_ut.c │ └── main.c ├── constbuffer_array_batcher_ut │ ├── CMakeLists.txt │ ├── constbuffer_array_batcher_ut.c │ └── main.c ├── constbuffer_array_ut │ ├── CMakeLists.txt │ ├── constbuffer_array_ut.c │ └── main.c ├── constbuffer_ut │ ├── CMakeLists.txt │ ├── constbuffer_ut.c │ └── main.c ├── constmap_ut │ ├── CMakeLists.txt │ ├── constmap_ut.c │ └── main.c ├── crtabstractions_ut │ ├── CMakeLists.txt │ ├── crt_abstractions_ut.c │ └── main.c ├── dns_resolver_ut │ ├── CMakeLists.txt │ ├── dns_resolver_ut.c │ ├── main.c │ └── win32_fake_linux │ │ ├── readme.txt │ │ └── socket_async_os.h ├── doublylinkedlist_ut │ ├── CMakeLists.txt │ ├── doublylinkedlist_ut.c │ └── main.c ├── gballoc_ut │ ├── CMakeLists.txt │ ├── gballoc_undertest.c │ ├── gballoc_ut.c │ └── main.c ├── gballoc_without_init_ut │ ├── CMakeLists.txt │ ├── gballoc_undertest.c │ ├── gballoc_without_init_ut.c │ └── main.c ├── hmacsha256_ut │ ├── CMakeLists.txt │ ├── hmacsha256_ut.c │ └── main.c ├── http_proxy_io_ut │ ├── CMakeLists.txt │ ├── http_proxy_io_ut.c │ └── main.c ├── httpapicompact_ut │ ├── CMakeLists.txt │ ├── httpapi_compact_ut.c │ └── main.c ├── httpapiex_ut │ ├── CMakeLists.txt │ ├── httpapiex_ut.c │ └── main.c ├── httpapiexsas_ut │ ├── CMakeLists.txt │ ├── httpapiexsas_ut.c │ └── main.c ├── httpheaders_ut │ ├── CMakeLists.txt │ ├── httpheaders_ut.c │ └── main.c ├── lock_ut │ ├── CMakeLists.txt │ ├── lock_ut.c │ └── main.c ├── logging_ut │ ├── CMakeLists.txt │ └── minimal │ │ ├── CMakeLists.txt │ │ └── minimal.c ├── map_ut │ ├── CMakeLists.txt │ ├── main.c │ └── map_ut.c ├── memory_data_ut │ ├── CMakeLists.txt │ ├── main.c │ └── memory_data_ut.c ├── optionhandler_ut │ ├── CMakeLists.txt │ ├── main.c │ └── optionhandler_ut.c ├── platform_win32_ut │ ├── CMakeLists.txt │ ├── main.c │ └── platform_win32_ut.c ├── real_test_files │ ├── real_base64.c │ ├── real_buffer.c │ ├── real_constbuffer.c │ ├── real_constbuffer.h │ ├── real_constbuffer_array.c │ ├── real_constbuffer_array.h │ ├── real_constbuffer_array_renames.h │ ├── real_constbuffer_renames.h │ ├── real_crt_abstractions.c │ ├── real_doublylinkedlist.c │ ├── real_map.c │ ├── real_map.h │ ├── real_memory_data.c │ ├── real_memory_data.h │ ├── real_memory_data_renames.h │ ├── real_singlylinkedlist.c │ ├── real_string_token.c │ ├── real_string_tokenizer.c │ ├── real_string_tokenizer.h │ ├── real_strings.c │ ├── real_strings.h │ └── real_vector.c ├── refcount_ut │ ├── CMakeLists.txt │ ├── main.c │ ├── refcount_ut.c │ ├── some_refcount_impl.c │ └── some_refcount_impl.h ├── sastoken_ut │ ├── CMakeLists.txt │ ├── main.c │ └── sastoken_ut.c ├── sha_ut │ ├── CMakeLists.txt │ ├── main.c │ └── sha_ut.c ├── singlylinkedlist_ut │ ├── CMakeLists.txt │ ├── main.c │ └── singlylinkedlist_ut.c ├── socket_async_ut │ ├── CMakeLists.txt │ ├── keep_alive.h │ ├── main.c │ ├── socket_async_ut.c │ ├── test_defines.h │ └── win32_fake_linux │ │ ├── readme.txt │ │ └── socket_async_os.h ├── socketio_berkeley_ut │ ├── CMakeLists.txt │ ├── main.c │ └── socketio_berkeley_ut.c ├── socketio_win32_ut │ ├── CMakeLists.txt │ ├── main.c │ └── socketio_win32_ut.c ├── srw_lock_ut │ ├── CMakeLists.txt │ ├── main.c │ ├── srw_lock_mocked.c │ └── srw_lock_ut.c ├── string_token_ut │ ├── CMakeLists.txt │ ├── main.c │ └── string_token_ut.c ├── string_tokenizer_ut │ ├── CMakeLists.txt │ ├── main.c │ └── string_tokenizer_ut.c ├── string_utils_int │ ├── CMakeLists.txt │ ├── main.c │ ├── nothing.cpp │ └── string_utils_int.c ├── strings_ut │ ├── CMakeLists.txt │ ├── main.c │ └── strings_ut.c ├── template_ut │ ├── CMakeLists.txt │ ├── main.c │ ├── target │ │ ├── callee.h │ │ ├── target.c │ │ └── target.h │ └── template_ut.c ├── tickcounter_freertos_ut │ ├── CMakeLists.txt │ ├── freertos │ │ ├── FreeRTOS.h │ │ └── task.h │ ├── main.c │ └── tickcounter_freertos_ut.c ├── tickcounter_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tickcounter_ut.c ├── timer_win32_ut │ ├── CMakeLists.txt │ ├── main.c │ ├── timer_mocked.c │ └── timer_ut.c ├── tlsio_bearssl_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tlsio_bearssl_ut.c ├── tlsio_cyclonessl_socket_bsd_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tlsio_cyclonessl_socket_bsd_ut.c ├── tlsio_cyclonessl_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tlsio_cyclonessl_ut.c ├── tlsio_mbedtls_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tlsio_mbedtls_ut.c ├── tlsio_options_ut │ ├── CMakeLists.txt │ ├── gballoc_ut_impl_1.h │ ├── gballoc_ut_impl_2.h │ ├── main.c │ └── tlsio_options_ut.c ├── tlsio_wolfssl_ut │ ├── CMakeLists.txt │ ├── main.c │ └── tlsio_wolfssl_ut.c ├── uniqueid_ut │ ├── CMakeLists.txt │ ├── main.c │ ├── uniqueid_ut_linux.c │ └── uniqueid_ut_win32.c ├── urlencode_ut │ ├── CMakeLists.txt │ ├── main.c │ └── urlencode_ut.c ├── utf8_checker_ut │ ├── CMakeLists.txt │ ├── main.c │ └── utf8_checker_ut.c ├── uuid_ut │ ├── CMakeLists.txt │ ├── main.c │ └── uuid_ut.c ├── uws_client_ut │ ├── CMakeLists.txt │ ├── main.c │ └── uws_client_ut.c ├── uws_frame_encoder_ut │ ├── CMakeLists.txt │ ├── main.c │ └── uws_frame_encoder_ut.c ├── valgrind_suppressions.supp ├── vector_ut │ ├── CMakeLists.txt │ ├── main.c │ └── vector_ut.c ├── ws_url_ut │ ├── CMakeLists.txt │ ├── main.c │ └── ws_url_ut.c ├── wsio_ut │ ├── CMakeLists.txt │ ├── main.c │ └── wsio_ut.c ├── x509_openssl_ut │ ├── engine │ │ ├── CMakeLists.txt │ │ └── main.c │ ├── no_engine │ │ ├── CMakeLists.txt │ │ └── main.c │ └── x509_openssl_ut.c ├── x509_schannel_int │ ├── CMakeLists.txt │ ├── main.c │ └── x509_schannel_int.c ├── x509_schannel_ut │ ├── CMakeLists.txt │ ├── main.c │ └── x509_schannel_ut.c └── xio_ut │ ├── CMakeLists.txt │ ├── main.c │ └── xio_ut.c ├── testtools ├── CMakeLists.txt ├── SerialPort │ ├── SerialPort.sln │ └── SerialPort │ │ ├── App.config │ │ ├── Enumerations.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── SerialPort.cs │ │ ├── SerialPort.csproj │ │ ├── SerialPortState.cs │ │ ├── SerialPortTimeouts.cs │ │ ├── Win32Api.cs │ │ └── Win32Exceptioncs.cs ├── micromock │ ├── CMakeLists.txt │ ├── doc │ │ ├── micromock.md │ │ └── timediscretemicromock.xps │ ├── inc │ │ ├── globalmock.h │ │ ├── micromock.h │ │ ├── micromockcallmacros.h │ │ ├── micromockcharstararenullterminatedstrings.h │ │ ├── micromockcommon.h │ │ ├── micromockenumtostring.h │ │ ├── micromockexception.h │ │ ├── micromocktestmutex.h │ │ ├── micromocktestrunnerhooks.h │ │ ├── mock.h │ │ ├── mockcallargument.h │ │ ├── mockcallargumentbase.h │ │ ├── mockcallcomparer.h │ │ ├── mockcallrecorder.h │ │ ├── mockmethodcall.h │ │ ├── mockmethodcallbase.h │ │ ├── mockresultvalue.h │ │ ├── mockvalue.h │ │ ├── mockvaluebase.h │ │ ├── nicecallcomparer.h │ │ ├── runtimemock.h │ │ ├── stdafx.h │ │ ├── strictorderedcallcomparer.h │ │ ├── strictunorderedcallcomparer.h │ │ ├── targetver.h │ │ ├── threadsafeglobalmock.h │ │ ├── timediscretemicromock.h │ │ └── timediscretemicromockcallmacros.h │ ├── src │ │ ├── micromockcharstararenullterminatedstrings.cpp │ │ ├── micromockexception.cpp │ │ ├── micromocktestmutex.cpp │ │ ├── mockcallrecorder.cpp │ │ ├── mockmethodcallbase.cpp │ │ ├── mockvaluebase.cpp │ │ └── timediscretemicromock.cpp │ ├── tools │ │ └── micromockgenerator │ │ │ ├── micromockgenerator.cpp │ │ │ ├── micromockgenerator.rc │ │ │ ├── stdafx.cpp │ │ │ ├── stdafx.h │ │ │ └── targetver.h │ └── unittests │ │ ├── CMakeLists.txt │ │ └── micromocktest │ │ ├── CMakeLists.txt │ │ ├── cmockvalueunittests.cpp │ │ ├── hypothetic_module.c │ │ ├── hypothetic_module.h │ │ ├── hypothetic_module_interfaces.h │ │ ├── main.c │ │ ├── micromockcallcomparisonunittests.cpp │ │ ├── micromocktest.cpp │ │ ├── micromocktest_with_ctest.c │ │ ├── micromockvalidateargumentbufferunittests.cpp │ │ ├── nullargsstringificationunittests.cpp │ │ ├── resource.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ ├── stdafx_c.h │ │ ├── targetver.h │ │ ├── timediscretemicromocktest_stim.cpp │ │ ├── timediscretemicromocktestvoidvoid.cpp │ │ ├── timediscretemicromockwithreturnandparameters.cpp │ │ └── unittestsgenericresource.rc └── sal │ ├── CMakeLists.txt │ └── inc │ ├── no_sal2.h │ └── sal.h └── version.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Default behavior: if Git thinks a file is text (as opposed to binary), it 2 | # will normalize line endings to LF in the repository, but convert to your 3 | # platform's native line endings on checkout (e.g., CRLF for Windows). 4 | * text=auto 5 | 6 | # Explicitly declare text files you want to always be normalized and converted 7 | # to native line endings on checkout. E.g., 8 | #*.c text 9 | 10 | # Declare files that will always have CRLF line endings on checkout. E.g., 11 | #*.sln text eol=crlf 12 | 13 | # Declare files that will always have LF line endings on checkout. E.g., 14 | *.sh text eol=lf 15 | *.json text eol=lf 16 | 17 | # Denote all files that should not have line endings normalized, should not be 18 | # merged, and should not show in a textual diff. 19 | *.docm binary 20 | *.docx binary 21 | *.ico binary 22 | *.lib binary 23 | *.png binary 24 | *.pptx binary 25 | *.snk binary 26 | *.vsdx binary 27 | *.xps binary 28 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "testtools/ctest"] 2 | path = testtools/ctest 3 | url = https://github.com/Azure/azure-ctest.git 4 | [submodule "testtools/testrunner"] 5 | path = testtools/testrunner 6 | url = https://github.com/Azure/azure-c-testrunnerswitcher.git 7 | [submodule "deps/azure-macro-utils-c"] 8 | path = deps/azure-macro-utils-c 9 | url = https://github.com/Azure/azure-macro-utils-c.git 10 | [submodule "deps/umock-c"] 11 | path = deps/umock-c 12 | url = https://github.com/Azure/umock-c.git 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Microsoft Azure IoT SDKs 2 | Copyright (c) Microsoft Corporation 3 | All rights reserved. 4 | MIT License 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the ""Software""), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /adapters/README.md: -------------------------------------------------------------------------------- 1 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 2 | 3 | # azure-c-shared-utility/src 4 | 5 | This directory contains source files for Azure C Shared Utility. 6 | 7 | ### Where did that file go? 8 | 9 | Files related to adapting the Azure IoT C SDK to specific devices are being moved to new locations 10 | within the [azure-c-shared-utility/pal](https://github.com/Azure/azure-c-shared-utility/tree/master/pal) 11 | directory and its subfolders. 12 | 13 | ### Porting to new devices 14 | 15 | Instructions for porting the Azure IoT C SDK to new devices are located 16 | [here](https://github.com/Azure/azure-c-shared-utility/blob/master/devdoc/porting_guide.md). 17 | -------------------------------------------------------------------------------- /adapters/agenttime.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "azure_c_shared_utility/gballoc.h" 6 | #include "azure_c_shared_utility/agenttime.h" 7 | 8 | time_t get_time(time_t* p) 9 | { 10 | return time(p); 11 | } 12 | 13 | struct tm* get_gmtime(time_t* currentTime) 14 | { 15 | return gmtime(currentTime); 16 | } 17 | 18 | time_t get_mktime(struct tm* cal_time) 19 | { 20 | return mktime(cal_time); 21 | } 22 | 23 | char* get_ctime(time_t* timeToGet) 24 | { 25 | return ctime(timeToGet); 26 | } 27 | 28 | double get_difftime(time_t stopTime, time_t startTime) 29 | { 30 | return difftime(stopTime, startTime); 31 | } 32 | -------------------------------------------------------------------------------- /adapters/condition_rtx_mbed.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/lock.h" 5 | #include "azure_c_shared_utility/xlogging.h" 6 | #include "azure_c_shared_utility/condition.h" 7 | #include "rtos.h" 8 | 9 | COND_HANDLE Condition_Init(void) 10 | { 11 | return NULL; 12 | } 13 | 14 | COND_RESULT Condition_Post(COND_HANDLE handle) 15 | { 16 | COND_RESULT result; 17 | if (handle == NULL) 18 | { 19 | result = COND_INVALID_ARG; 20 | } 21 | else 22 | { 23 | result = COND_ERROR; 24 | } 25 | return result; 26 | } 27 | 28 | COND_RESULT Condition_Wait(COND_HANDLE handle, LOCK_HANDLE lock, int timeout_milliseconds) 29 | { 30 | COND_RESULT result; 31 | if (handle == NULL) 32 | { 33 | result = COND_INVALID_ARG; 34 | } 35 | else 36 | { 37 | result = COND_ERROR; 38 | } 39 | return result; 40 | } 41 | 42 | void Condition_Deinit(COND_HANDLE handle) 43 | { 44 | if (handle != NULL) 45 | { 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /adapters/envvariable.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | #include "azure_c_shared_utility/envvariable.h" 7 | 8 | const char* environment_get_variable(const char *variable_name) 9 | { 10 | return getenv(variable_name); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /adapters/linux_time.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef LINUX_TIME_H 5 | #define LINUX_TIME_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #ifndef __MACH__ 12 | extern clockid_t time_basis; 13 | #endif 14 | 15 | extern void set_time_basis(void); 16 | extern int get_time_ns(struct timespec* ts); 17 | extern int64_t get_time_ms(void); 18 | 19 | #define INVALID_TIME_VALUE (int64_t)(-1) 20 | 21 | 22 | #define NANOSECONDS_IN_1_SECOND 1000000000L 23 | #define MILLISECONDS_IN_1_SECOND 1000 24 | #define NANOSECONDS_IN_1_MILLISECOND 1000000L 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /adapters/platform_freertos.c: -------------------------------------------------------------------------------- 1 | // Copyright (C) Firmwave Ltd., All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/platform.h" 5 | #include "azure_c_shared_utility/xio.h" 6 | #include "azure_c_shared_utility/tlsio_cyclonessl.h" 7 | #include "azure_c_shared_utility/threadapi.h" 8 | 9 | #include "debug.h" 10 | 11 | int platform_init(void) 12 | { 13 | //TODO Add proper network events synchronization 14 | ThreadAPI_Sleep(10000); 15 | return 0; 16 | } 17 | 18 | const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void) 19 | { 20 | return tlsio_cyclonessl_get_interface_description(); 21 | } 22 | 23 | STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options) 24 | { 25 | // No applicable options, so ignoring parameter 26 | (void)options; 27 | 28 | // Expected format: "(; ; )" 29 | 30 | return STRING_construct("(native; freertos; undefined)"); 31 | } 32 | 33 | void platform_deinit(void) 34 | { 35 | TRACE_INFO("Deinitializing platform \r\n"); 36 | while(1) {}; 37 | } 38 | -------------------------------------------------------------------------------- /adapters/platform_stub.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/platform.h" 5 | 6 | int platform_init(void) 7 | { 8 | return 0; 9 | } 10 | 11 | const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void) 12 | { 13 | return NULL; 14 | } 15 | 16 | STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options) 17 | { 18 | // No applicable options, so ignoring parameter 19 | (void)options; 20 | 21 | // Expected format: "(; ; )" 22 | 23 | return STRING_construct("(native; undefined; undefined)"); 24 | } 25 | 26 | void platform_deinit(void) 27 | { 28 | return; 29 | } 30 | -------------------------------------------------------------------------------- /adapters/platform_tizenrt.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "azure_c_shared_utility/platform.h" 6 | #include "azure_c_shared_utility/tlsio_mbedtls.h" 7 | 8 | int platform_init(void) 9 | { 10 | return 0; 11 | } 12 | 13 | const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void) 14 | { 15 | return tlsio_mbedtls_get_interface_description(); 16 | } 17 | 18 | STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options) 19 | { 20 | // No applicable options, so ignoring parameter 21 | (void)options; 22 | 23 | // Expected format: "(; ; )" 24 | 25 | return STRING_construct("(native; tizenrt; undefined)"); 26 | } 27 | 28 | void platform_deinit(void) 29 | { 30 | return; 31 | } 32 | -------------------------------------------------------------------------------- /adapters/random_posix.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifdef __cplusplus 5 | #include 6 | #else 7 | #include 8 | #endif 9 | 10 | #include "azure_c_shared_utility/random.h" 11 | 12 | void RANDOM_seed(unsigned int seed) 13 | { 14 | srandom(seed); 15 | } 16 | 17 | int RANDOM_generate(void) 18 | { 19 | return random(); 20 | } 21 | -------------------------------------------------------------------------------- /adapters/random_stub.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifdef __cplusplus 5 | #include 6 | #else 7 | #include 8 | #endif 9 | 10 | #include "azure_c_shared_utility/random.h" 11 | 12 | void RANDOM_seed(unsigned int seed) 13 | { 14 | srand(seed); 15 | } 16 | 17 | int RANDOM_generate(void) 18 | { 19 | return rand(); 20 | } 21 | -------------------------------------------------------------------------------- /archive/cyclonessl/readme.md: -------------------------------------------------------------------------------- 1 | **CycloneSSL is NOT supported for the Azure C shared utilities.** 2 | 3 | The code here is provided for reference purposes. 4 | 5 | A security audit is required if you attempt to bring this code back. -------------------------------------------------------------------------------- /build_all/linux/run_tests.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Copyright (c) Microsoft. All rights reserved. 4 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | 6 | set -o errexit # Exit if command failed. 7 | set -o pipefail # Exit if pipe failed. 8 | 9 | # Only for testing E2E behaviour !!! 10 | TEST_CORES=16 11 | 12 | # Refresh dynamic libs to link to 13 | sudo ldconfig 14 | 15 | ctest -T test --no-compress-output -C "Debug" -V -j $TEST_CORES --schedule-random 16 | 17 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/azure-c-shared-util-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/ 2 | usr/include/ 3 | usr/include/azureiot/ 4 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/azure-c-shared-util-dev.install: -------------------------------------------------------------------------------- 1 | inc usr/include/azureiot 2 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/azure-c-shared-util-lib.dirs: -------------------------------------------------------------------------------- 1 | usr/ 2 | usr/lib 3 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/azure-c-shared-util-lib.install: -------------------------------------------------------------------------------- 1 | /obj-*/lib*.a /usr/lib 2 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/changelog-trusty: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.2.0-1trusty) trusty; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Tue, 27 Sep 2016 17:00:00 +0000 6 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/changelog-vivid: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.1.0-60vivid) vivid; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/changelog-wily: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (undefined) wily; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/changelog-xenial: -------------------------------------------------------------------------------- 1 | azure-c-shared-util (0.2.0.0-1xenial) xenial; urgency=low 2 | 3 | * See https://github.com/Azure/azure-iot-sdk-c/releases for details of the release 4 | 5 | -- AzureIoT User Thu, 29 Sep 2016 11:00:00 +0000 6 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/control: -------------------------------------------------------------------------------- 1 | Source: azure-c-shared-util 2 | Priority: optional 3 | Maintainer: Azure User 4 | Build-Depends: debhelper (>= 9), cmake (>= 2.8), uuid-dev, libssl-dev, libcurl4-openssl-dev, curl 5 | Standards-Version: 3.9.6 6 | Section: libs 7 | Homepage: https://github.com/Azure/azure-c-shared-utility.git 8 | #Vcs-Git: git://anonscm.debian.org/collab-maint/azure-c-shared-util.git 9 | #Vcs-Browser: http://anonscm.debian.org/?p=collab-maint/azure-c-shared-util.git;a=summary 10 | 11 | Package: azure-c-shared-util-dev 12 | Section: libdevel 13 | Architecture: any 14 | Depends: azure-c-shared-util-lib (= ${binary:Version}), ${misc:Depends}, uuid-dev, libssl-dev, libcurl4-openssl-dev, curl 15 | Description: AzureIoT Shared Utility Development Library Package 16 | The Microsoft Azure shared utility development library used to develop applications 17 | for developers and IT Staff 18 | 19 | Package: azure-c-shared-util-lib 20 | Architecture: any 21 | Depends: ${shlibs:Depends}, ${misc:Depends}, uuid-dev, libssl-dev, libcurl4-openssl-dev, curl 22 | Description: AzureIoT Shared Utility Library Package 23 | The Microsoft Azure shared utility library used to develop applications 24 | for developers and IT Staff 25 | 26 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/docs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/build_all/packaging/linux/debian/docs -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | DH_VERBOSE = 1 5 | 6 | # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* 7 | DPKG_EXPORT_BUILDFLAGS = 1 8 | include /usr/share/dpkg/default.mk 9 | 10 | # see FEATURE AREAS in dpkg-buildflags(1) 11 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 12 | 13 | # see ENVIRONMENT in dpkg-buildflags(1) 14 | # package maintainers to append CFLAGS 15 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 16 | # package maintainers to append LDFLAGS 17 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 18 | 19 | 20 | # main packaging script based on dh7 syntax 21 | %: 22 | dh $@ --buildsystem=cmake --DSYSINSTALL_BINDINGS=ON 23 | 24 | override_dh_auto_configure: 25 | dh_auto_configure -- 26 | 27 | -------------------------------------------------------------------------------- /build_all/packaging/linux/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /build_all/packaging/windows/Microsoft.Azure.C.SharedUtility_thirdpartynotice.txt: -------------------------------------------------------------------------------- 1 | Third Party Notices for Azure Shared Utility project 2 | 3 | This project incorporates material from the project(s) listed below (collectively, "Third Party Code"). 4 | Microsoft Corporation is not the original author of the Third Party Code. 5 | The original copyright notice and license, under which Microsoft Corporation received such Third Party Code, 6 | are set out below. This Third Party Code is licensed to you under their original license terms set forth below. 7 | Microsoft Corporation reserves all other rights not expressly granted, whether by implication, estoppel or otherwise. 8 | -------------------------------------------------------------------------------- /build_all/tirtos/package.xdc: -------------------------------------------------------------------------------- 1 | /* 2 | * ======== package.xdc ======== 3 | */ 4 | package build_all.tirtos { 5 | } 6 | -------------------------------------------------------------------------------- /configs/azure_c_shared_utilityConfig.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(UNIX) 5 | if(${use_http}) 6 | include(CMakeFindDependencyMacro) 7 | find_dependency(CURL) 8 | endif() 9 | endif() 10 | 11 | include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityTargets.cmake") 12 | 13 | get_target_property(AZURE_C_SHARED_UTILITY_INCLUDES aziotsharedutil INTERFACE_INCLUDE_DIRECTORIES) 14 | 15 | set(AZURE_C_SHARED_UTILITY_INCLUDES ${AZURE_C_SHARED_UTILITY_INCLUDES} CACHE INTERNAL "") 16 | 17 | include("${CMAKE_CURRENT_LIST_DIR}/azure_c_shared_utilityFunctions.cmake") 18 | include("${CMAKE_CURRENT_LIST_DIR}/azure_iot_build_rules.cmake") 19 | -------------------------------------------------------------------------------- /configs/azure_iot_external_pal_unit_test_setup.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | # quiet the CMake warning about unused command line args "use_wsio". This is from the c-utility CMake command. 7 | set(ignore_me ${use_wsio}) 8 | 9 | # Set up to make an external repo's unit tests 10 | include("${CMAKE_CURRENT_LIST_DIR}/azure_iot_build_rules.cmake") 11 | include("${SHARED_UTIL_FOLDER}/dependencies-test.cmake") 12 | 13 | add_subdirectory(${SHARED_UTIL_FOLDER}/testtools/ctest) 14 | add_subdirectory(${SHARED_UTIL_FOLDER}/testtools/testrunner) 15 | add_subdirectory(${SHARED_UTIL_FOLDER}/testtools/umock-c) 16 | 17 | #Setup the platform files in order to include the logging file definitions 18 | include("${SHARED_UTIL_FOLDER}/configs/azure_c_shared_utilityFunctions.cmake") 19 | set_platform_files(${SHARED_UTIL_FOLDER}) 20 | -------------------------------------------------------------------------------- /dependencies-test.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(${use_installed_dependencies}) 5 | find_package(umock_c REQUIRED CONFIG) 6 | endif() -------------------------------------------------------------------------------- /dependencies.cmake: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | if(NOT ${use_installed_dependencies}) 5 | if (NOT TARGET azure_macro_utils_c) 6 | if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/azure-macro-utils-c/CMakeLists.txt) 7 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/deps/azure-macro-utils-c) 8 | else() 9 | message(FATAL_ERROR "Could not find azure-macro-utils-c source") 10 | endif() 11 | endif() 12 | if (NOT TARGET umock_c) 13 | if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/umock-c/CMakeLists.txt) 14 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/deps/umock-c) 15 | else() 16 | message(FATAL_ERROR "Could not find umock-c source") 17 | endif() 18 | endif() 19 | else() 20 | find_package(azure_macro_utils_c REQUIRED CONFIG) 21 | find_package(umock_c REQUIRED CONFIG) 22 | endif() 23 | 24 | include_directories(${MACRO_UTILS_INC_FOLDER}) 25 | include_directories(${UMOCK_C_INC_FOLDER}) 26 | -------------------------------------------------------------------------------- /devdoc/agenttime_requirements.md: -------------------------------------------------------------------------------- 1 | AgentTime 2 | ================ 3 | 4 | ## Overview 5 | 6 | AgentTime exports platform independent time related functions. It is a platform abstraction and it requires a specific implementation for each platform. 7 | Most of the times these functions can simply call the C standard time functions. 8 | 9 | Most implementations of the C `time()` function return seconds since 00:00 hours, Jan 1, 1970 UTC. Implementations 10 | which do not must convert the output of `time()` to conform to this spec. 11 | 12 | ###### Header files 13 | - [agenttime.h](https://github.com/Azure/azure-c-shared-utility/blob/master/inc/azure_c_shared_utility/agenttime.h)
14 | 15 | 16 | ## Exposed API 17 | **SRS_AGENT_TIME_99_001: [** AGENT_TIME shall have the following interface **]** 18 | ```c 19 | /* same functionality as most implementations time() of standard C function */ 20 | time_t get_time(time_t* p); 21 | 22 | /*the same as C's difftime*/ 23 | extern double get_difftime(time_t stopTime, time_t startTime); 24 | ``` 25 | 26 | **SRS_AGENT_TIME_30_002: [** The `time_t` values in this interface shall be seconds since 00:00 hours, Jan 1, 1970 UTC. **]** 27 | 28 | **SRS_AGENT_TIME_30_003: [** The `get_gmtime`, `get_mktime`, and `get_ctime` functions in are deprecated and shall not be used. **]** 29 | -------------------------------------------------------------------------------- /devdoc/httpapiex_retry_mechanism.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/httpapiex_retry_mechanism.vsdx -------------------------------------------------------------------------------- /devdoc/img/porting_guide_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img/porting_guide_overview.png -------------------------------------------------------------------------------- /devdoc/img/readme.txt: -------------------------------------------------------------------------------- 1 | The images in this directory were generated from source files in the sibling 'img_src' directory. 2 | -------------------------------------------------------------------------------- /devdoc/img/tlsio_state_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img/tlsio_state_diagram.png -------------------------------------------------------------------------------- /devdoc/img/xio_chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img/xio_chain.png -------------------------------------------------------------------------------- /devdoc/img_src/porting_guide_overview.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img_src/porting_guide_overview.vsdx -------------------------------------------------------------------------------- /devdoc/img_src/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains the source files used to generate the image files in the sibling 'img' directory. 2 | -------------------------------------------------------------------------------- /devdoc/img_src/tlsio_state_diagram.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img_src/tlsio_state_diagram.pptx -------------------------------------------------------------------------------- /devdoc/img_src/xio_chain.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/devdoc/img_src/xio_chain.pptx -------------------------------------------------------------------------------- /devdoc/uniqueid_requirements.md: -------------------------------------------------------------------------------- 1 | uniqueid requirements 2 | ================= 3 | 4 | ## Overview 5 | The UniqueIDs module provides pseudo unique identifiers to the rest of the modules 6 | 7 | ## Exposed API 8 | ```C 9 | #define UNIQUEID_RESULT_VALUES \ 10 | UNIQUEID_OK, \ 11 | UNIQUEID_INVALID_ARG, \ 12 | UNIQUEID_ERROR 13 | 14 | MU_DEFINE_ENUM(UNIQUEID_RESULT, UNIQUEID_RESULT_VALUES) 15 | 16 | extern UNIQUEID_RESULT UniqueId_Generate(char* uid, size_t bufferSize); 17 | ``` 18 | ### UniqueId_Generate 19 | ```C 20 | extern UNIQUEID_RESULT UniqueId_Generate(char* uid, size_t len); 21 | ``` 22 | **SRS_UNIQUEID_07_001: [** UniqueId_Generate shall create a unique Id 36 character long string. **]** 23 | 24 | **SRS_UNIQUEID_07_002: [** If uid is NULL then UniqueId_Generate shall return UNIQUEID_INVALID_ARG **]** 25 | 26 | **SRS_UNIQUEID_07_003: [** If len is less then 37 then UniqueId_Generate shall return UNIQUEID_INVALID_ARG **]** 27 | 28 | **SRS_UNIQUEID_07_004: [** If there is a failure for any reason the UniqueId_Generate shall return UNIQUEID_ERROR **]** -------------------------------------------------------------------------------- /devdoc/url_encode_requirements.md: -------------------------------------------------------------------------------- 1 | url_encode requirements 2 | ================ 3 | 4 | ## Overview 5 | 6 | This document will specify the requirements for URL_Encode. 7 | 8 | ## Exposed API 9 | 10 | ```c 11 | extern STRING* URL_Encode(STRING* input); 12 | ``` 13 | 14 | ### URL_Encode 15 | 16 | URL_Encode will take as a parameter a pointer to a STRING, input. URL_Encode will return a pointer to STRING. 17 | **SRS_URL_ENCODE_06_001: [** If input is NULL then URL_Encode will return NULL. **]** 18 | 19 | **SRS_URL_ENCODE_06_002: [** If an error occurs during the encoding of input then URL_Encode will return NULL. **]** 20 | 21 | **SRS_URL_ENCODE_06_003: [** If input is a zero length string then URL_Encode will return a zero length string. **]** 22 | URL_Encode will encode input in a manner that respects the encoding used in the .net HttpUtility.UrlEncode. 23 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/connection_string_parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CONNECTION_STRING_PARSER_H 5 | #define CONNECTION_STRING_PARSER_H 6 | 7 | #include "azure_c_shared_utility/map.h" 8 | #include "azure_c_shared_utility/strings.h" 9 | 10 | #include "umock_c/umock_c_prod.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | MOCKABLE_FUNCTION(, MAP_HANDLE, connectionstringparser_parse_from_char, const char*, connection_string); 18 | MOCKABLE_FUNCTION(, MAP_HANDLE, connectionstringparser_parse, STRING_HANDLE, connection_string); 19 | MOCKABLE_FUNCTION(, int, connectionstringparser_splitHostName_from_char, const char*, hostName, STRING_HANDLE, nameString, STRING_HANDLE, suffixString); 20 | MOCKABLE_FUNCTION(, int, connectionstringparser_splitHostName, STRING_HANDLE, hostNameString, STRING_HANDLE, nameString, STRING_HANDLE, suffixString); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* CONNECTION_STRING_PARSER_H */ 27 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/consolelogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CONSOLELOGGER_H 5 | #define CONSOLELOGGER_H 6 | 7 | #include "azure_c_shared_utility/xlogging.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif /* __cplusplus */ 12 | 13 | void consolelogger_log(LOG_CATEGORY log_category, const char* file, const char* func, int line, unsigned int options, const char* format, ...); 14 | 15 | #if (defined(_MSC_VER)) 16 | void consolelogger_log_with_GetLastError(const char* file, const char* func, int line, const char* format, ...); 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* CONSOLELOGGER_H */ 24 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/const_defines.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CONST_DEFINES_H 5 | #define CONST_DEFINES_H 6 | 7 | // Used to remove GCC warning unused 8 | #ifdef __GNUC__ 9 | #define STATIC_VAR_UNUSED __attribute__ ((unused)) 10 | #else 11 | #define STATIC_VAR_UNUSED 12 | #endif 13 | 14 | #ifndef AZURE_UNREFERENCED_PARAMETER 15 | #define AZURE_UNREFERENCED_PARAMETER(param) (void)(param) 16 | #endif 17 | 18 | #ifdef _MSC_VER 19 | #define AZURE_DEPRECATED __declspec(deprecated) 20 | #elif defined(__GNUC__) | defined(__clang__) 21 | #define AZURE_DEPRECATED __attribute__((__deprecated__)) 22 | #else 23 | #define AZURE_DEPRECATED 24 | #endif 25 | 26 | #endif // CONST_DEFINES 27 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/constbuffer_array_batcher.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | 3 | #ifndef CONSTBUFFER_ARRAY_BATCHER_H 4 | #define CONSTBUFFER_ARRAY_BATCHER_H 5 | 6 | #ifdef __cplusplus 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | #include "azure_c_shared_utility/constbuffer_array.h" 13 | #include "umock_c/umock_c_prod.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | MOCKABLE_FUNCTION(, CONSTBUFFER_ARRAY_HANDLE, constbuffer_array_batcher_batch, CONSTBUFFER_ARRAY_HANDLE*, payloads, uint32_t, count); 20 | MOCKABLE_FUNCTION(, CONSTBUFFER_ARRAY_HANDLE*, constbuffer_array_batcher_unbatch, CONSTBUFFER_ARRAY_HANDLE, batch, uint32_t*, payload_count); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /* CONSTBUFFER_ARRAY_BATCHER_H */ 27 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/envvariable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef ENV_VARIABLE_H 5 | #define ENV_VARIABLE_H 6 | 7 | #include "umock_c/umock_c_prod.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | MOCKABLE_FUNCTION(, const char*, environment_get_variable, const char*, variable_name); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif /* ENV_VARIABLE_H */ 21 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/etwlogger_driver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef ETWLOGGER_DRIVER_H 5 | #define ETWLOGGER_DRIVER_H 6 | 7 | #include "azure_c_shared_utility/xlogging.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif /* __cplusplus */ 12 | 13 | extern void etwlogger_log(LOG_CATEGORY log_category, const char* file, const char* func, int line, unsigned int options, const char* format, ...); 14 | 15 | #if (defined(_MSC_VER)) 16 | extern void etwlogger_log_with_GetLastError(const char* file, const char* func, int line, const char* format, ...); 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* ETWLOGGER_DRIVER_H */ 24 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/hmac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef HMAC_H 5 | #define HMAC_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #include "azure_c_shared_utility/sha.h" 14 | #include "umock_c/umock_c_prod.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | MOCKABLE_FUNCTION(, int, hmac, SHAversion, whichSha, const unsigned char *, text, int, text_len, 21 | const unsigned char *, key, int, key_len, 22 | uint8_t, digest[USHAMaxHashSize]); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /* HMAC_H */ 29 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/hmacsha256.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef HMACSHA256_H 5 | #define HMACSHA256_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #include "azure_macro_utils/macro_utils.h" 14 | #include "azure_c_shared_utility/buffer_.h" 15 | #include "umock_c/umock_c_prod.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #define HMACSHA256_RESULT_VALUES \ 22 | HMACSHA256_OK, \ 23 | HMACSHA256_INVALID_ARG, \ 24 | HMACSHA256_ERROR 25 | 26 | MU_DEFINE_ENUM(HMACSHA256_RESULT, HMACSHA256_RESULT_VALUES) 27 | 28 | MOCKABLE_FUNCTION(, HMACSHA256_RESULT, HMACSHA256_ComputeHash, const unsigned char*, key, size_t, keyLen, const unsigned char*, payload, size_t, payloadLen, BUFFER_HANDLE, hash); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* HMACSHA256_H */ 35 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/http_proxy_io.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef HTTP_PROXY_IO_H 5 | #define HTTP_PROXY_IO_H 6 | 7 | #include "azure_c_shared_utility/xio.h" 8 | #include "umock_c/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif /* __cplusplus */ 13 | 14 | typedef struct HTTP_PROXY_IO_CONFIG_TAG 15 | { 16 | const char* hostname; 17 | int port; 18 | const char* proxy_hostname; 19 | int proxy_port; 20 | const char* username; 21 | const char* password; 22 | } HTTP_PROXY_IO_CONFIG; 23 | 24 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, http_proxy_io_get_interface_description); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif /* __cplusplus */ 29 | 30 | #endif /* HTTP_PROXY_IO_H */ 31 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/logging_stacktrace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef LOGGING_STACKTRACE_H 5 | #define LOGGING_STACKTRACE_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | char* getStackAsString(void); 18 | void* logging_malloc(size_t size); /*same as malloc from stdlib, always.*/ 19 | void logging_free(void* ptr); /*same as free from stdlib, always.*/ 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /*LOGGING_STACKTRACE_H*/ 26 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/optimize_size.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef OPTIMIZE_SIZE_H 5 | #define OPTIMIZE_SIZE_H 6 | 7 | #if (defined __MSP430FR5969__) 8 | #define OPTIMIZE_RETURN_CODES 9 | #define NO_VERBOSE_OUTPUT 10 | #ifdef DEBUG 11 | #define MINIMAL_LOGERROR 12 | #else 13 | #define NO_LOGGING 14 | #endif 15 | #endif 16 | 17 | #if (defined OPTIMIZE_RETURN_CODES) 18 | #define MU_FAILURE 1 19 | #else 20 | #define MU_FAILURE __LINE__ 21 | #endif 22 | 23 | #endif // OPTIMIZE_SIZE_H 24 | 25 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/platform.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef PLATFORM_H 5 | #define PLATFORM_H 6 | 7 | #include "azure_c_shared_utility/strings.h" 8 | #include "azure_c_shared_utility/xio.h" 9 | #include "umock_c/umock_c_prod.h" 10 | 11 | #define GUID_LENGTH 64 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif /* __cplusplus */ 16 | 17 | #define PLATFORM_INFO_OPTION_VALUES \ 18 | PLATFORM_INFO_OPTION_DEFAULT, \ 19 | PLATFORM_INFO_OPTION_RETRIEVE_SQM 20 | 21 | MU_DEFINE_ENUM(PLATFORM_INFO_OPTION, PLATFORM_INFO_OPTION_VALUES); 22 | 23 | MOCKABLE_FUNCTION(, int, platform_init); 24 | MOCKABLE_FUNCTION(, void, platform_deinit); 25 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, platform_get_default_tlsio); 26 | MOCKABLE_FUNCTION(, STRING_HANDLE, platform_get_platform_info, PLATFORM_INFO_OPTION, options); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif /* __cplusplus */ 31 | 32 | #endif /* PLATFORM_H */ 33 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/random.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef RANDOM_H 5 | #define RANDOM_H 6 | 7 | #include "umock_c/umock_c_prod.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | MOCKABLE_FUNCTION(, void, RANDOM_seed, unsigned int, seed); 14 | MOCKABLE_FUNCTION(, int, RANDOM_generate); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif /* RANDOM_H */ 21 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/safe_math.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SAFE_MATH_H 5 | #define SAFE_MATH_H 6 | 7 | #ifndef SIZE_MAX 8 | #define SIZE_MAX ((size_t)((size_t)~(size_t)0)) 9 | #endif 10 | 11 | #define safe_add_size_t(a, b) ((((size_t)(a)) < ((size_t)(SIZE_MAX - ((size_t)(b))))) ? ((size_t)(a) + (size_t)(b)) : SIZE_MAX) 12 | 13 | #define safe_subtract_size_t(a, b) (((a) >= (b)) ? ((size_t)(a) - (size_t)(b)) : SIZE_MAX) 14 | 15 | #define safe_multiply_size_t(a, b) (((a) == 0 || (b) == 0) ? 0 : (((SIZE_MAX / (size_t)(a)) >= (size_t)(b)) ? (size_t)(a) * (size_t)(b) : SIZE_MAX)) 16 | 17 | #endif // SAFE_MATH_H 18 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/sastoken.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SASTOKEN_H 5 | #define SASTOKEN_H 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | #else 11 | #include 12 | #endif 13 | 14 | #include "azure_c_shared_utility/strings.h" 15 | #include "umock_c/umock_c_prod.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | MOCKABLE_FUNCTION(, bool, SASToken_Validate, STRING_HANDLE, sasToken); 22 | MOCKABLE_FUNCTION(, STRING_HANDLE, SASToken_Create, STRING_HANDLE, key, STRING_HANDLE, scope, STRING_HANDLE, keyName, uint64_t, expiry); 23 | MOCKABLE_FUNCTION(, STRING_HANDLE, SASToken_CreateString, const char*, key, const char*, scope, const char*, keyName, uint64_t, expiry); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* SASTOKEN_H */ 30 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/sha-private.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /*************************** sha-private.h ***************************/ 5 | /********************** See RFC 4634 for details *********************/ 6 | #ifndef _SHA_PRIVATE__H 7 | #define _SHA_PRIVATE__H 8 | /* 9 | * These definitions are defined in FIPS-180-2, section 4.1. 10 | * Ch() and Maj() are defined identically in sections 4.1.1, 11 | * 4.1.2 and 4.1.3. 12 | * 13 | * The definitions used in FIPS-180-2 are as follows: 14 | */ 15 | 16 | #ifndef USE_MODIFIED_MACROS 17 | #define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) 18 | #define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) 19 | 20 | #else /* USE_MODIFIED_MACROS */ 21 | /* 22 | * The following definitions are equivalent and potentially faster. 23 | */ 24 | 25 | #define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z)) 26 | #define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) 27 | 28 | #endif /* USE_MODIFIED_MACROS */ 29 | 30 | #define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z)) 31 | 32 | #endif /* _SHA_PRIVATE__H */ 33 | 34 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/srw_lock.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | 3 | #ifndef SRW_LOCK_H 4 | #define SRW_LOCK_H 5 | 6 | #ifdef __cplusplus 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | #include "azure_macro_utils/macro_utils.h" 13 | #include "umock_c/umock_c_prod.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | typedef struct SRW_LOCK_HANDLE_DATA_TAG* SRW_LOCK_HANDLE; 20 | 21 | MOCKABLE_FUNCTION(, SRW_LOCK_HANDLE, srw_lock_create, bool, do_statistics, const char*, lock_name); 22 | 23 | /*writer APIs*/ 24 | MOCKABLE_FUNCTION(, void, srw_lock_acquire_exclusive, SRW_LOCK_HANDLE, handle); 25 | MOCKABLE_FUNCTION(, void, srw_lock_release_exclusive, SRW_LOCK_HANDLE, handle); 26 | 27 | /*reader APIs*/ 28 | MOCKABLE_FUNCTION(, void, srw_lock_acquire_shared, SRW_LOCK_HANDLE, handle); 29 | MOCKABLE_FUNCTION(, void, srw_lock_release_shared, SRW_LOCK_HANDLE, handle); 30 | 31 | MOCKABLE_FUNCTION(, void, srw_lock_destroy, SRW_LOCK_HANDLE, handle); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/stdint_ce6.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | typedef signed char int8_t; 5 | typedef signed short int16_t; 6 | typedef signed int int32_t; 7 | typedef unsigned char uint8_t; 8 | typedef unsigned short uint16_t; 9 | typedef unsigned int uint32_t; 10 | typedef signed __int64 int64_t; 11 | typedef unsigned __int64 uint64_t; 12 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/string_tokenizer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STRING_TOKENIZER_H 5 | #define STRING_TOKENIZER_H 6 | 7 | #include "azure_c_shared_utility/strings.h" 8 | #include "umock_c/umock_c_prod.h" 9 | #include "azure_c_shared_utility/string_tokenizer_types.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" 13 | { 14 | #endif 15 | 16 | MOCKABLE_FUNCTION(, STRING_TOKENIZER_HANDLE, STRING_TOKENIZER_create, STRING_HANDLE, handle); 17 | MOCKABLE_FUNCTION(, STRING_TOKENIZER_HANDLE, STRING_TOKENIZER_create_from_char, const char*, input); 18 | MOCKABLE_FUNCTION(, int, STRING_TOKENIZER_get_next_token, STRING_TOKENIZER_HANDLE, t, STRING_HANDLE, output, const char*, delimiters); 19 | MOCKABLE_FUNCTION(, void, STRING_TOKENIZER_destroy, STRING_TOKENIZER_HANDLE, t); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /*STRING_TOKENIZER_H*/ 26 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/string_tokenizer_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STRING_TOKENIZER_TYPES_H 5 | #define STRING_TOKENIZER_TYPES_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #endif 11 | 12 | typedef struct STRING_TOKEN_TAG* STRING_TOKENIZER_HANDLE; 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif /*STRING_TOKENIZER_TYPES_H*/ 19 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/strings_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef STRINGS_TYPES_H 5 | #define STRINGS_TYPES_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #endif 11 | 12 | typedef struct STRING_TAG* STRING_HANDLE; 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif /*STRINGS_TYPES_H*/ 19 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/tickcounter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TICKCOUNTER_H 5 | #define TICKCOUNTER_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #include "umock_c/umock_c_prod.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" 17 | { 18 | #endif /* __cplusplus */ 19 | 20 | typedef uint_fast64_t tickcounter_ms_t; // Use 64-bit because of 32-bit is going to roll over back to zero after roughly 49.7 days that is not good for IoT devices which need keep running for months 21 | typedef struct TICK_COUNTER_INSTANCE_TAG *TICK_COUNTER_HANDLE; 22 | 23 | MOCKABLE_FUNCTION(, TICK_COUNTER_HANDLE, tickcounter_create); 24 | MOCKABLE_FUNCTION(, void, tickcounter_destroy, TICK_COUNTER_HANDLE, tick_counter); 25 | MOCKABLE_FUNCTION(, int, tickcounter_get_current_ms, TICK_COUNTER_HANDLE, tick_counter, tickcounter_ms_t *, current_ms); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif /* __cplusplus */ 30 | 31 | #endif /* TICKCOUNTER_H */ 32 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | 3 | #include "windows.h" 4 | 5 | #ifndef TIMER_H 6 | #define TIMER_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" 10 | { 11 | #endif 12 | 13 | typedef struct TIMER_HANDLE_DATA_TAG* TIMER_HANDLE; 14 | 15 | #include "umock_c/umock_c_prod.h" 16 | 17 | 18 | MOCKABLE_FUNCTION(, TIMER_HANDLE, timer_create); 19 | MOCKABLE_FUNCTION(, void, timer_start, TIMER_HANDLE, handle); 20 | MOCKABLE_FUNCTION(, double, timer_get_elapsed, TIMER_HANDLE, timer); 21 | MOCKABLE_FUNCTION(, double, timer_get_elapsed_ms, TIMER_HANDLE, timer); 22 | MOCKABLE_FUNCTION(, void, timer_destroy, TIMER_HANDLE, timer); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/tlsio.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_H 5 | #define TLSIO_H 6 | 7 | #include 8 | #include "xio.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif /* __cplusplus */ 13 | 14 | typedef struct TLSIO_CONFIG_TAG 15 | { 16 | const char* hostname; 17 | int port; 18 | const IO_INTERFACE_DESCRIPTION* underlying_io_interface; 19 | void* underlying_io_parameters; 20 | bool invoke_on_send_complete_callback_for_fragments; 21 | } TLSIO_CONFIG; 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif /* __cplusplus */ 26 | 27 | #endif /* TLSIO_H */ 28 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/tlsio_cyclonessl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_CYCLONESSL_H 5 | #define TLSIO_CYCLONESSL_H 6 | 7 | #include "azure_c_shared_utility/xio.h" 8 | #include "umock_c/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #include 13 | #else 14 | #include 15 | #endif /* __cplusplus */ 16 | 17 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, tlsio_cyclonessl_get_interface_description); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* TLSIO_CYCLONESSL_H */ 24 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/tlsio_cyclonessl_socket.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_CYCLONESSL_SOCKET_H 5 | #define TLSIO_CYCLONESSL_SOCKET_H 6 | 7 | #include "tls.h" 8 | #include "umock_c/umock_c_prod.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif /* __cplusplus */ 13 | 14 | MOCKABLE_FUNCTION(, int, tlsio_cyclonessl_socket_create, const char*, hostname, unsigned int, port, TlsSocket*, new_socket); 15 | MOCKABLE_FUNCTION(, void, tlsio_cyclonessl_socket_destroy, TlsSocket, socket); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif /* __cplusplus */ 20 | 21 | #endif /* TLSIO_CYCLONESSL_SOCKET_H */ 22 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/uniqueid.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UNIQUEID_H 5 | #define UNIQUEID_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #include "azure_macro_utils/macro_utils.h" 14 | #include "umock_c/umock_c_prod.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #define UNIQUEID_RESULT_VALUES \ 21 | UNIQUEID_OK, \ 22 | UNIQUEID_INVALID_ARG, \ 23 | UNIQUEID_ERROR 24 | 25 | MU_DEFINE_ENUM(UNIQUEID_RESULT, UNIQUEID_RESULT_VALUES) 26 | 27 | MOCKABLE_FUNCTION(, UNIQUEID_RESULT, UniqueId_Generate, char*, uid, size_t, bufferSize); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* UNIQUEID_H */ 34 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/utf8_checker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef UTF8_CHECKER_H 5 | #define UTF8_CHECKER_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #include 12 | #endif 13 | 14 | #include "umock_c/umock_c_prod.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | MOCKABLE_FUNCTION(, bool, utf8_checker_is_valid_utf8, const unsigned char*, utf8_str, size_t, length); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif /* __cplusplus */ 25 | 26 | #endif /* UTF8_CHECKER_H */ 27 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/vector_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef VECTOR_TYPES_H 5 | #define VECTOR_TYPES_H 6 | 7 | #ifdef __cplusplus 8 | #else 9 | #include 10 | #endif 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | typedef struct VECTOR_TAG* VECTOR_HANDLE; 18 | 19 | typedef bool(*PREDICATE_FUNCTION)(const void* element, const void* value); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /* VECTOR_TYPES_H */ 26 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/vector_types_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef VECTOR_TYPES_INTERNAL_H 5 | #define VECTOR_TYPES_INTERNAL_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | extern "C" 15 | { 16 | #endif 17 | 18 | typedef struct VECTOR_TAG 19 | { 20 | void* storage; 21 | size_t count; 22 | size_t elementSize; 23 | } VECTOR; 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* VECTOR_TYPES_INTERNAL_H */ 30 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/ws_url.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef WS_URL_H 5 | #define WS_URL_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #include 12 | #endif 13 | 14 | #include "umock_c/umock_c_prod.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef struct WS_URL_TAG* WS_URL_HANDLE; 21 | 22 | MOCKABLE_FUNCTION(, WS_URL_HANDLE, ws_url_create, const char*, url); 23 | MOCKABLE_FUNCTION(, int, ws_url_is_secure, WS_URL_HANDLE, url, bool*, is_secure); 24 | MOCKABLE_FUNCTION(, int, ws_url_get_host, WS_URL_HANDLE, url, const char**, host, size_t*, length); 25 | MOCKABLE_FUNCTION(, int, ws_url_get_port, WS_URL_HANDLE, url, size_t*, port); 26 | MOCKABLE_FUNCTION(, int, ws_url_get_path, WS_URL_HANDLE, url, const char**, path, size_t*, length); 27 | MOCKABLE_FUNCTION(, int, ws_url_get_query, WS_URL_HANDLE, url, const char**, query, size_t*, length); 28 | MOCKABLE_FUNCTION(, void, ws_url_destroy, WS_URL_HANDLE, url); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif /* __cplusplus */ 33 | 34 | #endif // WS_URL_H -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/wsio.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef WSIO_H 5 | #define WSIO_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | #else 10 | #include 11 | #include 12 | #endif /* __cplusplus */ 13 | 14 | #include "azure_c_shared_utility/xio.h" 15 | #include "azure_c_shared_utility/xlogging.h" 16 | #include "umock_c/umock_c_prod.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif /* __cplusplus */ 21 | 22 | typedef struct WSIO_CONFIG_TAG 23 | { 24 | const IO_INTERFACE_DESCRIPTION* underlying_io_interface; 25 | void* underlying_io_parameters; 26 | const char* hostname; 27 | int port; 28 | const char* resource_name; 29 | const char* protocol; 30 | } WSIO_CONFIG; 31 | 32 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, wsio_get_interface_description); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif /* __cplusplus */ 37 | 38 | #endif /* WSIO_H */ 39 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/x509_openssl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef X509_OPENSSL_H 5 | #define X509_OPENSSL_H 6 | 7 | #include "openssl/ssl.h" 8 | #include "azure_c_shared_utility/shared_util_options.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "umock_c/umock_c_prod.h" 15 | 16 | MOCKABLE_FUNCTION(,int, x509_openssl_add_certificates, SSL_CTX*, ssl_ctx, const char*, certificates); 17 | #ifndef OPENSSL_NO_ENGINE 18 | MOCKABLE_FUNCTION(,int, x509_openssl_add_credentials, SSL_CTX*, ssl_ctx, const char*, x509certificate, const char*, x509privatekey, OPTION_OPENSSL_KEY_TYPE, x509privatekeytype, ENGINE*, engine); 19 | #else // OPENSSL_NO_ENGINE 20 | MOCKABLE_FUNCTION(,int, x509_openssl_add_credentials, SSL_CTX*, ssl_ctx, const char*, x509certificate, const char*, x509privatekey, OPTION_OPENSSL_KEY_TYPE, x509privatekeytype); 21 | #endif // OPENSSL_NO_ENGINE 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /inc/azure_c_shared_utility/x509_schannel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef X509_SCHANNEL_H 5 | #define X509_SCHANNEL_H 6 | 7 | #include "windows.h" 8 | 9 | #include "umock_c/umock_c_prod.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct X509_SCHANNEL_HANDLE_DATA_TAG* X509_SCHANNEL_HANDLE; 16 | 17 | MOCKABLE_FUNCTION(, X509_SCHANNEL_HANDLE, x509_schannel_create, const char*, x509certificate, const char*, x509privatekey); 18 | MOCKABLE_FUNCTION(, void, x509_schannel_destroy, X509_SCHANNEL_HANDLE, x509_schannel_handle); 19 | MOCKABLE_FUNCTION(, PCCERT_CONTEXT, x509_schannel_get_certificate_context, X509_SCHANNEL_HANDLE, x509_schannel_handle); 20 | MOCKABLE_FUNCTION(, int, x509_verify_certificate_in_chain, const char*, trustedCertificate, PCCERT_CONTEXT, pCertContextToVerify); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /jenkins/debian_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake -Drun_valgrind:BOOL=ON $build_root -Drun_unittests:BOOL=ON 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /jenkins/linux_bearssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | # Print version 8 | cat /etc/*release | grep VERSION* 9 | gcc --version 10 | curl --version 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | cmake . -Bcmake -Duse_bearssl:BOOL=ON -Drun_unittests:BOOL=ON -Duse_openssl:BOOL=OFF -D CMAKE_C_COMPILER=gcc 15 | cd cmake 16 | 17 | make --jobs=$CORES 18 | 19 | ctest -j $CORES --output-on-failure 20 | -------------------------------------------------------------------------------- /jenkins/linux_bearssl_clang_buildonly.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | # Print version 8 | cat /etc/*release | grep VERSION* 9 | gcc --version 10 | curl --version 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | cmake . -Bcmake -Duse_bearssl:BOOL=ON -Drun_unittests:BOOL=ON -Duse_openssl:BOOL=OFF -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ 15 | cd cmake 16 | 17 | make --jobs=$CORES 18 | 19 | -------------------------------------------------------------------------------- /jenkins/linux_cares.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -x # Set trace on 6 | set -o errexit # Exit if command failed 7 | set -o nounset # Exit if variable not set 8 | set -o pipefail # Exit if pipe failed 9 | 10 | # Print version 11 | cat /etc/*release | grep VERSION* 12 | gcc --version 13 | curl --version 14 | 15 | # Set the default cores 16 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 17 | cmake . -Bcmake -Duse_c_ares:BOOL=ON -Drun_e2e_tests:BOOL=ON 18 | cd cmake 19 | 20 | make --jobs=$CORES 21 | -------------------------------------------------------------------------------- /jenkins/linux_install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | # Print version 8 | cat /etc/*release | grep VERSION* 9 | gcc --version 10 | 11 | # Set the default cores 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | build_root=$(cd "$(dirname "$0")/.." && pwd) 15 | clone_root=$(cd "$(dirname "$0")/../.." && pwd) 16 | cd $build_root 17 | 18 | echo "Build Root $build_root" 19 | 20 | sdk_build_folder=$build_root"/cmake" 21 | 22 | # Build the SDK 23 | rm -rf $sdk_build_folder 24 | mkdir -p $sdk_build_folder 25 | pushd $sdk_build_folder 26 | cmake $build_root 27 | make install --jobs=$CORES 28 | popd 29 | 30 | # Now use the deps 31 | rm -rf $sdk_build_folder 32 | mkdir -p $sdk_build_folder 33 | pushd $sdk_build_folder 34 | cmake $build_root -Duse_installed_dependencies=ON 35 | make --jobs=$CORES 36 | popd 37 | -------------------------------------------------------------------------------- /jenkins/linux_mbed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake -Drun_valgrind:BOOL=ON -Duse_mbedtls=ON -Duse_openssl=OFF $build_root -Drun_unittests:BOOL=ON -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ 19 | make --jobs=$CORES 20 | 21 | ctest -j $CORES --output-on-failure 22 | 23 | popd 24 | -------------------------------------------------------------------------------- /jenkins/linux_mbed_clang_buildonly.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake -Drun_valgrind:BOOL=ON -Duse_mbedtls=ON -Duse_openssl=OFF $build_root -Drun_unittests:BOOL=ON -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /jenkins/linux_wolfssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake $build_root -Drun_unittests:BOOL=ON -Duse_wolfssl:BOOL=ON -Duse_openssl:BOOL=OFF -D CMAKE_C_COMPILER=gcc 19 | make --jobs=$CORES 20 | 21 | #use doctored openssl 22 | export LD_LIBRARY_PATH=/usr/local/ssl/lib 23 | ctest -j $CORES --output-on-failure 24 | export LD_LIBRARY_PATH= 25 | 26 | popd 27 | -------------------------------------------------------------------------------- /jenkins/linux_wolfssl_clang_buildonly.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake $build_root -Drun_unittests:BOOL=ON -Duse_wolfssl:BOOL=ON -Duse_openssl:BOOL=OFF -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /jenkins/osx_gcc_openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -DOPENSSL_ROOT_DIR:PATH=/usr/local/opt/openssl -Duse_openssl:bool=ON -Drun_unittests:bool=ON 18 | cmake --build . -- --jobs=$CORES 19 | -------------------------------------------------------------------------------- /jenkins/osx_xcode_native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 13 | 14 | rm -r -f $build_folder 15 | mkdir -p $build_folder 16 | pushd $build_folder 17 | cmake .. -Drun_unittests:bool=ON -G Xcode 18 | cmake --build . -- --jobs=$CORES 19 | ctest -C "debug" -V 20 | popd 21 | -------------------------------------------------------------------------------- /jenkins/raspberrypi_c_buster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # assume directory is root of downloaded repo 3 | mkdir cmake 4 | cd cmake 5 | ls -al 6 | 7 | # Create a cmake toolchain file on the fly 8 | echo "SET(CMAKE_SYSTEM_NAME Linux) # this one is important" > toolchain.cmake 9 | echo "SET(CMAKE_SYSTEM_VERSION 1) # this one not so much" >> toolchain.cmake 10 | 11 | echo "SET(CMAKE_C_COMPILER ${TOOLCHAIN_EXES}/${TOOLCHAIN_NAME}-gcc)" >> toolchain.cmake 12 | echo "SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_EXES}/${TOOLCHAIN_NAME}-g++)" >> toolchain.cmake 13 | echo "SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_SYSROOT})" >> toolchain.cmake 14 | echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake 15 | echo "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> toolchain.cmake 16 | echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake 17 | ls -al 18 | 19 | # Build the SDK. This will use the OpenSSL, cURL and uuid binaries that we built before 20 | cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -Duse_prov_client=OFF -DCMAKE_INSTALL_PREFIX=${TOOLCHAIN_PREFIX} -Drun_e2e_tests=ON -Drun_unittests=ON .. 21 | make -j 2 22 | ls -al 23 | -------------------------------------------------------------------------------- /jenkins/ubuntu_c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | 5 | set -e 6 | 7 | build_root=$(cd "$(dirname "$0")/.." && pwd) 8 | cd $build_root 9 | 10 | build_folder=$build_root"/cmake" 11 | 12 | # Set the default cores 13 | CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) 14 | 15 | rm -r -f $build_folder 16 | mkdir -p $build_folder 17 | pushd $build_folder 18 | cmake $build_root -Drun_unittests:BOOL=ON -Drun_valgrind:BOOL=ON 19 | make --jobs=$CORES 20 | 21 | popd 22 | -------------------------------------------------------------------------------- /jenkins/ubuntu_clang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Microsoft. All rights reserved. 3 | # Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | # 5 | 6 | set -e 7 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) 9 | build_root=$(cd "${script_dir}/.." && pwd) 10 | build_folder=$build_root"/cmake" 11 | 12 | rm -r -f $build_folder 13 | mkdir -p $build_folder 14 | pushd $build_folder 15 | cmake .. -Drun_valgrind:BOOL=ON -Drun_unittests:bool=ON 16 | cmake --build . -- --jobs=$(nproc) 17 | 18 | popd 19 | : -------------------------------------------------------------------------------- /jenkins/windows_c.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | setlocal 5 | 6 | set build-root=%~dp0.. 7 | rem // resolve to fully qualified path 8 | for %%i in ("%build-root%") do set build-root=%%~fi 9 | 10 | REM -- C -- 11 | cd %build-root%\build_all\windows 12 | 13 | call build.cmd %* 14 | if errorlevel 1 goto :eof 15 | cd %build-root% -------------------------------------------------------------------------------- /jenkins/windows_c_VsDevCmd.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | echo ***setting VC paths*** 5 | IF EXIST "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsMSBuildCmd.bat" ( 6 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsMSBuildCmd.bat" 7 | set VSVERSION="Visual Studio 15 2017" 8 | ) ELSE IF EXIST "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" ( 9 | IF "%1" == "x64" ( 10 | call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 11 | ) ELSE ( 12 | call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" 13 | ) 14 | set VSVERSION="Visual Studio 17 2022" 15 | ) ELSE ( 16 | echo "ERROR: Did not find Microsoft Visual Studio" 17 | EXIT 1 18 | ) 19 | 20 | where /q msbuild 21 | IF ERRORLEVEL 1 ( 22 | echo "ERROR: Did not find msbuild" 23 | exit %ERRORLEVEL% 24 | ) 25 | 26 | where msbuild 27 | msbuild -version 28 | -------------------------------------------------------------------------------- /jenkins/windows_c_build_as_dynamic.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | @setlocal 5 | @echo off 6 | 7 | set cmake_dir=dynamic_build 8 | set build-root=%~dp0.. 9 | @REM // resolve to fully qualified path 10 | for %%i in ("%build-root%") do set build-root=%%~fi 11 | 12 | if EXIST %build-root%\cmake\%cmake_dir% ( 13 | rmdir /s/q %build-root%\cmake\%cmake_dir% 14 | ) 15 | mkdir %build-root%\cmake\%cmake_dir% 16 | if errorlevel 1 goto :eof 17 | 18 | cd %build-root%\cmake\%cmake_dir% 19 | 20 | cmake -Dskip_samples=ON -Dbuild_as_dynamic=ON ..\.. 21 | if errorlevel 1 goto :eof 22 | 23 | cmake --build . -- /m 24 | if errorlevel 1 goto :eof 25 | -------------------------------------------------------------------------------- /nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pal/agenttime.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/gballoc.h" 5 | 6 | #include 7 | #include "azure_c_shared_utility/agenttime.h" 8 | 9 | time_t get_time(time_t* p) 10 | { 11 | return time(p); 12 | } 13 | 14 | struct tm* get_gmtime(time_t* currentTime) 15 | { 16 | return gmtime(currentTime); 17 | } 18 | 19 | time_t get_mktime(struct tm* cal_time) 20 | { 21 | return mktime(cal_time); 22 | } 23 | 24 | char* get_ctime(time_t* timeToGet) 25 | { 26 | return ctime(timeToGet); 27 | } 28 | 29 | double get_difftime(time_t stopTime, time_t startTime) 30 | { 31 | return difftime(stopTime, startTime); 32 | } 33 | -------------------------------------------------------------------------------- /pal/generic/refcount_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | // This file gets included into refcount.h as a means of extending the behavior of 5 | // atomic increment, decrement, and test. 6 | // 7 | // The Azure IoT C SDK does not require thread-safe refcount operations, so 8 | // this file is appropriate for any device when using the Azure IoT C SDK. 9 | 10 | #ifndef REFCOUNT_OS_H__GENERIC 11 | #define REFCOUNT_OS_H__GENERIC 12 | 13 | #define COUNT_TYPE uint32_t 14 | 15 | #define DEC_RETURN_ZERO (0) 16 | 17 | #define INC_REF_VAR(count) ++(count) 18 | #define DEC_REF_VAR(count) --(count) 19 | #define INIT_REF_VAR(count) do { count = 1; } while((void)0,0) 20 | 21 | #endif // REFCOUNT_OS_H__GENERIC 22 | -------------------------------------------------------------------------------- /pal/ios-osx/socket_async_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For Linux systems 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | -------------------------------------------------------------------------------- /pal/ios-osx/tlsio_appleios.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TLSIO_APPLEIOS_H 5 | #define TLSIO_APPLEIOS_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #include 10 | #else 11 | #include 12 | #endif /* __cplusplus */ 13 | 14 | #include "azure_c_shared_utility/xio.h" 15 | #include "azure_c_shared_utility/tlsio.h" 16 | #include "umock_c/umock_c_prod.h" 17 | 18 | /** @brief Return the tlsio table of functions. 19 | * 20 | * @param void. 21 | * 22 | * @return The tlsio interface (IO_INTERFACE_DESCRIPTION). 23 | */ 24 | MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, tlsio_appleios_get_interface_description); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif /* __cplusplus */ 29 | 30 | #endif /* TLSIO_APPLEIOS_H */ 31 | -------------------------------------------------------------------------------- /pal/linux/socket_async_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For Linux systems 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | -------------------------------------------------------------------------------- /pal/lwip/sntp_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For ESP32 lwIP systems which use the ESP-IDF's non-standard lwIP include structure 8 | // Tested with: 9 | // ESP32 10 | 11 | #ifndef LWIP_SNTP_OS_H 12 | #define LWIP_SNTP_OS_H 13 | 14 | #include "lwip/apps/sntp.h" 15 | 16 | #endif // LWIP_SNTP_OS_H 17 | -------------------------------------------------------------------------------- /pal/mbed_os5/refcount_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | // This file gets included into refcount.h as a means of extending the behavior of 5 | // atomic increment, decrement, and test. 6 | // 7 | // The Azure IoT C SDK does not require thread-safe refcount operations, so 8 | // this file is appropriate for any device when using the Azure IoT C SDK. 9 | 10 | #ifndef REFCOUNT_OS_H__GENERIC 11 | #define REFCOUNT_OS_H__GENERIC 12 | 13 | #define COUNT_TYPE uint32_t 14 | 15 | #define DEC_RETURN_ZERO (0) 16 | 17 | #define INC_REF_VAR(count) ++(count) 18 | #define DEC_REF_VAR(count) --(count) 19 | #define INIT_REF_VAR(count) do { count = 1; } while((void)0,0) 20 | 21 | #endif // REFCOUNT_OS_H__GENERIC 22 | -------------------------------------------------------------------------------- /pal/windows/refcount_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | // This file gets included into refcount.h as a means of extending the behavior of 5 | // atomic increment, decrement, and test. 6 | 7 | // The first phase defines COUNT_TYPE 8 | #ifndef REFCOUNT_OS_H__WINDOWS 9 | #define REFCOUNT_OS_H__WINDOWS 10 | 11 | #include "windows.h" 12 | // The Windows atomic operations work on LONG 13 | #define COUNT_TYPE LONG 14 | 15 | /*if macro DEC_REF returns DEC_RETURN_ZERO that means the ref count has reached zero.*/ 16 | #define DEC_RETURN_ZERO (0) 17 | #define INC_REF_VAR(count) InterlockedIncrement(&(count)) 18 | #define DEC_REF_VAR(count) InterlockedDecrement(&(count)) 19 | #define INIT_REF_VAR(count) InterlockedExchange(&(count), 1) 20 | 21 | #endif // REFCOUNT_OS_H__WINDOWS 22 | -------------------------------------------------------------------------------- /pal/windows/socket_async_os.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | //This file pulls in OS-specific header files to allow compilation of socket_async.c under 5 | // most OS's except for Windows. 6 | 7 | // For Windows systems 8 | #include 9 | #include 10 | #include 11 | #include 12 | #ifdef AF_UNIX_ON_WINDOWS 13 | #include 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | function(add_sample_directory whatIsBuilding) 7 | add_subdirectory(${whatIsBuilding}) 8 | 9 | set_target_properties(${whatIsBuilding} 10 | PROPERTIES 11 | FOLDER "C-Utility_Samples") 12 | endfunction() 13 | 14 | add_sample_directory(iot_c_utility) 15 | 16 | if (NOT ("${ARCHITECTURE}" STREQUAL "ARM")) 17 | add_sample_directory(socketio_connect) 18 | add_sample_directory(tlsio_connect) 19 | endif() -------------------------------------------------------------------------------- /samples/iot_c_utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | set(iot_c_utility_c_files 5 | iot_c_utility.c 6 | ) 7 | 8 | if (WIN32) 9 | #windows needs this define 10 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 11 | add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) 12 | ENDIF(WIN32) 13 | 14 | if (${use_http}) 15 | add_definitions(-DUSE_HTTP) 16 | endif() 17 | 18 | add_executable(iot_c_utility ${iot_c_utility_c_files}) 19 | 20 | target_link_libraries(iot_c_utility 21 | aziotsharedutil 22 | ) 23 | 24 | compileTargetAsC99(iot_c_utility) 25 | -------------------------------------------------------------------------------- /samples/socketio_connect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | set(socketio_connect_c_files 5 | main.c 6 | ) 7 | 8 | IF(WIN32) 9 | #windows needs this define 10 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 11 | add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) 12 | ENDIF(WIN32) 13 | 14 | add_executable(socketio_connect ${socketio_connect_c_files}) 15 | 16 | target_link_libraries(socketio_connect 17 | aziotsharedutil 18 | ) 19 | 20 | if(${use_openssl} AND WIN32) 21 | file(COPY ${SSL_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 22 | file(COPY ${CRYPTO_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 23 | endif() 24 | 25 | set_target_properties(socketio_connect 26 | PROPERTIES 27 | FOLDER "azure_c_shared_utility_samples") 28 | 29 | compileTargetAsC99(socketio_connect) -------------------------------------------------------------------------------- /samples/tlsio_connect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | generate_cpp_wrapper(tlsio_connect_c_files main) 5 | 6 | IF(WIN32) 7 | #windows needs this define 8 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 9 | add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC) 10 | ENDIF(WIN32) 11 | 12 | add_executable(tlsio_connect ${tlsio_connect_c_files}) 13 | 14 | target_link_libraries(tlsio_connect 15 | aziotsharedutil 16 | ) 17 | 18 | if(${use_openssl} AND WIN32) 19 | file(COPY ${SSL_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 20 | file(COPY ${CRYPTO_DLL} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 21 | endif() 22 | 23 | set_target_properties(tlsio_connect 24 | PROPERTIES 25 | FOLDER "azure_c_shared_utility_samples") 26 | 27 | compileTargetAsC99(tlsio_connect) 28 | -------------------------------------------------------------------------------- /src/README.md: -------------------------------------------------------------------------------- 1 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 2 | 3 | # azure-c-shared-utility/adapters 4 | 5 | This directory contains files for adapting specific devices to work with the Azure C Shared Utility. 6 | 7 | ### This location is deprecated 8 | 9 | The files in this directory will eventually be moved to new locations in the 10 | [azure-c-shared-utility/pal](https://github.com/Azure/azure-c-shared-utility/tree/master/pal) 11 | directory. 12 | 13 | ### Where did that file go? 14 | 15 | Files related to adapting the Azure IoT C SDK to specific devices are being moved to new locations 16 | within the [azure-c-shared-utility/pal](https://github.com/Azure/azure-c-shared-utility/tree/master/pal) 17 | directory and its subfolders. 18 | 19 | ### Porting to new devices 20 | 21 | Instructions for porting the Azure IoT C SDK to new devices are located 22 | [here](https://github.com/Azure/azure-c-shared-utility/blob/master/devdoc/porting_guide.md). 23 | -------------------------------------------------------------------------------- /src/aziotsharedutil_http.def: -------------------------------------------------------------------------------- 1 | HTTPHeaders_AddHeaderNameValuePair 2 | HTTPHeaders_Alloc 3 | HTTPHeaders_Clone 4 | HTTPHeaders_FindHeaderValue 5 | HTTPHeaders_Free 6 | HTTPHeaders_GetHeader 7 | HTTPHeaders_GetHeaderCount 8 | HTTPHeaders_ReplaceHeaderNameValuePair 9 | HTTP_HEADERS_RESULTStringStorage 10 | HTTP_HEADERS_RESULTStrings 11 | HTTP_HEADERS_RESULT_FromString 12 | 13 | HTTPAPIEX_Create 14 | HTTPAPIEX_Destroy 15 | HTTPAPIEX_ExecuteRequest 16 | HTTPAPIEX_RESULTStringStorage 17 | HTTPAPIEX_RESULTStrings 18 | HTTPAPIEX_RESULT_FromString 19 | HTTPAPIEX_SAS_Create 20 | HTTPAPIEX_SAS_Create_From_String 21 | HTTPAPIEX_SAS_Destroy 22 | HTTPAPIEX_SAS_ExecuteRequest 23 | HTTPAPIEX_SetOption 24 | 25 | HTTPAPI_CloneOption 26 | HTTPAPI_CloseConnection 27 | HTTPAPI_CreateConnection 28 | HTTPAPI_Deinit 29 | HTTPAPI_ExecuteRequest 30 | HTTPAPI_Init 31 | HTTPAPI_RESULTStringStorage 32 | HTTPAPI_RESULTStrings 33 | HTTPAPI_RESULT_FromString 34 | HTTPAPI_SetOption 35 | -------------------------------------------------------------------------------- /src/aziotsharedutil_wsio.def: -------------------------------------------------------------------------------- 1 | utf8_checker_is_valid_utf8 2 | uws_client_close_async 3 | uws_client_close_handshake_async 4 | uws_client_create 5 | uws_client_create_with_io 6 | uws_client_destroy 7 | uws_client_dowork 8 | uws_client_open_async 9 | uws_client_retrieve_options 10 | uws_client_send_frame_async 11 | uws_client_set_option 12 | uws_frame_encoder_encode 13 | wsio_close 14 | wsio_create 15 | wsio_destroy 16 | wsio_dowork 17 | wsio_get_interface_description 18 | wsio_open 19 | wsio_retrieveoptions 20 | wsio_send 21 | wsio_setoption 22 | -------------------------------------------------------------------------------- /src/etwxlogging.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "azure_c_shared_utility/xlogging.h" 5 | 6 | #include "windows.h" 7 | #include "azure_c_shared_utility/etwlogger_driver.h" 8 | 9 | #ifndef NO_LOGGING 10 | 11 | #ifndef _MSC_VER 12 | #error only supported on Windows 13 | #endif 14 | 15 | static LOGGER_LOG global_log_function = etwlogger_log; 16 | 17 | void xlogging_set_log_function(LOGGER_LOG log_function) 18 | { 19 | global_log_function = log_function; 20 | } 21 | 22 | LOGGER_LOG xlogging_get_log_function(void) 23 | { 24 | return global_log_function; 25 | } 26 | 27 | LOGGER_LOG_GETLASTERROR global_log_function_GetLastError = etwlogger_log_with_GetLastError; 28 | 29 | void xlogging_set_log_function_GetLastError(LOGGER_LOG_GETLASTERROR log_function_GetLastError) 30 | { 31 | global_log_function_GetLastError = log_function_GetLastError; 32 | } 33 | 34 | LOGGER_LOG_GETLASTERROR xlogging_get_log_function_GetLastError(void) 35 | { 36 | return global_log_function_GetLastError; 37 | } 38 | 39 | void xlogging_LogErrorWinHTTPWithGetLastErrorAsStringFormatter(int errorMessageID) 40 | { 41 | (void)errorMessageID; 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /src/hmacsha256.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "azure_c_shared_utility/hmacsha256.h" 6 | #include "azure_c_shared_utility/hmac.h" 7 | #include "azure_c_shared_utility/buffer_.h" 8 | 9 | HMACSHA256_RESULT HMACSHA256_ComputeHash(const unsigned char* key, size_t keyLen, const unsigned char* payload, size_t payloadLen, BUFFER_HANDLE hash) 10 | { 11 | HMACSHA256_RESULT result; 12 | 13 | if (key == NULL || 14 | keyLen == 0 || 15 | payload == NULL || 16 | payloadLen == 0 || 17 | hash == NULL) 18 | { 19 | result = HMACSHA256_INVALID_ARG; 20 | } 21 | else 22 | { 23 | if ((BUFFER_enlarge(hash, 32) != 0) || 24 | (hmac(SHA256, payload, (int)payloadLen, key, (int)keyLen, BUFFER_u_char(hash) ) != 0)) 25 | { 26 | result = HMACSHA256_ERROR; 27 | } 28 | else 29 | { 30 | result = HMACSHA256_OK; 31 | } 32 | } 33 | 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /tests/agenttime_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName agenttime_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../pal/agenttime.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/agenttime_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(agenttime_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/azure_base32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName azure_base32_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/azure_base32.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/azure_base32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(azure_base32_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/azure_base64_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName azure_base64_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/azure_base64.c 12 | ../../src/strings.c 13 | ../../src/buffer.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 20 | 21 | compile_c_test_artifacts_as(${theseTestsName} C99) 22 | -------------------------------------------------------------------------------- /tests/azure_base64_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(base64_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/buffer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName buffer_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/buffer.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) -------------------------------------------------------------------------------- /tests/buffer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(Buffer_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/condition_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName condition_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ${CONDITION_C_FILE} 12 | ${LOCK_C_FILE} 13 | ${THREAD_C_FILE} 14 | ) 15 | 16 | if(UNIX) # linux & apple 17 | set(${theseTestsName}_c_files ${${theseTestsName}_c_files} 18 | ../../adapters/linux_time.c 19 | ) 20 | endif() 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | 27 | if(WIN32) 28 | else() 29 | target_link_libraries(${theseTestsName}_exe pthread) 30 | endif() 31 | 32 | compile_c_test_artifacts_as(${theseTestsName} C99) 33 | -------------------------------------------------------------------------------- /tests/condition_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(Condition_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/connectionstringparser_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName connectionstringparser_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 11 | 12 | set(${theseTestsName}_c_files 13 | ../real_test_files/real_map.c 14 | ../real_test_files/real_string_tokenizer.c 15 | ../real_test_files/real_strings.c 16 | ${SHARED_UTIL_SRC_FOLDER}/crt_abstractions.c 17 | ${SHARED_UTIL_SRC_FOLDER}/connection_string_parser.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ../real_test_files/real_map.h 22 | ../real_test_files/real_string_tokenizer.h 23 | ../real_test_files/real_strings.h 24 | ) 25 | 26 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 27 | 28 | compile_c_test_artifacts_as(${theseTestsName} C99) 29 | -------------------------------------------------------------------------------- /tests/connectionstringparser_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(connectionstringparser_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/constbuffer_array_batcher_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | 3 | cmake_minimum_required (VERSION 3.5) 4 | 5 | set(theseTestsName constbuffer_array_batcher_ut) 6 | 7 | generate_cppunittest_wrapper(${theseTestsName}) 8 | 9 | set(${theseTestsName}_c_files 10 | ../../src/constbuffer_array_batcher.c 11 | ../real_test_files/real_constbuffer.c 12 | ../real_test_files/real_constbuffer_array.c 13 | ../real_test_files/real_memory_data.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ../../inc/azure_c_shared_utility/constbuffer_array_batcher.h 18 | ../real_test_files/real_constbuffer.h 19 | ../real_test_files/real_constbuffer_renames.h 20 | ../real_test_files/real_constbuffer_array.h 21 | ../real_test_files/real_constbuffer_array_renames.h 22 | ../real_test_files/real_memory_data.h 23 | ../real_test_files/real_memory_data_renames.h 24 | ) 25 | 26 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 27 | 28 | compile_c_test_artifacts_as(${theseTestsName} C99) 29 | -------------------------------------------------------------------------------- /tests/constbuffer_array_batcher_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #include 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(constbuffer_array_batcher_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/constbuffer_array_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | 3 | cmake_minimum_required (VERSION 3.5) 4 | 5 | set(theseTestsName constbuffer_array_ut) 6 | 7 | generate_cppunittest_wrapper(${theseTestsName}) 8 | 9 | set(${theseTestsName}_c_files 10 | ../../src/constbuffer_array.c 11 | ) 12 | 13 | set(${theseTestsName}_h_files 14 | ../../inc/azure_c_shared_utility/constbuffer_array.h 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/constbuffer_array_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #include 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(constbuffer_array_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/constbuffer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName constbuffer_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/constbuffer.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/constbuffer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(constbuffer_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/constmap_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName constmap_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/constmap.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/constmap_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(constmap_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/crtabstractions_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName crt_abstractions_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/crt_abstractions.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/crtabstractions_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(CRTAbstractions_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/dns_resolver_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName dns_resolver_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/dns_resolver_sync.c 12 | ../../src/crt_abstractions.c 13 | ) 14 | 15 | set(${theseTestsName}_h_files 16 | ) 17 | 18 | include_directories(.) 19 | include_directories(../../inc/azure_c_shared_utility) 20 | 21 | if(WIN32) 22 | include_directories(./win32_fake_linux) 23 | else() 24 | include_directories(../../pal/linux) 25 | endif() 26 | 27 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 28 | 29 | compile_c_test_artifacts_as(${theseTestsName} C99) 30 | -------------------------------------------------------------------------------- /tests/dns_resolver_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | /** 11 | * Identify the test suite to run here. 12 | */ 13 | RUN_TEST_SUITE(dns_resolver_ut, failedTestCount); 14 | 15 | return (int)failedTestCount; 16 | } 17 | -------------------------------------------------------------------------------- /tests/dns_resolver_ut/win32_fake_linux/readme.txt: -------------------------------------------------------------------------------- 1 | This file is a convenience for debugging socket_async.c under Windows, and does not need to 2 | normally be part of the SDK build. 3 | -------------------------------------------------------------------------------- /tests/doublylinkedlist_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName doublylinkedlist_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/doublylinkedlist.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/doublylinkedlist_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(doublylinkedlist_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/gballoc_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName gballoc_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | gballoc_undertest.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/gballoc_ut/gballoc_undertest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #define malloc mock_malloc 6 | #define calloc mock_calloc 7 | #define realloc mock_realloc 8 | #define free mock_free 9 | 10 | extern void* mock_malloc(size_t size); 11 | extern void* mock_calloc(size_t nmemb, size_t size); 12 | extern void* mock_realloc(void* ptr, size_t size); 13 | extern void mock_free(void* ptr); 14 | 15 | #undef _CRTDBG_MAP_ALLOC 16 | #include "../src/gballoc.c" 17 | -------------------------------------------------------------------------------- /tests/gballoc_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(GBAlloc_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/gballoc_without_init_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName gballoc_without_init_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | gballoc_undertest.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/gballoc_without_init_ut/gballoc_undertest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #define malloc mock_malloc 6 | #define calloc mock_calloc 7 | #define realloc mock_realloc 8 | #define free mock_free 9 | 10 | extern void* mock_malloc(size_t size); 11 | extern void* mock_calloc(size_t nmemb, size_t size); 12 | extern void* mock_realloc(void* ptr, size_t size); 13 | extern void mock_free(void* ptr); 14 | 15 | #undef _CRTDBG_MAP_ALLOC 16 | #include "../src/gballoc.c" 17 | -------------------------------------------------------------------------------- /tests/gballoc_without_init_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(GBAlloc_For_Init_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/hmacsha256_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName hmacsha256_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/hmacsha256.c 12 | ../../src/hmac.c 13 | ../../src/usha.c 14 | ../../src/sha1.c 15 | ../../src/sha224.c 16 | ../../src/sha384-512.c 17 | ../../src/buffer.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | 25 | compile_c_test_artifacts_as(${theseTestsName} C99) 26 | -------------------------------------------------------------------------------- /tests/hmacsha256_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(HMACSHA256_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/http_proxy_io_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName http_proxy_io_ut) 7 | 8 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 9 | 10 | generate_cppunittest_wrapper(${theseTestsName}) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/http_proxy_io.c 14 | ../real_test_files/real_crt_abstractions.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | 22 | compile_c_test_artifacts_as(${theseTestsName} C99) 23 | -------------------------------------------------------------------------------- /tests/http_proxy_io_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(http_proxy_io_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/httpapicompact_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(NOT ${use_http}) 7 | message(FATAL_ERROR "httpapi_compact_ut being generated without HTTP support") 8 | endif() 9 | 10 | set(theseTestsName httpapi_compact_ut) 11 | 12 | generate_cppunittest_wrapper(${theseTestsName}) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../adapters/httpapi_compact.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | 23 | compile_c_test_artifacts_as(${theseTestsName} C99) 24 | -------------------------------------------------------------------------------- /tests/httpapicompact_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(httpapicompact_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/httpapiex_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(NOT ${use_http}) 7 | message(FATAL_ERROR "httpapiex_ut being generated without HTTP support") 8 | endif() 9 | 10 | set(theseTestsName httpapiex_ut ) 11 | 12 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 13 | 14 | generate_cppunittest_wrapper(${theseTestsName}) 15 | 16 | set(${theseTestsName}_c_files 17 | ../../src/httpapiex.c 18 | ../real_test_files/real_vector.c 19 | ../real_test_files/real_crt_abstractions.c 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | 27 | compile_c_test_artifacts_as(${theseTestsName} C99) 28 | -------------------------------------------------------------------------------- /tests/httpapiex_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(httpapiex_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/httpapiexsas_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(NOT ${use_http}) 7 | message(FATAL_ERROR "httpapiexsas_ut being generated without HTTP support") 8 | endif() 9 | 10 | set(theseTestsName httpapiexsas_ut) 11 | 12 | generate_cppunittest_wrapper(${theseTestsName}) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/httpapiexsas.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | 23 | compile_c_test_artifacts_as(${theseTestsName} C99) 24 | -------------------------------------------------------------------------------- /tests/httpapiexsas_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(httpapiexsas_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/httpheaders_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(NOT ${use_http}) 7 | message(FATAL_ERROR "httpheaders_ut being generated without HTTP support") 8 | endif() 9 | 10 | set(theseTestsName httpheaders_ut) 11 | 12 | generate_cppunittest_wrapper(${theseTestsName}) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/httpheaders.c 16 | ) 17 | 18 | set(${theseTestsName}_h_files 19 | ) 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | 23 | compile_c_test_artifacts_as(${theseTestsName} C99) 24 | -------------------------------------------------------------------------------- /tests/httpheaders_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(HTTPHeaders_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/lock_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName lock_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ${LOCK_C_FILE} 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/lock_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(LOCK_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/logging_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #the purpose of these tests is to see that a LogError/LogInfo/LogLastError would compile under all switch combinations 5 | #the tests will not recompile the complete c_shared_utility library, only the relevant parts. These tests only target Windows 6 | 7 | if(${run_unittests}) 8 | 9 | foreach(no_logging_value ON OFF) 10 | foreach(logerror_captures_stack_traces_value ON OFF) 11 | foreach(use_etw_value OFF TRACELOGGING TRACELOGGING_WITH_CONSOLE) 12 | 13 | add_subdirectory(minimal "min${no_logging_value}${logerror_captures_stack_traces_value}${use_etw_value}") 14 | 15 | endforeach(use_etw_value) 16 | endforeach(logerror_captures_stack_traces_value) 17 | endforeach(no_logging_value) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /tests/logging_ut/minimal/minimal.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "windows.h" 5 | 6 | #include "azure_c_shared_utility/xlogging.h" 7 | 8 | int main(void) 9 | { 10 | 11 | LogError("Hello World from LogError, here's a value: %d", 42); 12 | 13 | LogInfo("Hello World from LogInfo, here's a value: %d", 0x42); 14 | 15 | SetLastError(ERROR_ACCESS_DENIED); 16 | 17 | LogLastError("Hello World from LogLastError, some access was denied! here's a value: 0x%x", '3'); 18 | 19 | SetLastError(ERROR_SUCCESS); 20 | 21 | LogLastError("Hello World from LogLastError, everything is fine now! here's a value: 0x%x", '3'); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /tests/map_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName map_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/map.c 12 | ../../src/crt_abstractions.c 13 | ) 14 | 15 | set(${theseTestsName}_h_files 16 | ) 17 | 18 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 19 | 20 | compile_c_test_artifacts_as(${theseTestsName} C99) 21 | -------------------------------------------------------------------------------- /tests/map_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(map_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/memory_data_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | set(theseTestsName memory_data_ut) 5 | 6 | generate_cppunittest_wrapper(${theseTestsName}) 7 | 8 | set(${theseTestsName}_c_files 9 | ../../src/memory_data.c 10 | ) 11 | 12 | set(${theseTestsName}_h_files 13 | ) 14 | 15 | file(COPY ../valgrind_suppressions.supp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 16 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests" 17 | ADDITIONAL_LIBS 18 | aziotsharedutil 19 | VALGRIND_SUPPRESSIONS_FILE 20 | valgrind_suppressions.supp 21 | ) 22 | 23 | compile_c_test_artifacts_as(${theseTestsName} C99) 24 | -------------------------------------------------------------------------------- /tests/memory_data_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(memory_data_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/optionhandler_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName optionhandler_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/optionhandler.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/optionhandler_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(optionhandler_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/platform_win32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(MSVC) 7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4217") 8 | set(CMAKE_SHARED_LINKER_FLAGS "$(CMAKE_SHARED_LINKER_FLAGS) /IGNORE:4217") 9 | endif() 10 | 11 | set(theseTestsName platform_win32_ut) 12 | 13 | generate_cppunittest_wrapper(${theseTestsName}) 14 | 15 | set(${theseTestsName}_c_files 16 | ${PLATFORM_C_FILE} 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | 24 | compile_c_test_artifacts_as(${theseTestsName} C99) 25 | -------------------------------------------------------------------------------- /tests/platform_win32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(platform_win32_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/real_test_files/real_base64.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define Azure_Base64_Encode real_Azure_Base64_Encode 5 | #define Azure_Base64_Encode_Bytes real_Base64_Encode_Bytes 6 | #define Azure_Base64_Decode real_Azure_Base64_Decode 7 | 8 | #define GBALLOC_H 9 | 10 | #include "azure_base64.c" 11 | -------------------------------------------------------------------------------- /tests/real_test_files/real_buffer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define BUFFER_new real_BUFFER_new 5 | #define BUFFER_create real_BUFFER_create 6 | #define BUFFER_create_with_size real_BUFFER_create_with_size 7 | #define BUFFER_pre_build real_BUFFER_pre_build 8 | #define BUFFER_build real_BUFFER_build 9 | #define BUFFER_unbuild real_BUFFER_unbuild 10 | #define BUFFER_append real_BUFFER_append 11 | #define BUFFER_prepend real_BUFFER_prepend 12 | #define BUFFER_u_char real_BUFFER_u_char 13 | #define BUFFER_length real_BUFFER_length 14 | #define BUFFER_clone real_BUFFER_clone 15 | #define BUFFER_delete real_BUFFER_delete 16 | #define BUFFER_enlarge real_BUFFER_enlarge 17 | #define BUFFER_size real_BUFFER_size 18 | #define BUFFER_content real_BUFFER_content 19 | #define BUFFER_append_build real_BUFFER_append_build 20 | #define BUFFER_shrink real_BUFFER_shrink 21 | #define BUFFER_fill real_BUFFER_fill 22 | 23 | #define GBALLOC_H 24 | 25 | #include "buffer.c" 26 | -------------------------------------------------------------------------------- /tests/real_test_files/real_constbuffer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "real_constbuffer_renames.h" 5 | 6 | #define GBALLOC_H 7 | 8 | #include "constbuffer.c" 9 | -------------------------------------------------------------------------------- /tests/real_test_files/real_constbuffer_array.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #define GBALLOC_H 4 | 5 | #include "real_constbuffer_array_renames.h" 6 | #include "real_constbuffer_renames.h" 7 | 8 | #include "constbuffer_array.c" 9 | -------------------------------------------------------------------------------- /tests/real_test_files/real_constbuffer_array_renames.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #define constbuffer_array_create real_constbuffer_array_create 4 | #define constbuffer_array_create_with_move_buffers real_constbuffer_array_create_with_move_buffers 5 | #define constbuffer_array_create_empty real_constbuffer_array_create_empty 6 | #define constbuffer_array_create_from_array_array real_constbuffer_array_create_from_array_array 7 | #define constbuffer_array_inc_ref real_constbuffer_array_inc_ref 8 | #define constbuffer_array_dec_ref real_constbuffer_array_dec_ref 9 | #define constbuffer_array_add_front real_constbuffer_array_add_front 10 | #define constbuffer_array_remove_front real_constbuffer_array_remove_front 11 | #define constbuffer_array_get_buffer_count real_constbuffer_array_get_buffer_count 12 | #define constbuffer_array_get_buffer real_constbuffer_array_get_buffer 13 | #define constbuffer_array_get_buffer_content real_constbuffer_array_get_buffer_content 14 | #define constbuffer_array_get_all_buffers_size real_constbuffer_array_get_all_buffers_size 15 | #define constbuffer_array_get_const_buffer_handle_array real_constbuffer_array_get_const_buffer_handle_array 16 | #define CONSTBUFFER_ARRAY_HANDLE_contain_same real_CONSTBUFFER_ARRAY_HANDLE_contain_same -------------------------------------------------------------------------------- /tests/real_test_files/real_constbuffer_renames.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #ifndef REAL_CONSTBUFFER_RENAMES_H 4 | #define REAL_CONSTBUFFER_RENAMES_H 5 | 6 | #define CONSTBUFFER_Create real_CONSTBUFFER_Create 7 | #define CONSTBUFFER_CreateFromBuffer real_CONSTBUFFER_CreateFromBuffer 8 | #define CONSTBUFFER_CreateWithMoveMemory real_CONSTBUFFER_CreateWithMoveMemory 9 | #define CONSTBUFFER_CreateWithCustomFree real_CONSTBUFFER_CreateWithCustomFree 10 | #define CONSTBUFFER_IncRef real_CONSTBUFFER_IncRef 11 | #define CONSTBUFFER_GetContent real_CONSTBUFFER_GetContent 12 | #define CONSTBUFFER_DecRef real_CONSTBUFFER_DecRef 13 | #define CONSTBUFFER_HANDLE_contain_same real_CONSTBUFFER_HANDLE_contain_same 14 | #define CONSTBUFFER_CreateFromOffsetAndSize real_CONSTBUFFER_CreateFromOffsetAndSize 15 | 16 | #endif // REAL_CONSTBUFFER_RENAMES_H 17 | -------------------------------------------------------------------------------- /tests/real_test_files/real_crt_abstractions.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define mallocAndStrcpy_s real_mallocAndStrcpy_s 5 | #define unsignedIntToString real_unsignedIntToString 6 | #define size_tToString real_size_tToString 7 | #define uint64_tToString real_uint64_tToString 8 | 9 | #define GBALLOC_H 10 | 11 | #include "crt_abstractions.c" 12 | -------------------------------------------------------------------------------- /tests/real_test_files/real_doublylinkedlist.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define DList_InitializeListHead real_DList_InitializeListHead 5 | #define DList_IsListEmpty real_DList_IsListEmpty 6 | #define DList_InsertTailList real_DList_InsertTailList 7 | #define DList_InsertHeadList real_DList_InsertHeadList 8 | #define DList_AppendTailList real_DList_AppendTailList 9 | #define DList_RemoveEntryList real_DList_RemoveEntryList 10 | #define DList_RemoveHeadList real_DList_RemoveHeadList 11 | 12 | #define GBALLOC_H 13 | 14 | #include "doublylinkedlist.c" 15 | -------------------------------------------------------------------------------- /tests/real_test_files/real_map.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define GBALLOC_H 5 | 6 | #define Map_Create real_Map_Create 7 | #define Map_Destroy real_Map_Destroy 8 | #define Map_Clone real_Map_Clone 9 | #define Map_Add real_Map_Add 10 | #define Map_AddOrUpdate real_Map_AddOrUpdate 11 | #define Map_Delete real_Map_Delete 12 | #define Map_ContainsKey real_Map_ContainsKey 13 | #define Map_ContainsValue real_Map_ContainsValue 14 | #define Map_GetValueFromKey real_Map_GetValueFromKey 15 | #define Map_GetInternals real_Map_GetInternals 16 | #define Map_ToJSON real_Map_ToJSON 17 | 18 | #include "map.c" 19 | -------------------------------------------------------------------------------- /tests/real_test_files/real_memory_data.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #define GBALLOC_H 4 | 5 | #include "real_memory_data_renames.h" 6 | 7 | #include "../../src/memory_data.c" 8 | -------------------------------------------------------------------------------- /tests/real_test_files/real_memory_data_renames.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #define read_uint8_t real_read_uint8_t 4 | #define read_uint16_t real_read_uint16_t 5 | #define read_uint32_t real_read_uint32_t 6 | #define read_uint64_t real_read_uint64_t 7 | 8 | #define read_int8_t real_read_int8_t 9 | #define read_int16_t real_read_int16_t 10 | #define read_int32_t real_read_int32_t 11 | #define read_int64_t real_read_int64_t 12 | 13 | #define read_uuid_t real_read_uuid_t 14 | 15 | #define write_uint8_t real_write_uint8_t 16 | #define write_uint16_t real_write_uint16_t 17 | #define write_uint32_t real_write_uint32_t 18 | #define write_uint64_t real_write_uint64_t 19 | 20 | #define write_int8_t real_write_int8_t 21 | #define write_int16_t real_write_int16_t 22 | #define write_int32_t real_write_int32_t 23 | #define write_int64_t real_write_int64_t 24 | 25 | #define write_uuid_t real_write_uuid_t 26 | -------------------------------------------------------------------------------- /tests/real_test_files/real_singlylinkedlist.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define singlylinkedlist_create real_singlylinkedlist_create 5 | #define singlylinkedlist_destroy real_singlylinkedlist_destroy 6 | #define singlylinkedlist_add real_singlylinkedlist_add 7 | #define singlylinkedlist_add_head real_singlylinkedlist_add_head 8 | #define singlylinkedlist_remove real_singlylinkedlist_remove 9 | #define singlylinkedlist_get_head_item real_singlylinkedlist_get_head_item 10 | #define singlylinkedlist_get_next_item real_singlylinkedlist_get_next_item 11 | #define singlylinkedlist_find real_singlylinkedlist_find 12 | #define singlylinkedlist_item_get_value real_singlylinkedlist_item_get_value 13 | #define singlylinkedlist_remove_if real_singlylinkedlist_remove_if 14 | #define singlylinkedlist_foreach real_singlylinkedlist_foreach 15 | 16 | #define GBALLOC_H 17 | 18 | #include "singlylinkedlist.c" 19 | -------------------------------------------------------------------------------- /tests/real_test_files/real_string_token.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define StringToken_GetFirst real_StringToken_GetFirst 5 | #define StringToken_GetNext real_StringToken_GetNext 6 | #define StringToken_GetValue real_StringToken_GetValue 7 | #define StringToken_GetLength real_StringToken_GetLength 8 | #define StringToken_GetDelimiter real_StringToken_GetDelimiter 9 | #define StringToken_Split real_StringToken_Split 10 | #define StringToken_Destroy real_StringToken_Destroy 11 | 12 | #define GBALLOC_H 13 | 14 | #include "string_token.c" 15 | -------------------------------------------------------------------------------- /tests/real_test_files/real_string_tokenizer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_REAL_STRING_TOKENIZER_H_C 5 | 6 | #define GBALLOC_H 7 | 8 | #include "real_string_tokenizer.h" 9 | #include "string_tokenizer.c" 10 | -------------------------------------------------------------------------------- /tests/real_test_files/real_strings.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define COMPILING_REAL_STRINGS_C 5 | 6 | #define GBALLOC_H 7 | #include "real_strings.h" 8 | #include "strings.c" 9 | -------------------------------------------------------------------------------- /tests/real_test_files/real_vector.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #define VECTOR_create real_VECTOR_create 5 | #define VECTOR_move real_VECTOR_move 6 | #define VECTOR_destroy real_VECTOR_destroy 7 | #define VECTOR_push_back real_VECTOR_push_back 8 | #define VECTOR_erase real_VECTOR_erase 9 | #define VECTOR_clear real_VECTOR_clear 10 | #define VECTOR_element real_VECTOR_element 11 | #define VECTOR_front real_VECTOR_front 12 | #define VECTOR_back real_VECTOR_back 13 | #define VECTOR_find_if real_VECTOR_find_if 14 | #define VECTOR_size real_VECTOR_size 15 | 16 | #define GBALLOC_H 17 | 18 | #include "vector.c" 19 | -------------------------------------------------------------------------------- /tests/refcount_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName refcount_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | some_refcount_impl.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | some_refcount_impl.h 16 | ) 17 | 18 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 19 | 20 | compile_c_test_artifacts_as(${theseTestsName} C99) 21 | -------------------------------------------------------------------------------- /tests/refcount_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(refcount_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/refcount_ut/some_refcount_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SOME_REFCOUNT_IMPL_H 5 | #define SOME_REFCOUNT_IMPL_H 6 | 7 | #ifdef __cplusplus 8 | #include 9 | extern "C" 10 | { 11 | #else 12 | #include 13 | #endif 14 | 15 | typedef struct pos_TAG* POS_HANDLE; 16 | 17 | POS_HANDLE Pos_Create(int x); 18 | POS_HANDLE Pos_Create_With_Extra_Size(int x, size_t extraSize); 19 | POS_HANDLE Pos_Clone(POS_HANDLE posHandle); 20 | void Pos_Destroy(POS_HANDLE posHandle); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /*SOME_REFCOUNT_IMPL_H*/ 27 | -------------------------------------------------------------------------------- /tests/sastoken_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName sastoken_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/sastoken.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/sastoken_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(sastoken_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/sha_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName sha_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/sha224.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/sha_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(sha_ut, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/singlylinkedlist_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName singlylinkedlist_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/singlylinkedlist.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/singlylinkedlist_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(singlylinkedlist_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/socket_async_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName socket_async_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../pal/socket_async.c 12 | ) 13 | 14 | include_directories(.) 15 | include_directories(../../pal/inc) 16 | 17 | # Windows will eventually be built with a socket_async_win32.c because 18 | # the function signatures don't match Linux. That file will need 19 | # different unit tests because of the differing socket semantics 20 | 21 | 22 | if(WIN32) 23 | include_directories(./win32_fake_linux) 24 | else() 25 | include_directories(../../pal/linux) 26 | endif() 27 | 28 | set(${theseTestsName}_h_files 29 | test_defines.h 30 | keep_alive.h 31 | ) 32 | 33 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 34 | 35 | compile_c_test_artifacts_as(${theseTestsName} C99) -------------------------------------------------------------------------------- /tests/socket_async_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(socket_async_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/socket_async_ut/win32_fake_linux/readme.txt: -------------------------------------------------------------------------------- 1 | This file is a convenience for debugging socket_async.c under Windows, and does not need to 2 | normally be part of the SDK build. 3 | -------------------------------------------------------------------------------- /tests/socketio_berkeley_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(MSVC) 7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4217") 8 | set(CMAKE_SHARED_LINKER_FLAGS "$(CMAKE_SHARED_LINKER_FLAGS) /IGNORE:4217") 9 | endif() 10 | 11 | set(theseTestsName socketio_berkeley_ut) 12 | 13 | generate_cppunittest_wrapper(${theseTestsName}) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../adapters/socketio_berkeley.c 17 | ../../src/dns_resolver_sync.c 18 | ../../src/crt_abstractions.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "azure_c_shared_utility_tests") 25 | 26 | compile_c_test_artifacts_as(${theseTestsName} C99) 27 | -------------------------------------------------------------------------------- /tests/socketio_berkeley_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(socketio_berkeley_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/socketio_win32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | if(MSVC) 7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4217") 8 | set(CMAKE_SHARED_LINKER_FLAGS "$(CMAKE_SHARED_LINKER_FLAGS) /IGNORE:4217") 9 | endif() 10 | 11 | set(theseTestsName socketio_win32_ut) 12 | 13 | generate_cppunittest_wrapper(${theseTestsName}) 14 | 15 | set(${theseTestsName}_c_files 16 | ../../adapters/socketio_win32.c 17 | ../../src/dns_resolver_sync.c 18 | ../../src/crt_abstractions.c 19 | ) 20 | 21 | set(${theseTestsName}_h_files 22 | ) 23 | 24 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 25 | 26 | compile_c_test_artifacts_as(${theseTestsName} C99) 27 | -------------------------------------------------------------------------------- /tests/socketio_win32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(socketio_win32_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/srw_lock_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | 3 | cmake_minimum_required (VERSION 3.5) 4 | 5 | set(theseTestsName srw_lock_ut) 6 | 7 | generate_cppunittest_wrapper(${theseTestsName}) 8 | 9 | set(${theseTestsName}_c_files 10 | srw_lock_mocked.c 11 | ../../adapters/string_utils.c 12 | ) 13 | 14 | set(${theseTestsName}_cpp_files 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | 22 | -------------------------------------------------------------------------------- /tests/srw_lock_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(srw_lock_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } -------------------------------------------------------------------------------- /tests/srw_lock_ut/srw_lock_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #include "windows.h" 4 | 5 | #define InitializeSRWLock mocked_InitializeSRWLock 6 | #define AcquireSRWLockExclusive mocked_AcquireSRWLockExclusive 7 | #define ReleaseSRWLockExclusive mocked_ReleaseSRWLockExclusive 8 | #define AcquireSRWLockShared mocked_AcquireSRWLockShared 9 | #define ReleaseSRWLockShared mocked_ReleaseSRWLockShared 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void mocked_InitializeSRWLock(PSRWLOCK SRWLock); 16 | void mocked_AcquireSRWLockExclusive(PSRWLOCK SRWLock); 17 | void mocked_ReleaseSRWLockExclusive(PSRWLOCK SRWLock); 18 | void mocked_AcquireSRWLockShared(PSRWLOCK SRWLock); 19 | void mocked_ReleaseSRWLockShared(PSRWLOCK SRWLock); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | 26 | #include "..\..\..\adapters\srw_lock.c" 27 | 28 | -------------------------------------------------------------------------------- /tests/string_token_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName string_token_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/string_token.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/string_token_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(string_token_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/string_tokenizer_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName string_tokenizer_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/string_tokenizer.c 12 | 13 | ../../src/strings.c 14 | ../../src/crt_abstractions.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | 22 | compile_c_test_artifacts_as(${theseTestsName} C99) 23 | -------------------------------------------------------------------------------- /tests/string_tokenizer_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(string_tokenizer_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/string_utils_int/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | 3 | set(theseTestsName string_utils_int) 4 | 5 | generate_cppunittest_wrapper(${theseTestsName}) 6 | 7 | set(${theseTestsName}_c_files 8 | ) 9 | 10 | set(${theseTestsName}_cpp_files 11 | nothing.cpp 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests" ADDITIONAL_LIBS aziotsharedutil) 18 | -------------------------------------------------------------------------------- /tests/string_utils_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright(C) Microsoft Corporation.All rights reserved. 2 | 3 | #include 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(string_utils_int_tests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/string_utils_int/nothing.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | int nothingB817067A_D13C_43AE_BA6F_CD16AD2BF441 = 0; -------------------------------------------------------------------------------- /tests/strings_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName strings_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/strings.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/strings_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(strings_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/template_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName template_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ## 12 | # Include all target files that you need to execute the test. 13 | # ../../adapters/.c 14 | # ../../src/.c 15 | ## 16 | target/target.c 17 | ) 18 | 19 | set(${theseTestsName}_h_files 20 | ## 21 | # Include all headers that you need to execute the test. Normally we don't need any. 22 | ## 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | 27 | compile_c_test_artifacts_as(${theseTestsName} C99) 28 | -------------------------------------------------------------------------------- /tests/template_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(template_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/template_ut/target/callee.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef CALLEE_H 5 | #define CALLEE_H 6 | 7 | #include "umock_c/umock_c_prod.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #include 12 | #else 13 | #include 14 | #endif /* __cplusplus */ 15 | 16 | typedef void* CALLEE_HANDLE; 17 | 18 | #define CALLEE_RESULT_VALUES \ 19 | CALLEE_RESULT_OK, \ 20 | CALLEE_RESULT_FAIL, \ 21 | CALLEE_RESULT_OUT_OF_MEMORY 22 | MU_DEFINE_ENUM(CALLEE_RESULT, CALLEE_RESULT_VALUES); 23 | 24 | 25 | /** 26 | * This is the set of mockable functions that template_ut.c will replace 27 | */ 28 | MOCKABLE_FUNCTION(, CALLEE_HANDLE, callee_open, size_t, parameter); 29 | MOCKABLE_FUNCTION(, void, callee_close, CALLEE_HANDLE, handle); 30 | MOCKABLE_FUNCTION(, CALLEE_RESULT, callee_bar_1); 31 | MOCKABLE_FUNCTION(, CALLEE_RESULT, callee_bar_2, char, parameter); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif /* __cplusplus */ 36 | 37 | #endif //CALLEE_H 38 | -------------------------------------------------------------------------------- /tests/tickcounter_freertos_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tickcounter_freertos_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../pal/freertos/tickcounter.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | include_directories(.) 18 | 19 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 20 | 21 | compile_c_test_artifacts_as(${theseTestsName} C99) 22 | -------------------------------------------------------------------------------- /tests/tickcounter_freertos_ut/freertos/FreeRTOS.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef FREERTOS_H 5 | #define FREERTOS_H 6 | 7 | #ifdef __cplusplus 8 | 9 | extern "C" { 10 | #include 11 | #else 12 | #include 13 | #endif /* __cplusplus */ 14 | 15 | #define CONFIG_FREERTOS_HZ 100 16 | #include "umock_c/umock_c_prod.h" 17 | 18 | MOCKABLE_FUNCTION(, uint32_t, xTaskGetTickCount); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif /* __cplusplus */ 23 | 24 | #endif // FREERTOS_H -------------------------------------------------------------------------------- /tests/tickcounter_freertos_ut/freertos/task.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef FREERTOS_TASK_H 5 | #define FREERTOS_TASK_H 6 | 7 | // This file must exist to keep tickcounter_freertos.c compatible with FreeRTOS 8 | 9 | 10 | #endif // FREERTOS_TASK_H 11 | -------------------------------------------------------------------------------- /tests/tickcounter_freertos_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(tickcounter_freertos_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/tickcounter_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tickcounter_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ${TICKCOUTER_C_FILE} 12 | ) 13 | 14 | if(UNIX) # linux & apple 15 | set(${theseTestsName}_c_files ${${theseTestsName}_c_files} 16 | ../../adapters/linux_time.c 17 | ) 18 | endif() 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 24 | 25 | compile_c_test_artifacts_as(${theseTestsName} C99) 26 | -------------------------------------------------------------------------------- /tests/tickcounter_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(tickcounter_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/timer_win32_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName timer_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | timer_mocked.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/timer_win32_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(timer_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/timer_win32_ut/timer_mocked.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | 3 | #include "Windows.h" 4 | 5 | 6 | #define QueryPerformanceFrequency mocked_QueryPerformanceFrequency 7 | #define QueryPerformanceCounter mocked_QueryPerformanceCounter 8 | 9 | 10 | extern BOOLEAN mocked_QueryPerformanceCounter(LARGE_INTEGER* lpPerformanceCount); 11 | extern BOOLEAN mocked_QueryPerformanceFrequency(LARGE_INTEGER* lpFrequency); 12 | 13 | #include "../../adapters/timer.c" 14 | -------------------------------------------------------------------------------- /tests/tlsio_bearssl_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_bearssl_ut) 7 | 8 | set(BEARSSL_ROOT_DIR $ENV{BEARSSL_ROOT_DIR} CACHE PATH "") 9 | #set(BEARSSL_ROOT_DIR "C:/Users/markrad/S/BearSSL") 10 | include_directories("${BEARSSL_ROOT_DIR}/include") 11 | 12 | set(${theseTestsName}_test_files 13 | ${theseTestsName}.c 14 | ) 15 | 16 | set(${theseTestsName}_c_files 17 | ../../adapters/tlsio_bearssl.c 18 | ../../src/vector.c 19 | ../../src/buffer.c 20 | ) 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | add_definitions(-DUSE_BEAR_SSL) 26 | 27 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 28 | 29 | compile_c_test_artifacts_as(${theseTestsName} C99) 30 | -------------------------------------------------------------------------------- /tests/tlsio_bearssl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_bearssl_ut, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/tlsio_cyclonessl_socket_bsd_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_cyclonessl_socket_bsd_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | ${theseTestsName}.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/tlsio_cyclonessl_socket_bsd.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | #CycloneSSL has a pretty big list of warnings which need to be ignored 20 | set_source_files_properties(../../src/tlsio_cyclonessl_socket_bsd.c PROPERTIES COMPILE_FLAGS "/wd4200 /wd4201 /wd4244 /wd4100 /wd4267 /wd4701 /wd4703 /wd4389 /wd4005 /wd4996") 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | 24 | compile_c_test_artifacts_as(${theseTestsName} C99) 25 | -------------------------------------------------------------------------------- /tests/tlsio_cyclonessl_socket_bsd_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_cyclonessl_socket_bsd_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/tlsio_cyclonessl_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_cyclonessl_ut) 7 | 8 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 9 | 10 | set(${theseTestsName}_test_files 11 | ${theseTestsName}.c 12 | ) 13 | 14 | set(${theseTestsName}_c_files 15 | ../../src/tlsio_cyclonessl.c 16 | ../real_test_files/real_crt_abstractions.c 17 | ) 18 | 19 | #CycloneSSL has a pretty big list of warnings which need to be ignored 20 | set_source_files_properties(../../src/tlsio_cyclonessl.c PROPERTIES COMPILE_FLAGS "/wd4200 /wd4201 /wd4244 /wd4100 /wd4267 /wd4701 /wd4703 /wd4389 /wd4005 /wd4996") 21 | 22 | set(${theseTestsName}_h_files 23 | ) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | 27 | compile_c_test_artifacts_as(${theseTestsName} C99) 28 | -------------------------------------------------------------------------------- /tests/tlsio_cyclonessl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_cyclonessl_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/tlsio_mbedtls_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_mbedtls_ut) 7 | 8 | #set(MBED_ROOT_DIR $ENV{MBED_ROOT_DIR} CACHE PATH "") 9 | set(MBED_ROOT_DIR "G:/Enlistment/mbedtls") 10 | include_directories("${MBED_ROOT_DIR}/include") 11 | 12 | set(${theseTestsName}_test_files 13 | ${theseTestsName}.c 14 | ) 15 | 16 | set(${theseTestsName}_c_files 17 | ../../adapters/tlsio_mbedtls.c 18 | ) 19 | 20 | set(${theseTestsName}_h_files 21 | ) 22 | 23 | add_definitions(-DUSE_MBED_TLS) 24 | 25 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 26 | 27 | compile_c_test_artifacts_as(${theseTestsName} C99) 28 | -------------------------------------------------------------------------------- /tests/tlsio_mbedtls_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_mbedtls_ut, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/tlsio_options_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_options_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../pal/tlsio_options.c 12 | ../../src/optionhandler.c 13 | ../../src/crt_abstractions.c 14 | ../../src/vector.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | gballoc_ut_impl_1.h 19 | gballoc_ut_impl_2.h 20 | ) 21 | 22 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 23 | 24 | compile_c_test_artifacts_as(${theseTestsName} C99) 25 | -------------------------------------------------------------------------------- /tests/tlsio_options_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(tlsio_options_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/tlsio_wolfssl_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName tlsio_wolfssl_ut) 7 | 8 | set(${theseTestsName}_test_files 9 | ${theseTestsName}.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../adapters/tlsio_wolfssl.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 20 | 21 | compile_c_test_artifacts_as(${theseTestsName} C99) 22 | -------------------------------------------------------------------------------- /tests/tlsio_wolfssl_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(tlsio_wolfssl_ut, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/uniqueid_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(uniqueid_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/urlencode_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName urlencode_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/urlencode.c 12 | ../../src/strings.c 13 | ) 14 | 15 | set(${theseTestsName}_h_files 16 | ) 17 | 18 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 19 | 20 | compile_c_test_artifacts_as(${theseTestsName} C99) 21 | -------------------------------------------------------------------------------- /tests/urlencode_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(URLEncode_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/utf8_checker_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName utf8_checker_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/utf8_checker.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/utf8_checker_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(utf8_checker_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/uuid_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName uuid_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/uuid.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/uuid_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(uuid_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/uws_client_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName uws_client_ut) 7 | 8 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 9 | 10 | generate_cppunittest_wrapper(${theseTestsName}) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/uws_client.c 14 | ../real_test_files/real_buffer.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | 22 | compile_c_test_artifacts_as(${theseTestsName} C99) 23 | -------------------------------------------------------------------------------- /tests/uws_client_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(uws_client_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/uws_frame_encoder_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName uws_frame_encoder_ut) 7 | 8 | include_directories(${SHARED_UTIL_REAL_TEST_FOLDER}) 9 | 10 | generate_cppunittest_wrapper(${theseTestsName}) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../src/uws_frame_encoder.c 14 | ../real_test_files/real_buffer.c 15 | ) 16 | 17 | set(${theseTestsName}_h_files 18 | ) 19 | 20 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 21 | 22 | compile_c_test_artifacts_as(${theseTestsName} C99) 23 | -------------------------------------------------------------------------------- /tests/uws_frame_encoder_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(uws_frame_encoder_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/vector_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName vector_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/vector.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/vector_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(Vector_UnitTests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/ws_url_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName ws_url_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/ws_url.c 12 | ../real_test_files/real_string_token.c 13 | ) 14 | 15 | set(${theseTestsName}_h_files 16 | ) 17 | 18 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 19 | 20 | compile_c_test_artifacts_as(${theseTestsName} C99) 21 | -------------------------------------------------------------------------------- /tests/ws_url_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(ws_url_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/wsio_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName wsio_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/wsio.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/wsio_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(wsio_ut, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/x509_openssl_ut/engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName x509_openssl_ut_engine) 7 | 8 | set(${theseTestsName}_test_files 9 | ../x509_openssl_ut.c 10 | ) 11 | 12 | if(LINUX) 13 | set_property( 14 | SOURCE 15 | ../../adapters/x509_openssl.c 16 | PROPERTY COMPILE_OPTIONS 17 | -Wno-deprecated-declarations 18 | ) 19 | endif() 20 | 21 | set(${theseTestsName}_c_files 22 | ../../../adapters/x509_openssl.c 23 | ) 24 | 25 | set(${theseTestsName}_h_files 26 | ) 27 | 28 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 29 | 30 | compile_c_test_artifacts_as(${theseTestsName} C99) 31 | -------------------------------------------------------------------------------- /tests/x509_openssl_ut/engine/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(x509_openssl_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/x509_openssl_ut/no_engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName x509_openssl_ut_no_engine) 7 | 8 | set(${theseTestsName}_test_files 9 | ../x509_openssl_ut.c 10 | ) 11 | 12 | set(${theseTestsName}_c_files 13 | ../../../adapters/x509_openssl.c 14 | ) 15 | 16 | set(${theseTestsName}_h_files 17 | ) 18 | 19 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_NO_ENGINE") 20 | 21 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 22 | 23 | compile_c_test_artifacts_as(${theseTestsName} C99) 24 | -------------------------------------------------------------------------------- /tests/x509_openssl_ut/no_engine/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(x509_openssl_unittests, failedTestCount); 10 | return (int)failedTestCount; 11 | } 12 | -------------------------------------------------------------------------------- /tests/x509_schannel_int/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName x509_schannel_int) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ) 12 | 13 | set(${theseTestsName}_h_files 14 | ) 15 | 16 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 17 | 18 | compile_c_test_artifacts_as(${theseTestsName} C99) 19 | 20 | if(TARGET ${theseTestsName}_dll) 21 | target_link_libraries(${theseTestsName}_dll crypt32 Ncrypt aziotsharedutil) 22 | endif() 23 | 24 | if(TARGET ${theseTestsName}_exe) 25 | target_link_libraries(${theseTestsName}_exe crypt32 Ncrypt aziotsharedutil) 26 | endif() 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/x509_schannel_int/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(x509_schannel_int, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/x509_schannel_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(x509_schannel_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /tests/xio_ut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | set(theseTestsName xio_ut) 7 | 8 | generate_cppunittest_wrapper(${theseTestsName}) 9 | 10 | set(${theseTestsName}_c_files 11 | ../../src/xio.c 12 | ) 13 | 14 | set(${theseTestsName}_h_files 15 | ) 16 | 17 | build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests") 18 | 19 | compile_c_test_artifacts_as(${theseTestsName} C99) 20 | -------------------------------------------------------------------------------- /tests/xio_ut/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | #include "testrunnerswitcher.h" 6 | 7 | int main(void) 8 | { 9 | size_t failedTestCount = 0; 10 | RUN_TEST_SUITE(xio_unittests, failedTestCount); 11 | return (int)failedTestCount; 12 | } 13 | -------------------------------------------------------------------------------- /testtools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists for testtools. It does nothing, except loads other folders 5 | 6 | include("../configs/azure_c_shared_utilityFunctions.cmake") 7 | 8 | usePermissiveRulesForSamplesAndTests() 9 | 10 | if(NOT ${use_installed_dependencies}) 11 | if(MACOSX) 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-prototypes") 13 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-strict-prototypes") 14 | endif() 15 | if ((NOT TARGET ctest) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/ctest/CMakeLists.txt)) 16 | add_subdirectory(ctest) 17 | endif() 18 | if ((NOT TARGET testrunnerswitcher) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/testrunner/CMakeLists.txt)) 19 | add_subdirectory(testrunner) 20 | endif() 21 | endif() 22 | 23 | add_subdirectory(sal) 24 | add_subdirectory(micromock) 25 | -------------------------------------------------------------------------------- /testtools/SerialPort/SerialPort.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialPort", "SerialPort\SerialPort.csproj", "{D09A2AFE-DF3D-41E1-80CF-37FA64A04E49}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D09A2AFE-DF3D-41E1-80CF-37FA64A04E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D09A2AFE-DF3D-41E1-80CF-37FA64A04E49}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D09A2AFE-DF3D-41E1-80CF-37FA64A04E49}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D09A2AFE-DF3D-41E1-80CF-37FA64A04E49}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /testtools/SerialPort/SerialPort/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /testtools/SerialPort/SerialPort/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | 7 | namespace Azure.IoT.Internal.Tools 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | SerialPort sp = new SerialPort("COM4"); 14 | if (sp.Open()) 15 | { 16 | sp.SetBreakState(); 17 | Thread.Sleep(50); 18 | sp.ClearBreakState(); 19 | 20 | sp.SetDefaultTimeouts(); 21 | 22 | SerialPortState cfg = sp.GetState(); 23 | cfg.BaudRate = 115200; 24 | sp.SetState(cfg); 25 | 26 | for (int i = 0; i < 3; i++) 27 | { 28 | string message = sp.ReadLine(); 29 | 30 | bool result = sp.WriteLine("cataca"); 31 | } 32 | 33 | sp.Close(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /testtools/SerialPort/SerialPort/SerialPortTimeouts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Azure.IoT.Internal.Tools 8 | { 9 | /// 10 | /// See the Win32 API COMMTIMEOUTS for details. 11 | /// 12 | public struct SerialPortTimeouts // a.k.a. COMMTIMEOUTS 13 | { 14 | public uint ReadIntervalTimeout; 15 | public uint ReadTotalTimeoutMultiplier; 16 | public uint ReadTotalTimeoutConstant; 17 | public uint WriteTotalTimeoutMultiplier; 18 | public uint WriteTotalTimeoutConstant; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testtools/SerialPort/SerialPort/Win32Exceptioncs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Azure.IoT.Internal.Tools 8 | { 9 | public class Win32Exception : Exception 10 | { 11 | public Win32Exception(int errorCode, string message, params object[] args) 12 | :base(String.Format(message, args) + String.Format("(error {0})", errorCode)) 13 | { } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testtools/micromock/doc/timediscretemicromock.xps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/testtools/micromock/doc/timediscretemicromock.xps -------------------------------------------------------------------------------- /testtools/micromock/inc/globalmock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef GLOBALMOCK_H 5 | #define GLOBALMOCK_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "mock.h" 11 | #include "mockcallrecorder.h" 12 | #include "micromockexception.h" 13 | 14 | template 15 | class CGlobalMock : public CMock 16 | { 17 | public: 18 | CGlobalMock(_In_ AUTOMATIC_CALL_COMPARISON performAutomaticCallComparison = AUTOMATIC_CALL_COMPARISON_ON) : 19 | CMock(performAutomaticCallComparison) 20 | { 21 | m_GlobalMockInstance = this; 22 | } 23 | 24 | virtual ~CGlobalMock() 25 | { 26 | m_GlobalMockInstance = NULL; 27 | } 28 | 29 | static CGlobalMock* GetSingleton() 30 | { 31 | if (NULL == m_GlobalMockInstance) 32 | { 33 | MOCK_THROW(CMicroMockException(MICROMOCK_EXCEPTION_INTERNAL_ERROR, 34 | _T("Error retrieving singleton"))); 35 | } 36 | 37 | return m_GlobalMockInstance; 38 | } 39 | 40 | protected: 41 | static CGlobalMock* m_GlobalMockInstance; 42 | }; 43 | 44 | template 45 | CGlobalMock* CGlobalMock::m_GlobalMockInstance; 46 | 47 | #endif // GLOBALMOCK_H 48 | -------------------------------------------------------------------------------- /testtools/micromock/inc/micromockcommon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MICROMOCKCOMMON_H 5 | #define MICROMOCKCOMMON_H 6 | 7 | #pragma once 8 | 9 | #include "tchar.h" 10 | #include "string" 11 | #include "sstream" 12 | 13 | #define COUNT_OF(a) (sizeof(a) / sizeof((a)[0])) 14 | 15 | namespace std 16 | { 17 | typedef std::basic_string tstring; 18 | typedef std::basic_ostringstream tostringstream; 19 | } 20 | 21 | #endif // MICROMOCKCOMMON_H 22 | -------------------------------------------------------------------------------- /testtools/micromock/inc/micromocktestrunnerhooks.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MICROMOCCKTESTRUNNERHOOKS_H 5 | #define MICROMOCCKTESTRUNNERHOOKS_H 6 | 7 | #pragma once 8 | 9 | #ifndef MOCK_ASSERT 10 | 11 | #include "stdafx.h" 12 | #include "testrunnerswitcher.h" 13 | 14 | #define MOCK_ASSERT(expected, actual, assertString) ASSERT_ARE_EQUAL((expected), (actual), (assertString)) 15 | #define MOCK_FAIL(expression) ASSERT_FAIL(expression) 16 | 17 | #define MOCK_THROW(mockException) throw(mockException) 18 | 19 | #else // MOCK_ASSERT 20 | #define MOCK_THROW(...) 21 | #endif // MOCK_ASSERT 22 | 23 | #endif // MICROMOCCKTESTRUNNERHOOKS_H 24 | -------------------------------------------------------------------------------- /testtools/micromock/inc/mock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCK_H 5 | #define MOCK_H 6 | 7 | #pragma once 8 | 9 | #include "mockcallrecorder.h" 10 | #include "strictunorderedcallcomparer.h" 11 | 12 | #ifndef UNREFERENCED_PARAMETER 13 | #define UNREFERENCED_PARAMETER(param) param = param; 14 | #endif 15 | 16 | template 17 | class CMock : public CMockCallRecorder 18 | { 19 | public: 20 | CMock(_In_ AUTOMATIC_CALL_COMPARISON performAutomaticCallComparison = AUTOMATIC_CALL_COMPARISON_ON) 21 | { 22 | SetPerformAutomaticCallComparison(performAutomaticCallComparison); 23 | } 24 | }; 25 | 26 | #endif // MOCK_H 27 | -------------------------------------------------------------------------------- /testtools/micromock/inc/mockcallcomparer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCKCALLCOMPARER_H 5 | #define MOCKCALLCOMPARER_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "mockmethodcallbase.h" 11 | 12 | class CMockCallComparer 13 | { 14 | public: 15 | CMockCallComparer() : 16 | m_IgnoreUnexpectedCalls(false) 17 | { 18 | } 19 | 20 | void SetIgnoreUnexpectedCalls(_In_ bool ignoreUnexpectedCalls) { m_IgnoreUnexpectedCalls = ignoreUnexpectedCalls; } 21 | bool GetIgnoreUnexpectedCalls(void) { return m_IgnoreUnexpectedCalls; } 22 | 23 | virtual bool IsUnexpectedCall(_In_ const CMockMethodCallBase* actualCall) = 0; 24 | virtual bool IsMissingCall(_In_ const CMockMethodCallBase* actualCall) = 0; 25 | virtual CMockMethodCallBase* MatchCall(std::vector& expectedCalls, 26 | CMockMethodCallBase* actualCall) = 0; 27 | 28 | protected: 29 | bool m_IgnoreUnexpectedCalls; 30 | }; 31 | 32 | #endif // MOCKCALLCOMPARER_H 33 | -------------------------------------------------------------------------------- /testtools/micromock/inc/mockresultvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCKRESULTVALUE_H 5 | #define MOCKRESULTVALUE_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "mockvalue.h" 11 | 12 | template 13 | class CMockResultValue : 14 | public CMockValue 15 | { 16 | public: 17 | CMockResultValue(T argValue) : 18 | CMockValue(argValue) 19 | { 20 | } 21 | }; 22 | 23 | #endif // MOCKRESULTVALUE_H 24 | -------------------------------------------------------------------------------- /testtools/micromock/inc/mockvaluebase.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef MOCKVALUEBASE_H 5 | #define MOCKVALUEBASE_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | class CMockValueBase 12 | { 13 | public: 14 | virtual ~CMockValueBase(); 15 | 16 | public: 17 | virtual std::tstring ToString() const = 0; 18 | virtual bool EqualTo(_In_ const CMockValueBase* right) = 0; 19 | }; 20 | 21 | #endif // MOCKVALUEBASE_H 22 | -------------------------------------------------------------------------------- /testtools/micromock/inc/nicecallcomparer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef NICECALLCOMPARER_H 5 | #define NICECALLCOMPARER_H 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "strictunorderedcallcomparer.h" 11 | #include "mockmethodcallbase.h" 12 | 13 | template 14 | class CNiceCallComparer : 15 | public CStrictUnorderedCallComparer 16 | { 17 | public: 18 | CNiceCallComparer(_In_ AUTOMATIC_CALL_COMPARISON performAutomaticCallComparison = AUTOMATIC_CALL_COMPARISON_ON) : 19 | CStrictUnorderedCallComparer(performAutomaticCallComparison) 20 | { 21 | T::CMockCallRecorder::m_MockCallComparer->SetIgnoreUnexpectedCalls(true); 22 | } 23 | }; 24 | 25 | #endif // NICECALLCOMPARER_H 26 | -------------------------------------------------------------------------------- /testtools/micromock/inc/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef TARGETVER_H 5 | #define TARGETVER_H 6 | 7 | #pragma once 8 | 9 | // Including SDKDDKVer.h defines the highest available Windows platform. 10 | 11 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 12 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 13 | 14 | #endif // TARGETVER_H 15 | -------------------------------------------------------------------------------- /testtools/micromock/src/mockvaluebase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | #include "mockvaluebase.h" 6 | 7 | CMockValueBase::~CMockValueBase() 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /testtools/micromock/src/timediscretemicromock.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /*defines*/ 5 | #include "stdafx.h" 6 | #include "timediscretemicromock.h" 7 | 8 | /*types*/ 9 | /*static variables*/ 10 | /*static functions*/ 11 | 12 | /*variable exports*/ 13 | std::vector stims_base::allPlayers; 14 | 15 | /*debug variables*/ 16 | UINT32 theTick; 17 | UINT32 totalTicksPlayed; 18 | 19 | /*function exports*/ 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /testtools/micromock/tools/micromockgenerator/micromockgenerator.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/testtools/micromock/tools/micromockgenerator/micromockgenerator.rc -------------------------------------------------------------------------------- /testtools/micromock/tools/micromockgenerator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | -------------------------------------------------------------------------------- /testtools/micromock/tools/micromockgenerator/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include 7 | #ifdef _CRTDBG_MAP_ALLOC 8 | #include 9 | #endif 10 | 11 | #include "targetver.h" 12 | 13 | #include "stdio.h" 14 | #include "tchar.h" 15 | #include "string" 16 | #include "sstream" 17 | 18 | #ifndef WIN32_LEAN_AND_MEAN 19 | #define WIN32_LEAN_AND_MEAN 20 | #endif // WIN32_LEAN_AND_MEAN 21 | #include "windows.h" 22 | -------------------------------------------------------------------------------- /testtools/micromock/tools/micromockgenerator/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | // Including SDKDDKVer.h defines the highest available Windows platform. 7 | 8 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 9 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists for micromock unittests folder, it is empty 5 | cmake_minimum_required (VERSION 3.5) 6 | 7 | add_subdirectory(micromocktest) 8 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #this is CMakeLists for micromock unittests 5 | cmake_minimum_required (VERSION 3.5) 6 | 7 | set(theseTestsName micromock_unittests) 8 | 9 | set(${theseTestsName}_cpp_files 10 | stdafx.cpp 11 | cmockvalueunittests.cpp 12 | micromockcallcomparisonunittests.cpp 13 | micromocktest.cpp 14 | micromockvalidateargumentbufferunittests.cpp 15 | nullargsstringificationunittests.cpp 16 | #timediscretemicromocktestvoidvoid.cpp 17 | #timediscretemicromocktest_stim.cpp 18 | #timediscretemicromockwithreturnandparameters.cpp 19 | ) 20 | 21 | set(${theseTestsName}_c_files 22 | #hypothetic_module.c 23 | #micromocktest_with_ctest.c 24 | ) 25 | 26 | set(${theseTestsName}_h_files 27 | #hypothetic_module.h 28 | hypothetic_module_interfaces.h 29 | stdafx.h 30 | ) 31 | 32 | 33 | build_test_artifacts(${theseTestsName} ON) 34 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/hypothetic_module.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /*defines*/ 5 | #ifndef HYPOTHETIC_MODULE_H 6 | #define HYPOTHETIC_MODULE_H 7 | 8 | #pragma once 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | /*types*/ 16 | /*variable exports*/ 17 | /*function exports*/ 18 | 19 | typedef void (*pVoidFunction)(void); 20 | typedef char *pChar; 21 | 22 | extern void zero(void); 23 | extern int izero(void); 24 | extern int one (_In_ int i); 25 | extern int two (_In_z_ pChar s, _In_ int i); 26 | extern int three(_In_ char c, _In_z_ pChar s, _In_ int i); 27 | extern int four (_In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i); 28 | extern int five (_In_opt_ pVoidFunction pVoid, _In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i); 29 | extern int six (_In_ char c1, _In_ char c2, _In_ char c3, _In_ char c4, _In_ char c5, _In_ char c6); 30 | 31 | extern void theTask(void); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/hypothetic_module_interfaces.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /*defines*/ 5 | #ifndef HYPOTHETIC_MODULE_INTERFACE_H 6 | #define HYPOTHETIC_MODULE_INTERFACE_H 7 | 8 | #pragma once 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | /*types*/ 16 | typedef void(*pVoidFunction)(void); 17 | typedef char* pChar; 18 | 19 | /*variable exports*/ 20 | /*function exports*/ 21 | extern void whenzero(void); 22 | extern int whenizero(void); 23 | extern int whenone (_In_ int i); 24 | extern int whentwo (_In_z_ pChar s, _In_ int i); 25 | extern int whenthree(_In_ char c, _In_z_ pChar s, _In_ int i); 26 | extern int whenfour (_In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i); 27 | extern int whenfive (_In_opt_ pVoidFunction pVoid, _In_ unsigned short int si, _In_ char c, _In_z_ pChar s, _In_ int i); 28 | extern int whensix (_In_ char c1, _In_ char c2, _In_ char c3, _In_ char c4, _In_ char c5, _In_ char c6); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/main.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | 6 | int main(void) 7 | { 8 | size_t failedTestCount = 0; 9 | RUN_TEST_SUITE(MicroMockCallComparisonUnitTests, failedTestCount); 10 | RUN_TEST_SUITE(CMockValue_tests ,failedTestCount); 11 | RUN_TEST_SUITE(MicroMockCallComparisonUnitTests ,failedTestCount); 12 | RUN_TEST_SUITE(MicroMockTest ,failedTestCount); 13 | RUN_TEST_SUITE(MicroMockValidateArgumentBufferTests,failedTestCount); 14 | RUN_TEST_SUITE(NULLArgsStringificationTests ,failedTestCount); 15 | return failedTestCount; 16 | } 17 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/micromocktest_with_ctest.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "testrunnerswitcher.h" 5 | int main(void) 6 | { 7 | RUN_TEST_SUITE(CMockValue_tests); 8 | RUN_TEST_SUITE(MicroMockCallComparisonUnitTests); 9 | RUN_TEST_SUITE(MicroMockTest); 10 | RUN_TEST_SUITE(MicroMockValidateArgumentBufferTests); 11 | RUN_TEST_SUITE(NULLArgsStringificationTests); 12 | RUN_TEST_SUITE(MicroMockVoidVoidTest); 13 | RUN_TEST_SUITE(MicroMockStimTest); 14 | RUN_TEST_SUITE(MicroMockTestWithReturnAndParameters); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/testtools/micromock/unittests/micromocktest/resource.h -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include "stdafx.h" 5 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/stdafx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include 7 | #ifdef _CRTDBG_MAP_ALLOC 8 | #include 9 | #endif 10 | 11 | // 4505 is disabled due to unused template specializations declared in CppUnitTest 12 | #pragma warning(disable:4505) 13 | 14 | // Headers for CppUnitTest 15 | //#include "testrunnerswitcher.h" 16 | 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif // WIN32_LEAN_AND_MEAN 20 | #include "micromock.h" 21 | #include "timediscretemicromock.h" 22 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/stdafx_c.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | #include "targetver.h" 7 | #include "string.h" 8 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/targetver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #pragma once 5 | 6 | // Including SDKDDKVer.h defines the highest available Windows platform. 7 | 8 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 9 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-c-shared-utility/772a4f8bc338140b4a0f404cf9c344283c5c937f/testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc -------------------------------------------------------------------------------- /testtools/sal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Copyright (c) Microsoft. All rights reserved. 2 | #Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | cmake_minimum_required (VERSION 3.5) 5 | 6 | #these are the include folders 7 | #the following "set" statetement exports across the project a global variable called SAL_INC_FOLDER that expands to whatever needs to included when using sal header 8 | if(WIN32) 9 | #nothing use the default 10 | set(SAL_INC_FOLDER "" CACHE INTERNAL "this is what needs to be included if using sal header" FORCE) 11 | elseif(UNIX) 12 | set(SAL_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "this is what needs to be included if using sal header" FORCE) 13 | endif() 14 | 15 | if(NOT WIN32) 16 | add_files_to_install("./testtools/sal/inc/sal.h;./testtools/sal/inc/no_sal2.h") 17 | endif() 18 | -------------------------------------------------------------------------------- /testtools/sal/inc/sal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #ifndef SAL_H 5 | #define SAL_H 6 | 7 | #include "no_sal2.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 1.1.12 --------------------------------------------------------------------------------