b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 1 | #include <stdio.h>
|
| 2 | #include <stdlib.h>
|
| 3 | #include <string.h>
|
| 4 | #include <sys/socket.h>
|
| 5 | #include <netinet/in.h>
|
| 6 | #include <arpa/inet.h>
|
| 7 | #include "lynq_data.h"
|
| 8 | #include "lynq_qser_data.h"
|
| 9 | #include "data.h"
|
| 10 | #define TEST_RESULT "lynq_result="
|
| 11 |
|
| 12 | // int init_data(int argc, char *argv[], int sp_test)
|
| 13 | // {
|
| 14 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 15 | // int ret = -1;
|
| 16 | // int uToken = atoi(argv[1]);
|
| 17 | // ret = lynq_init_data(uToken);
|
| 18 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 19 | // return ret;
|
| 20 | // }
|
| 21 | // int deinit_data(int argc, char *argv[], int sp_test)
|
| 22 | // {
|
| 23 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 24 | // int ret = -1;
|
| 25 | // ret = lynq_deinit_data();
|
| 26 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 27 | // return ret;
|
| 28 | // }
|
| 29 | // int setup_data_call(int argc, char *argv[], int sp_test)
|
| 30 | // {
|
| 31 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 32 | // int ret = -1;
|
| 33 | // int handle = atoi(argv[1]);
|
| 34 |
|
| 35 | // ret = lynq_setup_data_call(&handle);
|
| 36 |
|
| 37 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 38 | // printf("handle = %d\n", handle);
|
| 39 | // return ret;
|
| 40 | // }
|
| 41 | // int deactivte_data_call(int argc, char *argv[], int sp_test)
|
| 42 | // {
|
| 43 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 44 | // int ret = -1;
|
| 45 | // int handle = atoi(argv[1]);
|
| 46 |
|
| 47 | // ret = lynq_deactive_data_call(&handle);
|
| 48 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 49 | // return ret;
|
| 50 | // }
|
| 51 | // int wait_data_call(int argc, char *argv[], int sp_test)
|
| 52 | // {
|
| 53 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 54 | // int ret = -1;
|
| 55 | // int handle = atoi(argv[1]);
|
| 56 |
|
| 57 | // ret = lynq_wait_data_call_state_change(&handle);
|
| 58 | // printf("LYNQ_WAIT_DATA_CALL: handle = %d\n", handle);
|
| 59 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 60 | // return ret;
|
| 61 | // }
|
| 62 | // int setup_data_call_sp(int argc, char *argv[], int sp_test)
|
| 63 | // {
|
| 64 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 65 | // int ret = -1;
|
| 66 | // int flag = atoi(argv[5]);
|
| 67 | // int handle = atoi(argv[1]);
|
| 68 |
|
| 69 | // ret = lynq_setup_data_call_sp(&handle, argv[2], argv[3], NULL, NULL, NULL, argv[4], NULL);
|
| 70 |
|
| 71 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 72 | // printf("handle = %d\n", handle);
|
| 73 | // return ret;
|
| 74 | // }
|
| 75 | // int get_data_call_list(int argc, char *argv[], int sp_test)
|
| 76 | // {
|
| 77 | // printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 78 | // int ret = -1;
|
| 79 | // int handle = atoi(argv[1]);
|
| 80 | // lynq_data_call_response_v11_t dataCallList = {-1, -1, -1, -1,"", "", "", "", "", "", -1};
|
| 81 |
|
| 82 | // ret = lynq_get_data_call_list(&handle, &dataCallList);
|
| 83 |
|
| 84 | // printf("LYNQ_GET_DATA_CALL_LIST: handle = %d\n", handle);
|
| 85 | // printf("LYNQ_GET_DATA_CALL_LIST: status=%d, suggestedRetryTime=%d, cid=%d, active=%d, type=%s, ifname=%s, addresses=%s, dnses=%s, gateways=%s, pcscf=%s, mtu=%d\n",
|
| 86 | // dataCallList.status, dataCallList.suggestedRetryTime, dataCallList.cid, dataCallList.active,
|
| 87 | // dataCallList.type, dataCallList.ifname, dataCallList.addresses, dataCallList.dnses, dataCallList.gateways, dataCallList.pcscf,
|
| 88 | // dataCallList.mtu);
|
| 89 | // printf("%s%d\n",TEST_RESULT,ret);
|
| 90 | // return ret;
|
| 91 | // }
|
| 92 | //=====================================QSER-DATA=========================================================
|
| 93 |
|
| 94 | qser_data_call_state_s state = {0};
|
| 95 | void evt_cb(qser_data_call_state_s *state)
|
| 96 | {
|
| 97 | char buf_ip[64] = {0};
|
| 98 | char buf_gateway[64] = {0};
|
| 99 | char buf_pri_dns[64] = {0};
|
| 100 | char buf_sec_dns[64] = {0};
|
| 101 | printf("LYNQ_QSER_DATA_INIT: profile_idx=%d, name=%s, ip_family=%d, state=%d, error=%d\n"
|
| 102 | , state->profile_idx, state->name, state->ip_family, state->state, state->err);
|
| 103 | printf("LYNQ_QSER_DATA_INIT: v4.ip=%s\n"
|
| 104 | , inet_ntoa(state->v4.ip));
|
| 105 | printf("LYNQ_QSER_DATA_INIT: v4.gateway=%s\n"
|
| 106 | , inet_ntoa(state->v4.gateway));
|
| 107 | printf("LYNQ_QSER_DATA_INIT: v4.pri_dns=%s\n"
|
| 108 | , inet_ntoa(state->v4.pri_dns));
|
| 109 | printf("LYNQ_QSER_DATA_INIT: v4.sec_dns=%s\n"
|
| 110 | , inet_ntoa(state->v4.sec_dns));
|
| 111 | inet_ntop(AF_INET6, &(state->v6.ip), buf_ip, sizeof(buf_ip));
|
| 112 | inet_ntop(AF_INET6, &(state->v6.gateway), buf_gateway, sizeof(buf_gateway));
|
| 113 | inet_ntop(AF_INET6, &(state->v6.pri_dns), buf_pri_dns, sizeof(buf_pri_dns));
|
| 114 | inet_ntop(AF_INET6, &(state->v6.sec_dns), buf_sec_dns, sizeof(buf_sec_dns));
|
| 115 | printf("LYNQ_QSER_DATA_INIT: v6.ip=%s, v6.gateway=%s, v6.pri_dns=%s, v6.sec_dns=%s\n"
|
| 116 | , buf_ip, buf_gateway, buf_pri_dns, buf_sec_dns);
|
| 117 | }
|
| 118 |
|
| 119 | int qser_init_data(int argc, char *argv[], int sp_test)
|
| 120 | {
|
| 121 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 122 | int ret = -1;
|
| 123 | int uToken = atoi(argv[1]);
|
| 124 | ret = qser_data_call_init(evt_cb);
|
| 125 | printf("%s%d\n",TEST_RESULT,ret);
|
| 126 | return ret;
|
| 127 | }
|
| 128 |
|
| 129 | int qser_deinit_data(int argc, char *argv[], int sp_test)
|
| 130 | {
|
| 131 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 132 |
|
| 133 | qser_data_call_destroy();
|
| 134 | printf("LYNQ_QSER_DATA_DEINIT end\n");
|
| 135 | return 0;
|
| 136 | }
|
| 137 | int qser_setup_data_call(int argc, char *argv[], int sp_test)
|
| 138 | {
|
| 139 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 140 | int ret = -1;
|
| 141 | qser_data_call_s datacall;
|
| 142 | qser_data_call_error_e err = QSER_DATA_CALL_ERROR_NONE;
|
| 143 | int ip_family_flag = atoi(argv[3]);
|
| 144 |
|
| 145 | datacall.profile_idx = atoi(argv[1]);
|
| 146 | datacall.reconnect = (bool)atoi(argv[2]);
|
| 147 |
|
| 148 | if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV4") == 0)
|
| 149 | {
|
| 150 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV4;
|
| 151 | }
|
| 152 | else if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV6") == 0)
|
| 153 | {
|
| 154 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV6;
|
| 155 | }
|
| 156 | else if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV4V6") == 0)
|
| 157 | {
|
| 158 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 159 | }
|
| 160 | else
|
| 161 | {
|
| 162 | printf("LYNQ_QSER_SETUP_DATA_CALL: ip_family input error\n");
|
| 163 | return ret;
|
| 164 | }
|
| 165 |
|
| 166 | memcpy(datacall.cdma_username, argv[4], QSER_APN_USERNAME_SIZE);
|
| 167 | memcpy(datacall.cdma_password, argv[5], QSER_APN_PASSWORD_SIZE);
|
| 168 |
|
| 169 | ret = qser_data_call_start(&datacall, &err);
|
| 170 | printf("LYNQ_QSER_SETUP_DATA_CALL err = %d\n", err);
|
| 171 | printf("%s%d\n",TEST_RESULT,ret);
|
| 172 | return ret;
|
| 173 | }
|
| 174 | int qser_setup_data_call_async(int argc, char *argv[], int sp_test)
|
| 175 | {
|
| 176 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 177 | int ret = -1;
|
| 178 | qser_data_call_s datacall;
|
| 179 | qser_data_call_error_e err = QSER_DATA_CALL_ERROR_NONE;
|
| 180 | int ip_family_flag = atoi(argv[3]);
|
| 181 |
|
| 182 | datacall.profile_idx = atoi(argv[1]);
|
| 183 | datacall.reconnect = (bool)atoi(argv[2]);
|
| 184 |
|
| 185 | if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV4") == 0)
|
| 186 | {
|
| 187 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV4;
|
| 188 | }
|
| 189 | else if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV6") == 0)
|
| 190 | {
|
| 191 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV6;
|
| 192 | }
|
| 193 | else if(strcmp(argv[3], "QSER_DATA_CALL_TYPE_IPV4V6") == 0)
|
| 194 | {
|
| 195 | datacall.ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 196 | }
|
| 197 | else
|
| 198 | {
|
| 199 | printf("LYNQ_QSER_SETUP_DATA_CALL_ASYNC: ip_family input error\n");
|
| 200 | return ret;
|
| 201 | }
|
| 202 |
|
| 203 | memcpy(datacall.cdma_username, argv[4], QSER_APN_USERNAME_SIZE);
|
| 204 | memcpy(datacall.cdma_password, argv[5], QSER_APN_PASSWORD_SIZE);
|
| 205 |
|
| 206 | ret = qser_data_call_start_async(&datacall, &err);
|
| 207 | printf("LYNQ_QSER_SETUP_DATA_CALL_ASYNC err = %d\n", err);
|
| 208 | printf("%s%d\n",TEST_RESULT,ret);
|
| 209 | return ret;
|
| 210 | }
|
| 211 | int qser_deactivte_data_call(int argc, char *argv[], int sp_test)
|
| 212 | {
|
| 213 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 214 | int ret = -1;
|
| 215 | int profile_idx_int = atoi(argv[1]);
|
| 216 | qser_data_call_ip_family_e ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 217 | qser_data_call_error_e err = QSER_DATA_CALL_ERROR_NONE;
|
| 218 |
|
| 219 | if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV4") == 0)
|
| 220 | {
|
| 221 | ip_family = QSER_DATA_CALL_TYPE_IPV4;
|
| 222 | }
|
| 223 | else if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV6") == 0)
|
| 224 | {
|
| 225 | ip_family = QSER_DATA_CALL_TYPE_IPV6;
|
| 226 | }
|
| 227 | else if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV4V6") == 0)
|
| 228 | {
|
| 229 | ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 230 | }
|
| 231 | else
|
| 232 | {
|
| 233 | printf("LYNQ_QSER_DEACTIVATE_DATA_CALL: ip_family input error\n");
|
| 234 | return ret;
|
| 235 | }
|
| 236 |
|
| 237 | ret = qser_data_call_stop(profile_idx_int, ip_family, &err);
|
| 238 | printf("LYNQ_QSER_DEACTIVATE_DATA_CALL err = %d\n", err);
|
| 239 | printf("%s%d\n",TEST_RESULT,ret);
|
| 240 | return ret;
|
| 241 | }
|
| 242 | int qser_get_data_call_list(int argc, char *argv[], int sp_test)
|
| 243 | {
|
| 244 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 245 | int ret = -1;
|
| 246 | char buf_ip[64] = {0};
|
| 247 | char buf_gateway[64] = {0};
|
| 248 | char buf_pri_dns[64] = {0};
|
| 249 | char buf_sec_dns[64] = {0};
|
| 250 | qser_data_call_info_s info = {0};
|
| 251 | int profile_idx_int = atoi(argv[1]);
|
| 252 | qser_data_call_error_e err = QSER_DATA_CALL_ERROR_NONE;
|
| 253 | qser_data_call_ip_family_e ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 254 |
|
| 255 | if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV4") == 0)
|
| 256 | {
|
| 257 | ip_family = QSER_DATA_CALL_TYPE_IPV4;
|
| 258 | }
|
| 259 | else if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV6") == 0)
|
| 260 | {
|
| 261 | ip_family = QSER_DATA_CALL_TYPE_IPV6;
|
| 262 | }
|
| 263 | else if(strcmp(argv[2], "QSER_DATA_CALL_TYPE_IPV4V6") == 0)
|
| 264 | {
|
| 265 | ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
|
| 266 | }
|
| 267 | else
|
| 268 | {
|
| 269 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: ip_family input error\n");
|
| 270 | return ret;
|
| 271 | }
|
| 272 |
|
| 273 | ret = qser_data_call_info_get(profile_idx_int, ip_family, &info, &err);
|
| 274 | printf("%s%d\n",TEST_RESULT,ret);
|
| 275 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: error=%d, profile_idx=%d, ip_family=%d\n", err, info.profile_idx, info.ip_family);
|
| 276 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v4.name=%s, v4.state=%d, v4.reconnect=%d\n", info.v4.name, info.v4.state, info.v4.reconnect);
|
| 277 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v4.ip=%s\n"
|
| 278 | , inet_ntoa(info.v4.addr.ip));
|
| 279 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v4.gateway=%s\n"
|
| 280 | , inet_ntoa(info.v4.addr.gateway));
|
| 281 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v4.pri_dns=%s\n"
|
| 282 | , inet_ntoa(info.v4.addr.pri_dns));
|
| 283 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v4.sec_dns=%s\n"
|
| 284 | , inet_ntoa(info.v4.addr.sec_dns));
|
| 285 |
|
| 286 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v6.name=%s, v6.state=%d, v6.reconnect=%d\n", info.v6.name, info.v6.state, info.v6.reconnect);
|
| 287 | inet_ntop(AF_INET6, &(info.v6.addr.ip), buf_ip, sizeof(buf_ip));
|
| 288 | inet_ntop(AF_INET6, &(info.v6.addr.gateway), buf_gateway, sizeof(buf_gateway));
|
| 289 | inet_ntop(AF_INET6, &(info.v6.addr.pri_dns), buf_pri_dns, sizeof(buf_pri_dns));
|
| 290 | inet_ntop(AF_INET6, &(info.v6.addr.sec_dns), buf_sec_dns, sizeof(buf_sec_dns));
|
| 291 | printf("LYNQ_QSER_GET_DATA_CALL_LIST: v6.ip=%s, v6.gateway=%s, v6.pri_dns=%s, v6.sec_dns=%s\n"
|
| 292 | , buf_ip, buf_gateway, buf_pri_dns, buf_sec_dns);
|
| 293 | return ret;
|
| 294 | }
|
| 295 |
|
| 296 | int lynq_qser_apn_set(int argc, char *argv[], int sp_test)
|
| 297 | {
|
| 298 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 299 | int ret = -1;
|
b.liu | 9736dad | 2025-05-14 19:15:19 +0800 | [diff] [blame] | 300 | qser_apn_info_s apn = {'1', QSER_APN_PDP_TYPE_IPV4V6, QSER_APN_AUTH_PROTO_DEFAULT, {0}, {0}, {0}, {0}};
|
b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 301 |
|
| 302 | apn.profile_idx = atoi(argv[1]);
|
| 303 | //set pdptype
|
| 304 | if(strcmp(argv[2], "QSER_APN_PDP_TYPE_IPV4") == 0)
|
| 305 | {
|
| 306 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV4;
|
| 307 | }
|
| 308 | else if(strcmp(argv[2], "QSER_APN_PDP_TYPE_PPP") == 0)
|
| 309 | {
|
| 310 | apn.pdp_type = QSER_APN_PDP_TYPE_PPP;
|
| 311 | }
|
| 312 | else if(strcmp(argv[2], "QSER_APN_PDP_TYPE_IPV6") == 0)
|
| 313 | {
|
| 314 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV6;
|
| 315 | }
|
| 316 | else if(strcmp(argv[2], "QSER_APN_PDP_TYPE_IPV4V6") == 0)
|
| 317 | {
|
| 318 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV4V6;
|
| 319 | }
|
| 320 | else
|
| 321 | {
|
| 322 | printf("LYNQ_QSER_APN_SET: pdp_type input error\n");
|
| 323 | return ret;
|
| 324 | }
|
| 325 | //set auth_proto
|
| 326 | if(strcmp(argv[3], "QSER_APN_AUTH_PROTO_DEFAULT") == 0)
|
| 327 | {
|
| 328 | apn.auth_proto = QSER_APN_AUTH_PROTO_DEFAULT;
|
| 329 | }
|
| 330 | else if(strcmp(argv[3], "QSER_APN_AUTH_PROTO_NONE") == 0)
|
| 331 | {
|
| 332 | apn.auth_proto = QSER_APN_AUTH_PROTO_NONE;
|
| 333 | }
|
| 334 | else if(strcmp(argv[3], "QSER_APN_AUTH_PROTO_PAP") == 0)
|
| 335 | {
|
| 336 | apn.auth_proto = QSER_APN_AUTH_PROTO_PAP;
|
| 337 | }
|
| 338 | else if(strcmp(argv[3], "QSER_APN_AUTH_PROTO_CHAP") == 0)
|
| 339 | {
|
| 340 | apn.auth_proto = QSER_APN_AUTH_PROTO_CHAP;
|
| 341 | }
|
| 342 | else if(strcmp(argv[3], "QSER_APN_AUTH_PROTO_PAP_CHAP") == 0)
|
| 343 | {
|
| 344 | apn.auth_proto = QSER_APN_AUTH_PROTO_PAP_CHAP;
|
| 345 | }
|
| 346 | else
|
| 347 | {
|
| 348 | printf("LYNQ_QSER_APN_SET: auth_proto input error\n");
|
| 349 | return ret;
|
| 350 | }
|
| 351 | memcpy(apn.apn_name,argv[4],QSER_APN_NAME_SIZE);
|
| 352 | memcpy(apn.username,argv[5],QSER_APN_USERNAME_SIZE);
|
| 353 | memcpy(apn.password,argv[6],QSER_APN_PASSWORD_SIZE);
|
| 354 | memcpy(apn.apn_type,argv[7],QSER_APN_NAME_SIZE);
|
| 355 | ret = qser_apn_set(&apn);
|
| 356 | printf("%s%d\n",TEST_RESULT,ret);
|
| 357 | return ret;
|
| 358 | }
|
| 359 | int lynq_qser_apn_get(int argc, char *argv[], int sp_test)
|
| 360 | {
|
| 361 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 362 | int ret = -1;
|
| 363 | qser_apn_info_s apn = {0};
|
| 364 | int profile_idx_int = atoi(argv[1]);
|
| 365 | ret = qser_apn_get(profile_idx_int, &apn);
|
| 366 | printf("%s%d\n",TEST_RESULT,ret);
|
| 367 | printf("LYNQ_QSER_APN_GET: pdp_type=%d, auth_proto=%d, apn_name=%s, username=%s, password=%s, apn_type=%s\n"
|
| 368 | ,apn.pdp_type, apn.auth_proto, apn.apn_name, apn.username, apn.password, apn.apn_type);
|
| 369 | return ret;
|
| 370 | }
|
| 371 | int lynq_qser_apn_add(int argc, char *argv[], int sp_test)
|
| 372 | {
|
| 373 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 374 | int ret = -1;
|
| 375 | unsigned char profile_idx_char;
|
b.liu | 9736dad | 2025-05-14 19:15:19 +0800 | [diff] [blame] | 376 | qser_apn_add_s apn = {QSER_APN_PDP_TYPE_IPV4V6, QSER_APN_AUTH_PROTO_DEFAULT, "cmnet", {0}, {0}, {0}};
|
b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 377 |
|
| 378 | if(strcmp(argv[1], "QSER_APN_PDP_TYPE_IPV4") == 0)
|
| 379 | {
|
| 380 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV4;
|
| 381 | }
|
| 382 | else if(strcmp(argv[1], "QSER_APN_PDP_TYPE_PPP") == 0)
|
| 383 | {
|
| 384 | apn.pdp_type = QSER_APN_PDP_TYPE_PPP;
|
| 385 | }
|
| 386 | else if(strcmp(argv[1], "QSER_APN_PDP_TYPE_IPV6") == 0)
|
| 387 | {
|
| 388 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV6;
|
| 389 | }
|
| 390 | else if(strcmp(argv[1], "QSER_APN_PDP_TYPE_IPV4V6") == 0)
|
| 391 | {
|
| 392 | apn.pdp_type = QSER_APN_PDP_TYPE_IPV4V6;
|
| 393 | }
|
| 394 | else
|
| 395 | {
|
| 396 | printf("LYNQ_QSER_APN_ADD: pdp_type input error\n");
|
| 397 | return ret;
|
| 398 | }
|
| 399 | //set auth_proto
|
| 400 | if(strcmp(argv[2], "QSER_APN_AUTH_PROTO_DEFAULT") == 0)
|
| 401 | {
|
| 402 | apn.auth_proto = QSER_APN_AUTH_PROTO_DEFAULT;
|
| 403 | }
|
| 404 | else if(strcmp(argv[2], "QSER_APN_AUTH_PROTO_NONE") == 0)
|
| 405 | {
|
| 406 | apn.auth_proto = QSER_APN_AUTH_PROTO_NONE;
|
| 407 | }
|
| 408 | else if(strcmp(argv[2], "QSER_APN_AUTH_PROTO_PAP") == 0)
|
| 409 | {
|
| 410 | apn.auth_proto = QSER_APN_AUTH_PROTO_PAP;
|
| 411 | }
|
| 412 | else if(strcmp(argv[2], "QSER_APN_AUTH_PROTO_CHAP") == 0)
|
| 413 | {
|
| 414 | apn.auth_proto = QSER_APN_AUTH_PROTO_CHAP;
|
| 415 | }
|
| 416 | else if(strcmp(argv[2], "QSER_APN_AUTH_PROTO_PAP_CHAP") == 0)
|
| 417 | {
|
| 418 | apn.auth_proto = QSER_APN_AUTH_PROTO_PAP_CHAP;
|
| 419 | }
|
| 420 | else
|
| 421 | {
|
| 422 | printf("LYNQ_QSER_APN_ADD: auth_proto input error\n");
|
| 423 | return ret;
|
| 424 | }
|
| 425 |
|
| 426 | memcpy(apn.apn_name,argv[3],QSER_APN_NAME_SIZE);
|
| 427 | memcpy(apn.username,argv[4],QSER_APN_USERNAME_SIZE);
|
| 428 | memcpy(apn.password,argv[5],QSER_APN_PASSWORD_SIZE);
|
| 429 | memcpy(apn.apn_type,argv[6],QSER_APN_NAME_SIZE);
|
| 430 |
|
| 431 | printf("LYNQ_QSER_APN_ADD: ready to qser_apn_add\n");
|
| 432 | ret = qser_apn_add(&apn, &profile_idx_char);
|
| 433 | printf("%s%d,profile = %d\n",TEST_RESULT,ret,profile_idx_char);
|
| 434 | return ret;
|
| 435 | }
|
| 436 | int lynq_qser_apn_del(int argc, char *argv[], int sp_test)
|
| 437 | {
|
| 438 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 439 | int ret = -1;
|
| 440 | int profile_idx_int = atoi(argv[1]);
|
| 441 | ret = qser_apn_del(profile_idx_int);
|
| 442 | printf("%s%d\n",TEST_RESULT,ret);
|
| 443 | return ret;
|
| 444 | }
|
| 445 | int lynq_qser_apn_get_list(int argc, char *argv[], int sp_test)
|
| 446 | {
|
| 447 | printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
|
| 448 | int ret = -1;
|
| 449 | qser_apn_info_list_s apn_list = {0};
|
| 450 | ret = qser_apn_get_list(&apn_list);
|
| 451 | printf("%s%d\n",TEST_RESULT,ret);
|
| 452 | for(int i = 0; i < apn_list.cnt; i++)
|
| 453 | {
|
| 454 | printf("LYNQ_QSER_APN_GET_LIST: profile_idx=%d, pdp_type=%d, auth_proto=%d, apn_name=%s, username=%s, password=%s, apn_type=%s\n"
|
| 455 | ,apn_list.apn[i].profile_idx, apn_list.apn[i].pdp_type, apn_list.apn[i].auth_proto, apn_list.apn[i].apn_name, apn_list.apn[i].username, apn_list.apn[i].password, apn_list.apn[i].apn_type);
|
| 456 | }
|
| 457 | return ret;
|
| 458 | }
|