1 /*
2  * Copyright (c) 2022 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 
16 #ifndef COMMUNICATION_NETSTACK_SOCKET_ERROR_H
17 #define COMMUNICATION_NETSTACK_SOCKET_ERROR_H
18 
19 #include <string>
20 #include <map>
21 
22 namespace OHOS {
23 namespace NetStack {
24 namespace TlsSocket {
25 enum TlsSocketError {
26     TLSSOCKET_SUCCESS = 0,
27     SYSTEM_INTERNAL_ERROR = 2300002,
28     TLS_ERR_SYS_BASE = 2303100,
29     TLS_ERR_SYS_EINTR = 2303104,
30     TLS_ERR_SYS_EIO = 2303105,
31     TLS_ERR_SYS_EBADF = 2303109,
32     TLS_ERR_SYS_EAGAIN = 2303111,
33     TLS_ERR_SYS_EACCES = 2303113,
34     TLS_ERR_SYS_EFAULT = 2303114,
35     TLS_ERR_SYS_EINVAL = 2303122,
36     TLS_ERR_SYS_ENOTSOCK = 2303188,
37     TLS_ERR_SYS_EPROTOTYPE = 2303191,
38     TLS_ERR_SYS_EADDRINUSE = 2303198,
39     TLS_ERR_SYS_EADDRNOTAVAIL = 2303199,
40     TLS_ERR_SYS_ENOTCONN = 2303207,
41     TLS_ERR_SYS_ETIMEDOUT = 2303210,
42     TLS_ERR_SSL_BASE = 2303500,
43     TLS_ERR_SSL_NULL = 2303501,
44     TLS_ERR_WANT_READ = 2303502,
45     TLS_ERR_WANT_WRITE = 2303503,
46     TLS_ERR_WANT_X509_LOOKUP = 2303504,
47     TLS_ERR_SYSCALL = 2303505,
48     TLS_ERR_ZERO_RETURN = 2303506,
49     TLS_ERR_WANT_CONNECT = 2303507,
50     TLS_ERR_WANT_ACCEPT = 2303508,
51     TLS_ERR_WANT_ASYNC = 2303509,
52     TLS_ERR_WANT_ASYNC_JOB = 2303510,
53     TLS_ERR_WANT_CLIENT_HELLO_CB = 2303511,
54     TLS_ERR_NO_BIND = 2303600,
55     TLS_ERR_SOCK_INVALID_FD = 2303601,
56     TLS_ERR_SOCK_NOT_CONNECT = 2303602,
57 };
58 
59 std::string MakeErrorMessage(int error);
60 } // namespace TlsSocket
61 } // namespace NetStack
62 } // namespace OHOS
63 #endif // COMMUNICATION_NETSTACK_SOCKET_ERROR_H
64