1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef HDC_COMMON_H 16 #define HDC_COMMON_H 17 18 #include <algorithm> 19 #include <assert.h> 20 #include <atomic> 21 #include <cctype> 22 #include <cinttypes> 23 #include <condition_variable> 24 #include <cstdarg> 25 #include <ctime> 26 #include <fcntl.h> 27 #include <functional> 28 #include <list> 29 #ifdef CONFIG_USE_JEMALLOC_DFX_INIF 30 #include <malloc.h> 31 #endif 32 #include <map> 33 #include <mutex> 34 #include <openssl/crypto.h> 35 #include <openssl/err.h> 36 #include <openssl/evp.h> 37 #include <openssl/objects.h> 38 #include <openssl/pem.h> 39 #include <openssl/rand.h> 40 #include <openssl/rsa.h> 41 #include <openssl/sha.h> 42 #include <openssl/ssl.h> 43 #include <queue> 44 #include <set> 45 #include <stdio.h> 46 #include <string> 47 #include <sys/types.h> 48 #include <unistd.h> 49 #include <unordered_set> 50 #include <vector> 51 52 using std::condition_variable; 53 using std::list; 54 using std::map; 55 using std::mutex; 56 using std::string; 57 using std::vector; 58 59 // clang-format off 60 #include <uv.h> // libuv 1.35 61 #ifdef HDC_HOST 62 63 #ifdef HARMONY_PROJECT 64 #include <libusb/libusb.h> 65 #else // NOT HARMONY_PROJECT 66 #include <libusb-1.0/libusb.h> 67 #endif // END HARMONY_PROJECT 68 69 #else // NOT HDC_HOST 70 #endif // HDC_HOST 71 72 #ifndef _WIN32 73 #include <sys/socket.h> 74 #include <sys/un.h> 75 #endif 76 77 #include <securec.h> 78 #include <limits.h> 79 80 #include "circle_buffer.h" 81 #include "define.h" 82 #include "debug.h" 83 #include "base.h" 84 #include "task.h" 85 #ifdef HDC_SUPPORT_ENCRYPT_TCP 86 #include "hdc_ssl.h" 87 #endif 88 #include "channel.h" 89 #include "session.h" 90 #include "auth.h" 91 92 #include "tcp.h" 93 #include "usb.h" 94 #ifdef HDC_SUPPORT_UART 95 #include "uart.h" 96 #endif 97 #include "file_descriptor.h" 98 99 // clang-format on 100 101 #endif // !defined(COMMON_H_INCLUDED) 102