From b68c4683ae6b470d0b56fcf70ea2616301d5bf6c Mon Sep 17 00:00:00 2001 From: estkme <145633413+estkme@users.noreply.github.com> Date: Mon, 30 Oct 2023 21:55:14 +0800 Subject: [PATCH] functional es11 discovery --- euicc/es9p.c | 8 ++++++-- euicc/es9p.h | 1 + src/main.c | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/euicc/es9p.c b/euicc/es9p.c index 6860c7a..3e2d4c4 100644 --- a/euicc/es9p.c +++ b/euicc/es9p.c @@ -30,10 +30,14 @@ static int es9p_trans_ex(struct euicc_ctx *ctx, const char *url, const char *url strcat(full_url, url_prefix); strcat(full_url, url); strcat(full_url, url_postfix); + // printf("url: %s\n", full_url); + // printf("tx: %s\n", str_tx); if (ctx->interface.http->transmit(full_url, &rcode_mearged, &rbuf, &rlen, str_tx, strlen(str_tx)) < 0) { goto err; } + // printf("rcode: %d\n", rcode_mearged); + // printf("rx: %s\n", rbuf); free(full_url); full_url = NULL; @@ -262,12 +266,12 @@ int es9p_cancel_session(struct euicc_ctx *ctx, const char *smdp, const char *tra int es11_authenticate_client(struct euicc_ctx *ctx, const char *smds, const char *transaction_id, const char *b64_authenticate_server_response, struct es11_authenticate_client_resp *resp) { - cJSON *j_arr_events; const char *ikey[] = {"transactionId", "authenticateServerResponse", NULL}; const char *idata[] = {transaction_id, b64_authenticate_server_response, NULL}; const char *okey[] = {"eventEntries", NULL}; const char oobj[] = {1}; - void **optr[] = {(void **)&j_arr_events, NULL}; + void **optr[] = {(void **)&resp->cjson_array_result, NULL}; + resp->cjson_array_result = NULL; return es9p_trans_json(ctx, smds, "/gsma/rsp2/es9plus/authenticateClient", ikey, idata, okey, oobj, optr, &resp->status); } diff --git a/euicc/es9p.h b/euicc/es9p.h index 458fccc..94ad85d 100644 --- a/euicc/es9p.h +++ b/euicc/es9p.h @@ -29,6 +29,7 @@ struct es9p_authenticate_client_resp struct es11_authenticate_client_resp { char *status; + void *cjson_array_result; }; int es9p_initiate_authentication(struct euicc_ctx *ctx, const char *smdp, const char *b64_euicc_challenge, const char *b64_euicc_info_1, struct es9p_initiate_authentication_resp *resp); diff --git a/src/main.c b/src/main.c index d3247bb..2c14db6 100644 --- a/src/main.c +++ b/src/main.c @@ -716,6 +716,9 @@ static int entry_discovery(void) jprint_error("es11_authenticate_client", es11_authenticate_client_resp.status); return -1; } + + jprint_success((cJSON *)es11_authenticate_client_resp.cjson_array_result); + return 0; } int main(int argc, char **argv)