1 /*
2  * Copyright (c) 2024 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 #ifndef NETMANAGER_BASE_NET_PROXY_USERINFO_H
16 #define NETMANAGER_BASE_NET_PROXY_USERINFO_H
17 
18 #include <string>
19 
20 #include "http_proxy.h"
21 #include "rdb_errno.h"
22 #include "rdb_helper.h"
23 #include "rdb_open_callback.h"
24 #include "rdb_store.h"
25 #include "rdb_store_config.h"
26 #include "rdb_types.h"
27 
28 namespace OHOS {
29 namespace NetManagerStandard {
30 class DataBaseRdbOpenCallBack : public NativeRdb::RdbOpenCallback {
31 public:
32     int32_t OnCreate(NativeRdb::RdbStore &rdbStore) override;
33 
34     int32_t OnOpen(NativeRdb::RdbStore &rdbStore) override;
35 
36     int32_t OnUpgrade(NativeRdb::RdbStore &rdbStore, int32_t currentVersion, int32_t targetVersion) override;
37 };
38 
39 class NetProxyUserinfo {
40 public:
41     ~NetProxyUserinfo() = default;
42 
43     NetProxyUserinfo();
44 
45     void SaveHttpProxyHostPass(const HttpProxy &httpProxy);
46 
47     void GetHttpProxyHostPass(HttpProxy &httpProxy);
48 
49     static NetProxyUserinfo &GetInstance();
50 
51     NetProxyUserinfo(const NetProxyUserinfo &other) = default;
52 
53 private:
54     NetProxyUserinfo &operator=(const NetProxyUserinfo &) = delete;
55 
56     std::shared_ptr<NativeRdb::RdbStore> rdbStore_;
57 };
58 } // namespace NetManagerStandard
59 } // namespace OHOS
60 #endif // NETMANAGER_BASE_NET_PROXY_USERINFO_H