• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025-2026 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 NETWORKSLICE_NET_CONN_CALLBACK_H
17 #define NETWORKSLICE_NET_CONN_CALLBACK_H
18 
19 #include "net_conn_callback_stub.h"
20 
21 namespace OHOS {
22 namespace NetManagerStandard {
23 using NetManagerStandard::NetConnCallbackStub;
24 using NetManagerStandard::NetHandle;
25 using NetManagerStandard::NetAllCapabilities;
26 using NetManagerStandard::NetLinkInfo;
27 
28 class NetConnCallback : public NetConnCallbackStub {
29 public:
30     int32_t NetAvailable(sptr<NetHandle> &netHandle) override;
31     int32_t NetLost(sptr<NetHandle> &netHandle) override;
32     int32_t NetUnavailable() override;
33 
34     void SetNetCap(NetCap netCap);
35     void CacheRequestUid(int32_t uid);
36     void RemoveRequestUid(int32_t uid);
37     std::set<int32_t> GetRequestUids();
38     void SetUid(int32_t uid);
39     int32_t GetUid();
40     int32_t GetNetId();
41     NetCap GetNetCap();
42 private:
43     NetCap mNetCap_ { NET_CAPABILITY_END };
44     std::set<int32_t> mRequestUids_;
45     int32_t mUid_;
46     int32_t netId_;
47 };
48 
49 } // namespace NetMgrEnhanced
50 } // namespace OHOS
51 #endif
52