1b1b8bc3fSopenharmony_ci/* 2b1b8bc3fSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 3b1b8bc3fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4b1b8bc3fSopenharmony_ci * you may not use this file except in compliance with the License. 5b1b8bc3fSopenharmony_ci * You may obtain a copy of the License at 6b1b8bc3fSopenharmony_ci * 7b1b8bc3fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8b1b8bc3fSopenharmony_ci * 9b1b8bc3fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10b1b8bc3fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11b1b8bc3fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12b1b8bc3fSopenharmony_ci * See the License for the specific language governing permissions and 13b1b8bc3fSopenharmony_ci * limitations under the License. 14b1b8bc3fSopenharmony_ci */ 15b1b8bc3fSopenharmony_ci 16b1b8bc3fSopenharmony_ci#ifndef NET_CONNECTION_COMMON_H 17b1b8bc3fSopenharmony_ci#define NET_CONNECTION_COMMON_H 18b1b8bc3fSopenharmony_ci 19b1b8bc3fSopenharmony_ci#include <cstdint> 20b1b8bc3fSopenharmony_ci 21b1b8bc3fSopenharmony_ci#ifdef __cplusplus 22b1b8bc3fSopenharmony_ci#define EXTERN_C_START extern "C" { 23b1b8bc3fSopenharmony_ci#define EXTERN_C_END } 24b1b8bc3fSopenharmony_ci#else 25b1b8bc3fSopenharmony_ci#define EXTERN_C_START 26b1b8bc3fSopenharmony_ci#define EXTERN_C_END 27b1b8bc3fSopenharmony_ci#endif 28b1b8bc3fSopenharmony_ci 29b1b8bc3fSopenharmony_ciEXTERN_C_START 30b1b8bc3fSopenharmony_cistruct CNetCapabilities { 31b1b8bc3fSopenharmony_ci int64_t bearedTypeSize; 32b1b8bc3fSopenharmony_ci int64_t networkCapSize; 33b1b8bc3fSopenharmony_ci uint32_t linkUpBandwidthKbps; 34b1b8bc3fSopenharmony_ci uint32_t linkDownBandwidthKbps; 35b1b8bc3fSopenharmony_ci int32_t *bearerTypes; 36b1b8bc3fSopenharmony_ci int32_t *networkCap; 37b1b8bc3fSopenharmony_ci}; 38b1b8bc3fSopenharmony_ci 39b1b8bc3fSopenharmony_cistruct CNetAddress { 40b1b8bc3fSopenharmony_ci char *address; 41b1b8bc3fSopenharmony_ci uint32_t family; 42b1b8bc3fSopenharmony_ci uint16_t port; 43b1b8bc3fSopenharmony_ci}; 44b1b8bc3fSopenharmony_ci 45b1b8bc3fSopenharmony_cistruct RetNetAddressArr { 46b1b8bc3fSopenharmony_ci int32_t code; 47b1b8bc3fSopenharmony_ci int64_t size; 48b1b8bc3fSopenharmony_ci CNetAddress *data; 49b1b8bc3fSopenharmony_ci}; 50b1b8bc3fSopenharmony_ci 51b1b8bc3fSopenharmony_cistruct CLinkAddress { 52b1b8bc3fSopenharmony_ci CNetAddress address; 53b1b8bc3fSopenharmony_ci int32_t prefixLength; 54b1b8bc3fSopenharmony_ci}; 55b1b8bc3fSopenharmony_ci 56b1b8bc3fSopenharmony_cistruct CRouteInfo { 57b1b8bc3fSopenharmony_ci char *interfaceName; 58b1b8bc3fSopenharmony_ci CLinkAddress destination; 59b1b8bc3fSopenharmony_ci CNetAddress gateway; 60b1b8bc3fSopenharmony_ci bool hasGateway; 61b1b8bc3fSopenharmony_ci bool isDefaultRoute; 62b1b8bc3fSopenharmony_ci}; 63b1b8bc3fSopenharmony_ci 64b1b8bc3fSopenharmony_cistruct CConnectionProperties { 65b1b8bc3fSopenharmony_ci char *interfaceName; 66b1b8bc3fSopenharmony_ci char *domains; 67b1b8bc3fSopenharmony_ci int64_t linkAddressSize; 68b1b8bc3fSopenharmony_ci int64_t dnsSize; 69b1b8bc3fSopenharmony_ci int64_t routeSize; 70b1b8bc3fSopenharmony_ci uint16_t mtu; 71b1b8bc3fSopenharmony_ci CLinkAddress *linkAddresses; 72b1b8bc3fSopenharmony_ci CNetAddress *dnses; 73b1b8bc3fSopenharmony_ci CRouteInfo *routes; 74b1b8bc3fSopenharmony_ci}; 75b1b8bc3fSopenharmony_ci 76b1b8bc3fSopenharmony_cistruct CNetSpecifier { 77b1b8bc3fSopenharmony_ci CNetCapabilities netCapabilities; 78b1b8bc3fSopenharmony_ci char *bearerPrivateIdentifier; 79b1b8bc3fSopenharmony_ci bool hasSpecifier; 80b1b8bc3fSopenharmony_ci}; 81b1b8bc3fSopenharmony_ci 82b1b8bc3fSopenharmony_cistruct CHttpProxy { 83b1b8bc3fSopenharmony_ci char *host; 84b1b8bc3fSopenharmony_ci uint16_t port; 85b1b8bc3fSopenharmony_ci char **exclusionList; 86b1b8bc3fSopenharmony_ci int64_t exclusionListSize; 87b1b8bc3fSopenharmony_ci}; 88b1b8bc3fSopenharmony_ci 89b1b8bc3fSopenharmony_cistruct CNetCapabilityInfo { 90b1b8bc3fSopenharmony_ci int32_t netHandle; 91b1b8bc3fSopenharmony_ci CNetCapabilities netCap; 92b1b8bc3fSopenharmony_ci}; 93b1b8bc3fSopenharmony_ciEXTERN_C_END 94b1b8bc3fSopenharmony_ci 95b1b8bc3fSopenharmony_ci#endif