├── version.txt
├── devdoc
├── img
│ ├── xio_chain.png
│ ├── readme.txt
│ ├── tlsio_state_diagram.png
│ └── porting_guide_overview.png
├── img_src
│ ├── xio_chain.pptx
│ ├── readme.txt
│ ├── tlsio_state_diagram.pptx
│ └── porting_guide_overview.vsdx
├── httpapiex_retry_mechanism.vsdx
├── url_encode_requirements.md
├── uniqueid_requirements.md
└── agenttime_requirements.md
├── tests
├── string_utils_int
│ ├── nothing.cpp
│ ├── main.c
│ └── CMakeLists.txt
├── dns_resolver_ut
│ ├── win32_fake_linux
│ │ └── readme.txt
│ ├── main.c
│ └── CMakeLists.txt
├── socket_async_ut
│ ├── win32_fake_linux
│ │ └── readme.txt
│ ├── main.c
│ └── CMakeLists.txt
├── real_test_files
│ ├── real_memory_data.c
│ ├── real_constbuffer_array.c
│ ├── real_constbuffer.c
│ ├── real_strings.c
│ ├── real_string_tokenizer.c
│ ├── real_base64.c
│ ├── real_crt_abstractions.c
│ ├── real_string_token.c
│ ├── real_doublylinkedlist.c
│ ├── real_vector.c
│ ├── real_map.c
│ ├── real_constbuffer_renames.h
│ ├── real_memory_data_renames.h
│ ├── real_singlylinkedlist.c
│ ├── real_buffer.c
│ ├── real_constbuffer_array_renames.h
│ └── real_string_tokenizer.h
├── constbuffer_array_ut
│ ├── main.c
│ └── CMakeLists.txt
├── constbuffer_array_batcher_ut
│ ├── main.c
│ └── CMakeLists.txt
├── sha_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tickcounter_freertos_ut
│ ├── freertos
│ │ ├── task.h
│ │ └── FreeRTOS.h
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_bearssl_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_mbedtls_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_wolfssl_ut
│ ├── main.c
│ └── CMakeLists.txt
├── wsio_ut
│ ├── main.c
│ └── CMakeLists.txt
├── lock_ut
│ ├── main.c
│ └── CMakeLists.txt
├── map_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_cyclonessl_ut
│ ├── main.c
│ └── CMakeLists.txt
├── uuid_ut
│ ├── main.c
│ └── CMakeLists.txt
├── ws_url_ut
│ ├── main.c
│ └── CMakeLists.txt
├── x509_openssl_ut
│ ├── engine
│ │ ├── main.c
│ │ └── CMakeLists.txt
│ └── no_engine
│ │ ├── main.c
│ │ └── CMakeLists.txt
├── xio_ut
│ ├── main.c
│ └── CMakeLists.txt
├── buffer_ut
│ ├── main.c
│ └── CMakeLists.txt
├── socketio_berkeley_ut
│ ├── main.c
│ └── CMakeLists.txt
├── srw_lock_ut
│ ├── main.c
│ ├── CMakeLists.txt
│ └── srw_lock_mocked.c
├── template_ut
│ ├── main.c
│ ├── CMakeLists.txt
│ └── target
│ │ └── callee.h
├── uws_client_ut
│ ├── main.c
│ └── CMakeLists.txt
├── vector_ut
│ ├── main.c
│ └── CMakeLists.txt
├── agenttime_ut
│ ├── main.c
│ └── CMakeLists.txt
├── azure_base32_ut
│ ├── main.c
│ └── CMakeLists.txt
├── azure_base64_ut
│ ├── main.c
│ └── CMakeLists.txt
├── condition_ut
│ ├── main.c
│ └── CMakeLists.txt
├── constmap_ut
│ ├── main.c
│ └── CMakeLists.txt
├── gballoc_ut
│ ├── main.c
│ ├── CMakeLists.txt
│ └── gballoc_undertest.c
├── httpapiex_ut
│ ├── main.c
│ └── CMakeLists.txt
├── memory_data_ut
│ ├── main.c
│ └── CMakeLists.txt
├── refcount_ut
│ ├── main.c
│ ├── CMakeLists.txt
│ └── some_refcount_impl.h
├── sastoken_ut
│ ├── main.c
│ └── CMakeLists.txt
├── string_token_ut
│ ├── main.c
│ └── CMakeLists.txt
├── strings_ut
│ ├── main.c
│ └── CMakeLists.txt
├── timer_win32_ut
│ ├── main.c
│ ├── timer_mocked.c
│ └── CMakeLists.txt
├── uniqueid_ut
│ ├── main.c
│ └── CMakeLists.txt
├── urlencode_ut
│ ├── main.c
│ └── CMakeLists.txt
├── utf8_checker_ut
│ ├── main.c
│ └── CMakeLists.txt
├── constbuffer_ut
│ ├── main.c
│ └── CMakeLists.txt
├── hmacsha256_ut
│ ├── main.c
│ └── CMakeLists.txt
├── httpapicompact_ut
│ ├── main.c
│ └── CMakeLists.txt
├── httpheaders_ut
│ ├── main.c
│ └── CMakeLists.txt
├── platform_win32_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tickcounter_ut
│ ├── main.c
│ └── CMakeLists.txt
├── x509_schannel_int
│ ├── main.c
│ └── CMakeLists.txt
├── http_proxy_io_ut
│ ├── main.c
│ └── CMakeLists.txt
├── httpapiexsas_ut
│ ├── main.c
│ └── CMakeLists.txt
├── optionhandler_ut
│ ├── main.c
│ └── CMakeLists.txt
├── socketio_win32_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_options_ut
│ ├── main.c
│ └── CMakeLists.txt
├── uws_frame_encoder_ut
│ ├── main.c
│ └── CMakeLists.txt
├── x509_schannel_ut
│ └── main.c
├── crtabstractions_ut
│ ├── main.c
│ └── CMakeLists.txt
├── doublylinkedlist_ut
│ ├── main.c
│ └── CMakeLists.txt
├── singlylinkedlist_ut
│ ├── main.c
│ └── CMakeLists.txt
├── string_tokenizer_ut
│ ├── main.c
│ └── CMakeLists.txt
├── tlsio_cyclonessl_socket_bsd_ut
│ ├── main.c
│ └── CMakeLists.txt
├── connectionstringparser_ut
│ ├── main.c
│ └── CMakeLists.txt
├── gballoc_without_init_ut
│ ├── main.c
│ ├── CMakeLists.txt
│ └── gballoc_undertest.c
└── logging_ut
│ ├── minimal
│ └── minimal.c
│ └── CMakeLists.txt
├── testtools
├── micromock
│ ├── doc
│ │ └── timediscretemicromock.xps
│ ├── unittests
│ │ ├── micromocktest
│ │ │ ├── resource.h
│ │ │ ├── unittestsgenericresource.rc
│ │ │ ├── stdafx.cpp
│ │ │ ├── stdafx_c.h
│ │ │ ├── targetver.h
│ │ │ ├── stdafx.h
│ │ │ ├── micromocktest_with_ctest.c
│ │ │ ├── main.c
│ │ │ ├── CMakeLists.txt
│ │ │ ├── hypothetic_module.h
│ │ │ └── hypothetic_module_interfaces.h
│ │ └── CMakeLists.txt
│ ├── tools
│ │ └── micromockgenerator
│ │ │ ├── micromockgenerator.rc
│ │ │ ├── stdafx.cpp
│ │ │ ├── targetver.h
│ │ │ └── stdafx.h
│ ├── src
│ │ ├── mockvaluebase.cpp
│ │ └── timediscretemicromock.cpp
│ └── inc
│ │ ├── mockvaluebase.h
│ │ ├── targetver.h
│ │ ├── mockresultvalue.h
│ │ ├── micromockcommon.h
│ │ ├── mock.h
│ │ ├── micromocktestrunnerhooks.h
│ │ ├── nicecallcomparer.h
│ │ ├── mockcallcomparer.h
│ │ └── globalmock.h
├── SerialPort
│ ├── SerialPort
│ │ ├── App.config
│ │ ├── Win32Exceptioncs.cs
│ │ ├── SerialPortTimeouts.cs
│ │ └── Program.cs
│ └── SerialPort.sln
├── sal
│ ├── inc
│ │ └── sal.h
│ └── CMakeLists.txt
└── CMakeLists.txt
├── archive
└── cyclonessl
│ └── readme.md
├── dependencies-test.cmake
├── adapters
├── envvariable.c
├── random_stub.c
├── random_posix.c
├── linux_time.h
├── agenttime.c
├── platform_stub.c
├── platform_tizenrt.c
├── README.md
├── condition_rtx_mbed.cpp
├── platform_freertos.c
└── uniqueid_linux.c
├── inc
└── azure_c_shared_utility
│ ├── strings_types.h
│ ├── stdint_ce6.h
│ ├── string_tokenizer_types.h
│ ├── random.h
│ ├── envvariable.h
│ ├── vector_types.h
│ ├── optimize_size.h
│ ├── utf8_checker.h
│ ├── vector_types_internal.h
│ ├── tlsio_cyclonessl.h
│ ├── logging_stacktrace.h
│ ├── tlsio.h
│ ├── hmac.h
│ ├── safe_math.h
│ ├── timer.h
│ ├── tlsio_cyclonessl_socket.h
│ ├── consolelogger.h
│ ├── etwlogger_driver.h
│ ├── const_defines.h
│ ├── constbuffer_array_batcher.h
│ ├── http_proxy_io.h
│ ├── uniqueid.h
│ ├── sastoken.h
│ ├── string_tokenizer.h
│ ├── x509_schannel.h
│ ├── wsio.h
│ ├── hmacsha256.h
│ ├── x509_openssl.h
│ ├── srw_lock.h
│ ├── platform.h
│ ├── connection_string_parser.h
│ ├── tickcounter.h
│ ├── sha-private.h
│ ├── ws_url.h
│ └── httpapiexsas.h
├── jenkins
├── windows_c.cmd
├── ubuntu_clang.sh
├── debian_c.sh
├── linux_bearssl.sh
├── ubuntu_c.sh
├── linux_bearssl_clang_buildonly.sh
├── osx_xcode_native.sh
├── osx_gcc_openssl.sh
├── linux_cares.sh
├── linux_wolfssl_clang_buildonly.sh
├── linux_mbed_clang_buildonly.sh
├── linux_mbed.sh
├── windows_c_build_as_dynamic.cmd
├── linux_wolfssl.sh
├── linux_install_deps.sh
├── raspberrypi_c_buster.sh
└── windows_c_VsDevCmd.cmd
├── .gitmodules
├── pal
├── windows
│ ├── socket_async_os.h
│ └── refcount_os.h
├── lwip
│ └── sntp_os.h
├── ios-osx
│ ├── socket_async_os.h
│ └── tlsio_appleios.h
├── linux
│ └── socket_async_os.h
├── agenttime.c
├── generic
│ └── refcount_os.h
└── mbed_os5
│ └── refcount_os.h
├── nuget.config
├── src
├── aziotsharedutil_wsio.def
├── aziotsharedutil_http.def
├── hmacsha256.c
├── README.md
├── etwxlogging.c
└── gb_time.c
├── samples
├── CMakeLists.txt
├── iot_c_utility
│ └── CMakeLists.txt
├── tlsio_connect
│ └── CMakeLists.txt
└── socketio_connect
│ └── CMakeLists.txt
├── configs
├── azure_c_shared_utilityConfig.cmake
└── azure_iot_external_pal_unit_test_setup.cmake
├── .gitattributes
├── dependencies.cmake
└── LICENSE
/version.txt:
--------------------------------------------------------------------------------
1 | 1.1.12
--------------------------------------------------------------------------------
/devdoc/img/xio_chain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/img/xio_chain.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_src/xio_chain.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/img_src/xio_chain.pptx
--------------------------------------------------------------------------------
/devdoc/img/tlsio_state_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/img/tlsio_state_diagram.png
--------------------------------------------------------------------------------
/devdoc/httpapiex_retry_mechanism.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/httpapiex_retry_mechanism.vsdx
--------------------------------------------------------------------------------
/devdoc/img/porting_guide_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/img/porting_guide_overview.png
--------------------------------------------------------------------------------
/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/HEAD/devdoc/img_src/tlsio_state_diagram.pptx
--------------------------------------------------------------------------------
/devdoc/img_src/porting_guide_overview.vsdx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/devdoc/img_src/porting_guide_overview.vsdx
--------------------------------------------------------------------------------
/tests/string_utils_int/nothing.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) Microsoft Corporation. All rights reserved.
2 | int nothingB817067A_D13C_43AE_BA6F_CD16AD2BF441 = 0;
--------------------------------------------------------------------------------
/testtools/micromock/doc/timediscretemicromock.xps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/testtools/micromock/doc/timediscretemicromock.xps
--------------------------------------------------------------------------------
/testtools/micromock/unittests/micromocktest/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/testtools/micromock/unittests/micromocktest/resource.h
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/testtools/micromock/tools/micromockgenerator/micromockgenerator.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/testtools/micromock/tools/micromockgenerator/micromockgenerator.rc
--------------------------------------------------------------------------------
/testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/azure-c-shared-utility/HEAD/testtools/micromock/unittests/micromocktest/unittestsgenericresource.rc
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/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/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/SerialPort/SerialPort/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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()
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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_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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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_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_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/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/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/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/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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%
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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_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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 | :
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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()
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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_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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/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/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_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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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)
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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)
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 **]**
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/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/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
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tests/uniqueid_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 uniqueid_ut)
7 |
8 | if(WIN32)
9 | set(uniqueid_ut_test_file ${theseTestsName}_win32)
10 | generate_cppunittest_wrapper(${uniqueid_ut_test_file})
11 | else()
12 | set(uniqueid_ut_test_file ${theseTestsName}_linux)
13 | generate_cppunittest_wrapper(${uniqueid_ut_test_file})
14 | endif()
15 |
16 |
17 | set(${uniqueid_ut_test_file}_c_files
18 | ${UNIQUEID_C_FILE}
19 | )
20 |
21 | set(${uniqueid_ut_test_file}_h_files
22 | )
23 |
24 | if(APPLE)
25 | find_package(PkgConfig REQUIRED)
26 | pkg_search_module(UUID REQUIRED uuid)
27 | endif()
28 |
29 | if(WIN32)
30 | build_c_test_artifacts(${uniqueid_ut_test_file} ON "tests/azure_c_shared_utility_tests" ADDITIONAL_LIBS rpcrt4.lib)
31 | elseif(UNIX)
32 | if(APPLE)
33 | build_c_test_artifacts(${uniqueid_ut_test_file} ON "tests/azure_c_shared_utility_tests" ADDITIONAL_LIBS -L${UUID_LIBRARY_DIRS} ${UUID_LIBRARIES})
34 | else()
35 | build_c_test_artifacts(${uniqueid_ut_test_file} ON "tests/azure_c_shared_utility_tests" ADDITIONAL_LIBS uuid)
36 | endif()
37 | endif()
38 |
39 | compile_c_test_artifacts_as(${uniqueid_ut_test_file} C99)
40 |
--------------------------------------------------------------------------------
/adapters/uniqueid_linux.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
6 | #include
7 | #include
8 |
9 | #include "azure_macro_utils/macro_utils.h"
10 | #include "azure_c_shared_utility/uniqueid.h"
11 | #include "azure_c_shared_utility/xlogging.h"
12 |
13 | MU_DEFINE_ENUM_STRINGS(UNIQUEID_RESULT, UNIQUEID_RESULT_VALUES);
14 |
15 | UNIQUEID_RESULT UniqueId_Generate(char* uid, size_t len)
16 | {
17 | UNIQUEID_RESULT result;
18 |
19 | /* Codes_SRS_UNIQUEID_07_002: [If uid is NULL then UniqueId_Generate shall return UNIQUEID_INVALID_ARG] */
20 | /* Codes_SRS_UNIQUEID_07_003: [If len is less then 37 then UniqueId_Generate shall return UNIQUEID_INVALID_ARG] */
21 | if (uid == NULL || len < 37)
22 | {
23 | result = UNIQUEID_INVALID_ARG;
24 | LogError("Buffer Size is Null. (result = %" PRI_MU_ENUM ")", MU_ENUM_VALUE(UNIQUEID_RESULT, result));
25 | }
26 | else
27 | {
28 | uuid_t uuidVal;
29 | uuid_generate(uuidVal);
30 |
31 | /* Codes_SRS_UNIQUEID_07_001: [UniqueId_Generate shall create a unique Id 36 character long string.] */
32 | memset(uid, 0, len);
33 | uuid_unparse(uuidVal, uid);
34 | result = UNIQUEID_OK;
35 | }
36 | return result;
37 | }
38 |
--------------------------------------------------------------------------------
/src/gb_time.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 | /*depending if the symbol GB_TIME_INTERCEPT is defined, this file does the following
5 |
6 | a) if GB_TIME_INTERCEPT is NOT defined, then the file shall be empty (almost:)
7 | b) if GB_TIME_INTERCEPT is defined, then the file shall call to the 'real' time.h functions from their gb_* synonyms*/
8 | #ifdef _MSC_VER
9 | /* compiler warning C4206: nonstandard extension used: translation unit is empty */
10 | /* linker warning 4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library */
11 | const int avoid_warnings_0CA668EF_F2C4_49A8_A30D_7257C67173A4 = 0;
12 | #endif
13 | #ifdef GB_TIME_INTERCEPT
14 |
15 | #ifdef __cplusplus
16 | #include
17 | #else
18 | #include
19 | #endif
20 |
21 | #include "azure_c_shared_utility/gb_time.h"
22 |
23 | /*this is time*/
24 | time_t gb_time(time_t *timer);
25 | {
26 | return time(timer);
27 | }
28 |
29 | /*this is localtime*/
30 | struct tm *gb_localtime(const time_t *timer)
31 | {
32 | return gb_localtime(timer);
33 | }
34 |
35 | size_t gb_strftime(char * s, size_t maxsize, const char * format, const struct tm * timeptr)
36 | {
37 | return strftime(s, maxsize, format, timeptr);
38 | }
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/tests/real_test_files/real_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 REAL_STRING_TOKENIZER_H
5 | #define REAL_STRING_TOKENIZER_H
6 |
7 | #define REGISTER_STRING_TOKENIZER_GLOBAL_MOCK_HOOK \
8 | REGISTER_GLOBAL_MOCK_HOOK(STRING_TOKENIZER_create, real_STRING_TOKENIZER_create); \
9 | REGISTER_GLOBAL_MOCK_HOOK(STRING_TOKENIZER_create_from_char, real_STRING_TOKENIZER_create_from_char); \
10 | REGISTER_GLOBAL_MOCK_HOOK(STRING_TOKENIZER_get_next_token, real_STRING_TOKENIZER_get_next_token); \
11 | REGISTER_GLOBAL_MOCK_HOOK(STRING_TOKENIZER_destroy, real_STRING_TOKENIZER_destroy);
12 |
13 | #define STRING_TOKENIZER_create real_STRING_TOKENIZER_create
14 | #define STRING_TOKENIZER_create_from_char real_STRING_TOKENIZER_create_from_char
15 | #define STRING_TOKENIZER_get_next_token real_STRING_TOKENIZER_get_next_token
16 | #define STRING_TOKENIZER_destroy real_STRING_TOKENIZER_destroy
17 |
18 | #undef STRING_TOKENIZER_H
19 | #include "azure_c_shared_utility/string_tokenizer.h"
20 |
21 | #ifndef COMPILING_REAL_REAL_STRING_TOKENIZER_H_C
22 |
23 | #undef STRING_TOKENIZER_create
24 | #undef STRING_TOKENIZER_create_from_char
25 | #undef STRING_TOKENIZER_get_next_token
26 | #undef STRING_TOKENIZER_destroy
27 |
28 | #endif
29 |
30 | #undef STRING_TOKENIZER_H
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/inc/azure_c_shared_utility/httpapiexsas.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 HTTPAPIEX_SAS_H
5 | #define HTTPAPIEX_SAS_H
6 |
7 | #include "azure_c_shared_utility/strings.h"
8 | #include "azure_c_shared_utility/buffer_.h"
9 | #include "azure_c_shared_utility/httpheaders.h"
10 | #include "azure_c_shared_utility/httpapiex.h"
11 | #include "umock_c/umock_c_prod.h"
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | typedef struct HTTPAPIEX_SAS_STATE_TAG* HTTPAPIEX_SAS_HANDLE;
18 |
19 | MOCKABLE_FUNCTION(, HTTPAPIEX_SAS_HANDLE, HTTPAPIEX_SAS_Create, STRING_HANDLE, key, STRING_HANDLE, uriResource, STRING_HANDLE, keyName);
20 |
21 | MOCKABLE_FUNCTION(, HTTPAPIEX_SAS_HANDLE, HTTPAPIEX_SAS_Create_From_String, const char*, key, const char*, uriResource, const char*, keyName);
22 |
23 | MOCKABLE_FUNCTION(, void, HTTPAPIEX_SAS_Destroy, HTTPAPIEX_SAS_HANDLE, handle);
24 |
25 | MOCKABLE_FUNCTION(, HTTPAPIEX_RESULT, HTTPAPIEX_SAS_ExecuteRequest, HTTPAPIEX_SAS_HANDLE, sasHandle, HTTPAPIEX_HANDLE, handle, HTTPAPI_REQUEST_TYPE, requestType, const char*, relativePath, HTTP_HEADERS_HANDLE, requestHttpHeadersHandle, BUFFER_HANDLE, requestContent, unsigned int*, statusCode, HTTP_HEADERS_HANDLE, responseHeadersHandle, BUFFER_HANDLE, responseContent);
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif /* HTTPAPIEX_SAS_H */
32 |
--------------------------------------------------------------------------------