18e745fdaSopenharmony_ci/*
28e745fdaSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
38e745fdaSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48e745fdaSopenharmony_ci * you may not use this file except in compliance with the License.
58e745fdaSopenharmony_ci * You may obtain a copy of the License at
68e745fdaSopenharmony_ci *
78e745fdaSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88e745fdaSopenharmony_ci *
98e745fdaSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108e745fdaSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118e745fdaSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128e745fdaSopenharmony_ci * See the License for the specific language governing permissions and
138e745fdaSopenharmony_ci * limitations under the License.
148e745fdaSopenharmony_ci */
158e745fdaSopenharmony_ci
168e745fdaSopenharmony_ci#ifndef VPN_DATABASE_DEFINES_H
178e745fdaSopenharmony_ci#define VPN_DATABASE_DEFINES_H
188e745fdaSopenharmony_ci
198e745fdaSopenharmony_ci#include <map>
208e745fdaSopenharmony_ci#include <string>
218e745fdaSopenharmony_ci
228e745fdaSopenharmony_cinamespace OHOS {
238e745fdaSopenharmony_cinamespace NetManagerStandard {
248e745fdaSopenharmony_cinamespace VpnDatabaseDefines {
258e745fdaSopenharmony_cistatic std::string VPN_DATABASE_PATH = "/data/service/el1/public/vpn/";
268e745fdaSopenharmony_ciconstexpr const char *VPN_DB_NAME = "vpn_data.db";
278e745fdaSopenharmony_ciconstexpr const char *VPN_CONFIG_TABLE_CREATE_PARAM = "vpnId TEXT PRIMARY KEY NOT NULL,"
288e745fdaSopenharmony_ci    "vpnName TEXT NOT NULL,"
298e745fdaSopenharmony_ci    "vpnType INTEGER NOT NULL,"
308e745fdaSopenharmony_ci    "vpnAddress TEXT NOT NULL,"
318e745fdaSopenharmony_ci    "userName TEXT NOT NULL,"
328e745fdaSopenharmony_ci    "password TEXT NOT NULL,"
338e745fdaSopenharmony_ci    "userId INTEGER NOT NULL,"
348e745fdaSopenharmony_ci    "isLegacy INTEGER NOT NULL,"
358e745fdaSopenharmony_ci    "saveLogin INTEGER NOT NULL,"
368e745fdaSopenharmony_ci    "forwardingRoutes TEXT NOT NULL,"
378e745fdaSopenharmony_ci    "dnsAddresses TEXT NOT NULL,"
388e745fdaSopenharmony_ci    "searchDomains TEXT NOT NULL,"
398e745fdaSopenharmony_ci    "ovpnPort TEXT NOT NULL,"
408e745fdaSopenharmony_ci    "ovpnProtocol INTEGER NOT NULL,"
418e745fdaSopenharmony_ci    "ovpnConfig TEXT NOT NULL,"
428e745fdaSopenharmony_ci    "ovpnAuthType INTEGER NOT NULL,"
438e745fdaSopenharmony_ci    "askpass TEXT NOT NULL,"
448e745fdaSopenharmony_ci    "ovpnConfigFilePath TEXT NOT NULL,"
458e745fdaSopenharmony_ci    "ovpnCaCertFilePath TEXT NOT NULL,"
468e745fdaSopenharmony_ci    "ovpnUserCertFilePath TEXT NOT NULL,"
478e745fdaSopenharmony_ci    "ovpnPrivateKeyFilePath TEXT NOT NULL,"
488e745fdaSopenharmony_ci    "ipsecPreSharedKey TEXT NOT NULL,"
498e745fdaSopenharmony_ci    "ipsecIdentifier TEXT NOT NULL,"
508e745fdaSopenharmony_ci    "swanctlConf TEXT NOT NULL,"
518e745fdaSopenharmony_ci    "strongswanConf TEXT NOT NULL,"
528e745fdaSopenharmony_ci    "ipsecCaCertConf TEXT NOT NULL,"
538e745fdaSopenharmony_ci    "ipsecPrivateUserCertConf TEXT NOT NULL,"
548e745fdaSopenharmony_ci    "ipsecPublicUserCertConf TEXT NOT NULL,"
558e745fdaSopenharmony_ci    "ipsecPrivateServerCertConf TEXT NOT NULL,"
568e745fdaSopenharmony_ci    "ipsecPublicServerCertConf TEXT NOT NULL,"
578e745fdaSopenharmony_ci    "ipsecCaCertFilePath TEXT NOT NULL,"
588e745fdaSopenharmony_ci    "ipsecPrivateUserCertFilePath TEXT NOT NULL,"
598e745fdaSopenharmony_ci    "ipsecPublicUserCertFilePath TEXT NOT NULL,"
608e745fdaSopenharmony_ci    "ipsecPrivateServerCertFilePath TEXT NOT NULL,"
618e745fdaSopenharmony_ci    "ipsecPublicServerCertFilePath TEXT NOT NULL,"
628e745fdaSopenharmony_ci    "ipsecConf TEXT NOT NULL,"
638e745fdaSopenharmony_ci    "ipsecSecrets TEXT NOT NULL,"
648e745fdaSopenharmony_ci    "optionsL2tpdClient TEXT NOT NULL,"
658e745fdaSopenharmony_ci    "xl2tpdConf TEXT NOT NULL,"
668e745fdaSopenharmony_ci    "l2tpSharedKey TEXT NOT NULL";
678e745fdaSopenharmony_ci
688e745fdaSopenharmony_ciconst std::string VPN_CONFIG_TABLE = "T_vpn_config";
698e745fdaSopenharmony_ci
708e745fdaSopenharmony_ciconstexpr int32_t VPN_CONFIG_TABLE_PARAM_NUM = 40;
718e745fdaSopenharmony_ci
728e745fdaSopenharmony_ciconstexpr int32_t DATABASE_OPEN_VERSION = 1;
738e745fdaSopenharmony_ci
748e745fdaSopenharmony_ciconst std::string VPN_ID = "vpnId";
758e745fdaSopenharmony_ciconst std::string VPN_NAME = "vpnName";
768e745fdaSopenharmony_ciconst std::string VPN_TYPE = "vpnType";
778e745fdaSopenharmony_ciconst std::string VPN_ADDRESS = "vpnAddress";
788e745fdaSopenharmony_ciconst std::string USER_NAME = "userName";
798e745fdaSopenharmony_ciconst std::string PASSWORD = "password";
808e745fdaSopenharmony_ciconst std::string USER_ID = "userId";
818e745fdaSopenharmony_ciconst std::string VPN_IS_LEGACY = "isLegacy";
828e745fdaSopenharmony_ciconst std::string VPN_SAVE_LOGIN = "saveLogin";
838e745fdaSopenharmony_ciconst std::string VPN_FORWARDED_ROUTES = "forwardingRoutes";
848e745fdaSopenharmony_ciconst std::string VPN_DNS_ADDRESSES = "dnsAddresses";
858e745fdaSopenharmony_ciconst std::string VPN_SEARCH_DOMAINS = "searchDomains";
868e745fdaSopenharmony_ci
878e745fdaSopenharmony_ciconst std::string OPENVPN_PORT = "ovpnPort";
888e745fdaSopenharmony_ciconst std::string OPENVPN_PROTOCOL = "ovpnProtocol";
898e745fdaSopenharmony_ciconst std::string OPENVPN_CFG = "ovpnConfig";
908e745fdaSopenharmony_ciconst std::string OPENVPN_AUTH_TYPE = "ovpnAuthType";
918e745fdaSopenharmony_ciconst std::string OPENVPN_ASKPASS = "askpass";
928e745fdaSopenharmony_ciconst std::string OPENVPN_CFG_FILE_PATH = "ovpnConfigFilePath";
938e745fdaSopenharmony_ciconst std::string OPENVPN_CA_CERT_FILE_PATH = "ovpnCaCertFilePath";
948e745fdaSopenharmony_ciconst std::string OPENVPN_USER_CERT_FILE_PATH = "ovpnUserCertFilePath";
958e745fdaSopenharmony_ciconst std::string OPENVPN_PRIVATE_KEY_FILE_PATH = "ovpnPrivateKeyFilePath";
968e745fdaSopenharmony_ci
978e745fdaSopenharmony_ciconst std::string IPSEC_PRE_SHARE_KEY = "ipsecPreSharedKey";
988e745fdaSopenharmony_ciconst std::string IPSEC_IDENTIFIER = "ipsecIdentifier";
998e745fdaSopenharmony_ciconst std::string SWANCTL_CONF = "swanctlConf";
1008e745fdaSopenharmony_ciconst std::string STRONGSWAN_CONF = "strongswanConf";
1018e745fdaSopenharmony_ciconst std::string IPSEC_CA_CERT_CONF = "ipsecCaCertConf";
1028e745fdaSopenharmony_ciconst std::string IPSEC_PRIVATE_USER_CERT_CONF = "ipsecPrivateUserCertConf";
1038e745fdaSopenharmony_ciconst std::string IPSEC_PUBLIC_USER_CERT_CONF = "ipsecPublicUserCertConf";
1048e745fdaSopenharmony_ciconst std::string IPSEC_PRIVATE_SERVER_CERT_CONF = "ipsecPrivateServerCertConf";
1058e745fdaSopenharmony_ciconst std::string IPSEC_PUBLIC_SERVER_CERT_CONF = "ipsecPublicServerCertConf";
1068e745fdaSopenharmony_ciconst std::string IPSEC_CA_CERT_FILE_PATH = "ipsecCaCertFilePath";
1078e745fdaSopenharmony_ciconst std::string IPSEC_PRIVATE_USER_CERT_FILE_PATH = "ipsecPrivateUserCertFilePath";
1088e745fdaSopenharmony_ciconst std::string IPSEC_PUBLIC_USER_CERT_FILE_PATH = "ipsecPublicUserCertFilePath";
1098e745fdaSopenharmony_ciconst std::string IPSEC_PRIVATE_SERVER_CERT_FILE_PATH = "ipsecPrivateServerCertFilePath";
1108e745fdaSopenharmony_ciconst std::string IPSEC_PUBLIC_SERVER_CERT_FILE_PATH = "ipsecPublicServerCertFilePath";
1118e745fdaSopenharmony_ci
1128e745fdaSopenharmony_ciconst std::string IPSEC_CONF = "ipsecConf";
1138e745fdaSopenharmony_ciconst std::string IPSEC_SECRETS = "ipsecSecrets";
1148e745fdaSopenharmony_ciconst std::string OPTIONS_L2TPD_CLIENT = "optionsL2tpdClient";
1158e745fdaSopenharmony_ciconst std::string XL2TPD_CONF = "xl2tpdConf";
1168e745fdaSopenharmony_ciconst std::string L2TP_SHARED_KEY = "l2tpSharedKey";
1178e745fdaSopenharmony_ci
1188e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_ID = 0;
1198e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_NAME = 1;
1208e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_TYPE = 2;
1218e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_ADDRESS = 3;
1228e745fdaSopenharmony_ciconstexpr int32_t INDEX_USER_NAME = 4;
1238e745fdaSopenharmony_ciconstexpr int32_t INDEX_PASSWORD = 5;
1248e745fdaSopenharmony_ciconstexpr int32_t INDEX_USER_ID = 6;
1258e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_IS_LEGACY = 7;
1268e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_SAVE_LOGIN = 8;
1278e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_FORWARDED_ROUTES = 9;
1288e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_DNS_ADDRESSES = 10;
1298e745fdaSopenharmony_ciconstexpr int32_t INDEX_VPN_SEARCH_DOMAINS = 11;
1308e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_PORT = 12;
1318e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_PROTOCOL = 13;
1328e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_CFG = 14;
1338e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_AUTH_TYPE = 15;
1348e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_ASKPASS = 16;
1358e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_CFG_FILE_PATH = 17;
1368e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_CA_CERT_FILE_PATH = 18;
1378e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_USER_CERT_FILE_PATH = 19;
1388e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPENVPN_PRIVATE_KEY_FILE_PATH = 20;
1398e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PRE_SHARE_KEY = 21;
1408e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_IDENTIFIER = 22;
1418e745fdaSopenharmony_ciconstexpr int32_t INDEX_SWANCTL_CONF = 23;
1428e745fdaSopenharmony_ciconstexpr int32_t INDEX_STRONGSWAN_CONF = 24;
1438e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_CA_CERT_CONF = 25;
1448e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PRIVATE_USER_CERT_CONF = 26;
1458e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PUBLIC_USER_CERT_CONF = 27;
1468e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PRIVATE_SERVER_CERT_CONF = 28;
1478e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PUBLIC_SERVER_CERT_CONF = 29;
1488e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_CA_CERT_FILE_PATH = 30;
1498e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PRIVATE_USER_CERT_FILE_PATH = 31;
1508e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PUBLIC_USER_CERT_FILE_PATH = 32;
1518e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PRIVATE_SERVER_CERT_FILE_PATH = 33;
1528e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_PUBLIC_SERVER_CERT_FILE_PATH = 34;
1538e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_CONF = 35;
1548e745fdaSopenharmony_ciconstexpr int32_t INDEX_IPSEC_SECRETS = 36;
1558e745fdaSopenharmony_ciconstexpr int32_t INDEX_OPTIONS_L2TPD_CLIENT = 37;
1568e745fdaSopenharmony_ciconstexpr int32_t INDEX_XL2TPD_CONF = 38;
1578e745fdaSopenharmony_ciconstexpr int32_t INDEX_L2TP_SHARED_KEY = 39;
1588e745fdaSopenharmony_ci} // namespace VpnDatabaseDefines
1598e745fdaSopenharmony_ci} // namespace NetManagerStandard
1608e745fdaSopenharmony_ci} // namespace OHOS
1618e745fdaSopenharmony_ci
1628e745fdaSopenharmony_ci#endif // VPN_DATABASE_DEFINES_H
163