• 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_ALL_CAPABILITIES_H
17 #define NET_ALL_CAPABILITIES_H
18 
19 #include <set>
20 
21 #include "parcel.h"
22 
23 namespace OHOS {
24 namespace NetManagerStandard {
25 enum NetCap {
26     NET_CAPABILITY_MMS = 0,
27     NET_CAPABILITY_SUPL = 1,
28     NET_CAPABILITY_DUN = 2,
29     NET_CAPABILITY_IA = 3,
30     NET_CAPABILITY_XCAP = 4,
31     NET_CAPABILITY_BIP = 5,
32     NET_CAPABILITY_NOT_METERED = 11,
33     NET_CAPABILITY_INTERNET = 12,
34     NET_CAPABILITY_NOT_VPN = 15,
35     NET_CAPABILITY_VALIDATED = 16,
36     NET_CAPABILITY_PORTAL = 17,
37     NET_CAPABILITY_INTERNAL_DEFAULT = 18, // for inner virtual interface if needed.
38     NET_CAPABILITY_SNSSAI1 = 19,
39     NET_CAPABILITY_SNSSAI2 = 20,
40     NET_CAPABILITY_SNSSAI3 = 21,
41     NET_CAPABILITY_SNSSAI4 = 22,
42     NET_CAPABILITY_SNSSAI5 = 23,
43     NET_CAPABILITY_SNSSAI6 = 24,
44     NET_CAPABILITY_CHECKING_CONNECTIVITY = 31,
45     NET_CAPABILITY_END = 32 // The maximum value is 32. Do not exceed the limit.
46 };
47 
48 enum ProxyModeType {
49     PROXY_MODE_OFF = 0,
50     PROXY_MODE_AUTO = 1
51 };
52 
53 enum NetBearType {
54     BEARER_CELLULAR = 0,
55     BEARER_WIFI = 1,
56     BEARER_BLUETOOTH = 2,
57     BEARER_ETHERNET = 3,
58     BEARER_VPN = 4,
59     BEARER_WIFI_AWARE = 5,
60     BEARER_DEFAULT // The maximum value of NetBearType. Do not exceed the limit. No actual meaning.
61 };
62 
63 #define NET_SYMBOL_VISIBLE __attribute__ ((visibility("default")))
64 struct NET_SYMBOL_VISIBLE NetAllCapabilities final : public Parcelable {
65     uint32_t linkUpBandwidthKbps_ = 0;
66     uint32_t linkDownBandwidthKbps_ = 0;
67     std::set<NetCap> netCaps_;
68     std::set<NetBearType> bearerTypes_;
69 
70     NetAllCapabilities() = default;
71     NetAllCapabilities(const NetAllCapabilities &cap);
72     NetAllCapabilities &operator=(const NetAllCapabilities &cap);
73 
74     bool CapsIsValid() const;
75     bool CapsIsNull() const;
76     bool Marshalling(Parcel &parcel) const override;
77     bool Unmarshalling(Parcel &parcel);
78     std::string ToString(const std::string &tab) const;
79 
80 private:
81     void ToStrNetCaps(const std::set<NetCap> &netCaps, std::string &str) const;
82     void ToStrNetBearTypes(const std::set<NetBearType> &bearerTypes, std::string &str) const;
83 };
84 } // namespace NetManagerStandard
85 } // namespace OHOS
86 #endif // NET_ALL_CAPABILITIES_H
87