• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef NET_CONN_TYPES_H
17 #define NET_CONN_TYPES_H
18 
19 namespace OHOS {
20 namespace NetManagerStandard {
21 constexpr int32_t MAX_IPV4_ADDRESS_LEN = 32;
22 
23 enum ResultCode {
24     ERR_NONE                                                        = 0,
25     ERR_SERVICE_REQUEST_SUCCESS                                     = (-1),
26     ERR_SERVICE_REQUEST_CONNECT_FAIL                                = (-2),
27     ERR_SERVICE_UPDATE_NET_LINK_INFO_FAIL                           = (-3),
28     ERR_SERVICE_CONNECTING                                          = (-4),
29     ERR_SERVICE_CONNECTED                                           = (-5),
30     ERR_SERVICE_DISCONNECTED_FAIL                                   = (-6),
31     ERR_SERVICE_DISCONNECTING                                       = (-7),
32     ERR_SERVICE_DISCONNECTED_SUCCESS                                = (-8),
33     ERR_SERVICE_NULL_PTR                                            = (-9),
34     ERR_NO_SUPPLIER                                                 = (-10),
35     ERR_NO_NETWORK                                                  = (-11),
36     ERR_INVALID_PARAMS                                              = (-12),
37     ERR_INVALID_NETORK_TYPE                                         = (-13),
38     ERR_SERVICE_UPDATE_NET_LINK_INFO_SUCCES                         = (-14),
39     ERR_NET_MONITOR_OPT_SUCCESS                                     = (-15),
40     ERR_NET_MONITOR_OPT_FAILED                                      = (-16),
41     ERR_NET_SUPPLIER_NO_API                                         = (-17),
42     ERR_NET_TYPE_NOT_FOUND                                          = (-18),
43     ERR_NO_ANY_NET_TYPE                                             = (-19),
44     ERR_NO_REGISTERED                                               = (-20),
45     ERR_NET_HOST_EMPTY                                              = (-21),
46     ERR_SERVICE_NO_REQUEST                                          = (-22),
47     ERR_NO_ADDRESS                                                  = (-23),
48     ERR_NET_FIND_BESTNETWORK_FOR_REQUEST                            = (-24),
49     ERR_NET_NOT_FIND_BESTNETWORK_FOR_REQUEST                        = (-25),
50     ERR_NET_NOT_FIND_REQUEST_ID                                     = (-26),
51     ERR_NET_NOT_FIND_NETID                                          = (-27),
52     ERR_VPN                                                         = (-28),
53     ERR_NET_DEFAULTNET_NOT_EXIST                                    = (-29),
54     ERR_NET_NO_RESTRICT_BACKGROUND                                  = (-30),
55     ERR_NET_OVER_MAX_REQUEST_NUM                                    = (-31),
56     ERR_REGISTER_THE_SAME_CALLBACK                                  = (-32),
57     ERR_UNREGISTER_CALLBACK_NOT_FOUND                               = (-33),
58     ERR_PERMISSION_CHECK_FAIL                                       = (-34)
59 };
60 
61 enum NetMonitorResponseCode {
62     OK = 200,
63     CREATED = 201,
64     NO_CONTENT = 204,
65     URL_REDIRECT_MAX = 399,
66     BAD_REQUEST = 400,
67     CLIENT_ERROR_MAX = 499
68 };
69 
70 enum NetDetectionStatus {
71     INVALID_DETECTION_STATE,
72     VERIFICATION_STATE,
73     CAPTIVE_PORTAL_STATE
74 };
75 using NetDetectionStateHandler = std::function<void(NetDetectionStatus netDetectionState,
76     const std::string &urlRedirect)>;
77 } // namespace NetManagerStandard
78 } // namespace OHOS
79 #endif // NET_CONN_TYPES_H
80