• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 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 constexpr int32_t STATE_ENTER_FORCESLEEP = 0x30;
24 constexpr int32_t STATE_EXIT_FORCESLEEP = 0x31;
25 constexpr int32_t STATE_ENTER_SLEEP_NOT_FORCE = 0x40;
26 constexpr int32_t STATE_EXIT_SLEEP_NOT_FORCE = 0x41;
27 
28 enum NetMonitorResponseCode {
29     OK = 200,
30     CREATED = 201,
31     NO_CONTENT = 204,
32     URL_REDIRECT_MAX = 399,
33     BAD_REQUEST = 400,
34     CLIENT_ERROR_MAX = 499
35 };
36 
37 enum NetDetectionStatus {
38     UNKNOWN_STATE,
39     INVALID_DETECTION_STATE,
40     VERIFICATION_STATE,
41     CAPTIVE_PORTAL_STATE,
42     QUALITY_POOR_STATE,
43     QUALITY_NORMAL_STATE,
44     QUALITY_GOOD_STATE,
45     ACCEPT_UNVALIDATED
46 };
47 using NetDetectionStateHandler = std::function<void(NetDetectionStatus netDetectionState,
48     const std::string &urlRedirect)>;
49 } // namespace NetManagerStandard
50 } // namespace OHOS
51 #endif // NET_CONN_TYPES_H
52