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 OHOS_AT_DATA_H 17 #define OHOS_AT_DATA_H 18 19 #include <stddef.h> 20 #include <stdint.h> 21 22 #include "hril_vendor_data_defs.h" 23 24 #define NET_NODE "usb0" 25 26 // Default maxTransferUnit value 27 #define DEFAULT_MTU 0 28 29 #define MAX_CID 11 // GU is 1~16 (currently only 11 is supported, and it can be expanded to 16 in the future). 30 #define MIN_CID 1 // GU is 1~16 (currently only 11 is supported, and it can be expanded to 16 in the future). 31 #define MAX_PDP_NUM 11 32 33 #define ACTIVATE 1 34 #define DEACTIVATE 0 35 36 #define ADDR_MASK 0xFF 37 #define ADDR_OFFSET_0BIT 0 38 #define ADDR_OFFSET_8BIT 8 39 #define ADDR_OFFSET_16BIT 16 40 #define ADDR_OFFSET_24BIT 24 41 #define ADDR_OFFSET_32BIT 32 42 #define IVP4_INDEX_MAX 4 43 44 #define DELAY_WAIT_MS (1000 * 1000) 45 46 #define DEFAULT_CID (-1) 47 48 #define QUERY_MAX_COUNT 6 49 #define QUERY_DELAY_MS 500 50 #define DELAY_US_OFFSET 1000 51 52 #define CALLBACK_DELAY_MS 50 53 54 #define VERIFY_TYPE_MIN 0 55 #define VERIFY_TYPE_MAX 2 56 57 /* 3GPP TS 27.007 V17.3.0 (2021-09) 58 * Mobile termination error result code +CME ERROR */ 59 typedef enum { 60 PDP_CME_ERR_INCORRECT_PASSWORD = 16, /* incorrect password */ 61 PDP_CME_ERR_NO_NETWORK_SERVICE = 30, /* no network service */ 62 PDP_CME_ERR_INCORRECT_PARAMETERS = 50, /* Incorrect parameters */ 63 PDP_CME_ERR_ROAMING_NOT_ALLOWED = 113, /* Roaming not allowed in this location area */ 64 PDP_CME_ERR_NETWORK_FAILURE = 117, /* Network failure */ 65 PDP_CME_ERR_SHORTAGE_RESOURCES = 126, /* Insufficient resources */ 66 PDP_CME_ERR_MISSING_OR_UNKNOWN_APN = 127, /* Missing or unknown APN */ 67 PDP_CME_ERR_UNKNOWN_PDP_ADDR_OR_TYPE = 128, /* Unknown PDP address or PDP type */ 68 PDP_CME_ERR_USER_VERIFICATION = 129, /* User authentication or authorization failed */ 69 PDP_CME_ERR_ACTIVATION_REJECTED_GGSN = 130, /* Activation rejected by GGSN, Serving GW or PDN GW */ 70 PDP_CME_ERR_SERVICE_ACTIVATION_REJECTED_UNSPECIFIED = 131, /* Activation rejected, unspecified */ 71 PDP_CME_ERR_SERVICE_OPTION_NOT_SUPPORTED = 132, /* Service option not supported */ 72 PDP_CME_ERR_SERVICE_OPTION_NOT_SUBSCRIBED = 133, /* Requested service option not subscribed */ 73 PDP_CME_ERR_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER = 134, /* Service option temporarily out of order */ 74 PDP_CME_ERR_NSAPI_ALREADY_USED = 135, /* NSAPI already used */ 75 PDP_CME_ERR_REGULAR_DEACTIVATION = 136, /* Regular deactivation */ 76 PDP_CME_ERR_UNKNOWN_PDP_CONTEXT = 143, /* Unknown PDP context */ 77 PDP_CME_ERR_PROTOCOL_ERRORS = 176, /* Protocol error, unspecified */ 78 PDP_CME_ERR_OPERATOR_DETERMINED_BARRING = 177, /* Operator Determined Barring */ 79 PDP_CME_ERR_NO_PDP_CONTEXT_ACTIVATED = 185, /* No PDP context activated */ 80 PDP_CME_ERR_IPV4_ONLY_ALLOWED = 192, /* PDP type IPv4 only allowed */ 81 PDP_CME_ERR_IPV6_ONLY_ALLOWED = 193, /* PDP type IPv6 only allowed */ 82 PDP_CME_ERR_IPV4V6_ONLY_ALLOWED = 196, /* PDP type IPv4v6 only allowed */ 83 PDP_CME_ERR_NON_IP_ONLY_ALLOWED = 197, /* PDP type non IP only allowed */ 84 PDP_CME_ERR_MULT_ACCESSES_PDN_NOT_ALLOWED = 200, /* Multiple accesses to a PDN connection not allowed */ 85 } ModemErrorCode; 86 87 typedef struct { 88 int32_t cid; 89 char *ipType; 90 char *apn; 91 } PDNInfo; 92 93 void ReqSetInitApnInfo(const ReqDataInfo *requestInfo, const HRilDataInfo *data); 94 void ReqActivatePdpContext(const ReqDataInfo *requestInfo, const HRilDataInfo *data); 95 void ReqDeactivatePdpContext(const ReqDataInfo *requestInfo, const HRilDataInfo *data); 96 void ReqGetPdpContextList(const ReqDataInfo *requestInfo); 97 void ReqGetLinkBandwidthInfo(const ReqDataInfo *requestInfo, const int32_t cid); 98 void ReqSetLinkBandwidthReportingRule(const ReqDataInfo *requestInfo, const HRilLinkBandwidthReportingRule *data); 99 void PdpContextListUpdate(void); 100 #endif // OHOS_AT_DATA_H 101