laforge has submitted this change. (
https://gerrit.osmocom.org/c/onomondo-ipa/+/43054?usp=email )
Change subject: V1.2: Add function ES10b.GetConnectivityParameters
......................................................................
V1.2: Add function ES10b.GetConnectivityParameters
Add new library function to get connectivity parameters from IoT eUICC.
Also add an option to the command line interface to call the library
function.
The function cannot be emulated with non-IoT eUICC.
Reference: SGP.32 Section 5.9.24
Related: SYS#8101
Change-Id: I075590e095dbbe05fa6cdb0a96d5b38c7a17ff78
---
M asn1/SGP32Definitions.asn
M include/onomondo/ipa/ipad.h
M src/ipa/libasn/CMakeLists.txt
A src/ipa/libasn/ConnectivityParameters.c
A src/ipa/libasn/ConnectivityParameters.h
A src/ipa/libasn/ConnectivityParametersError.c
A src/ipa/libasn/ConnectivityParametersError.h
A src/ipa/libasn/GetConnectivityParametersRequest.c
A src/ipa/libasn/GetConnectivityParametersRequest.h
A src/ipa/libasn/GetConnectivityParametersResponse.c
A src/ipa/libasn/GetConnectivityParametersResponse.h
M src/ipa/libipa/CMakeLists.txt
A src/ipa/libipa/es10b_get_conn_params.c
A src/ipa/libipa/es10b_get_conn_params.h
M src/ipa/libipa/ipad.c
M src/ipa/main.c
16 files changed, 589 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/asn1/SGP32Definitions.asn b/asn1/SGP32Definitions.asn
index c3fea8c..becc11b 100644
--- a/asn1/SGP32Definitions.asn
+++ b/asn1/SGP32Definitions.asn
@@ -723,6 +723,25 @@
}
-- ASN1STOP
+-- Section 5.9.24
+-- ASN1START
+GetConnectivityParametersRequest ::= [95] SEQUENCE { -- Tag 'BF5F'
+}
+-- ASN1STOP
+-- ASN1START
+GetConnectivityParametersResponse ::= [95] CHOICE { -- Tag 'BF5F'
+ connectivityParameters ConnectivityParameters,
+ connectivityParametersError ConnectivityParametersError
+}
+ConnectivityParameters ::= SEQUENCE {
+ httpParams [1] OCTET STRING OPTIONAL -- Also used for CoAP
+}
+ConnectivityParametersError ::= INTEGER {
+ parametersNotAvailable(1),
+ undefinedError(127)
+}
+-- ASN1STOP
+
-- Section 5.9.25
-- ASN1START
SGP32-SetDefaultDpAddressRequest ::= [101] SEQUENCE { -- Tag 'BF65'
diff --git a/include/onomondo/ipa/ipad.h b/include/onomondo/ipa/ipad.h
index e356f45..42086fa 100644
--- a/include/onomondo/ipa/ipad.h
+++ b/include/onomondo/ipa/ipad.h
@@ -98,6 +98,7 @@
int ipa_return_from_fallback(struct ipa_context *ctx);
int ipa_enable_emerg_prfle(struct ipa_context *ctx);
int ipa_disable_emerg_prfle(struct ipa_context *ctx);
+int ipa_get_connnectivity_parameters(struct ipa_context *ctx, struct ipa_buf
**http_params);
int ipa_poll(struct ipa_context *ctx);
void ipa_close(struct ipa_context *ctx);
struct ipa_buf *ipa_free_ctx(struct ipa_context *ctx);
diff --git a/src/ipa/libasn/CMakeLists.txt b/src/ipa/libasn/CMakeLists.txt
index 82328de..b1f9d8a 100644
--- a/src/ipa/libasn/CMakeLists.txt
+++ b/src/ipa/libasn/CMakeLists.txt
@@ -194,6 +194,10 @@
ConfigureImmediateProfileEnablingResponse.h
ConfigureISDPRequest.c
ConfigureISDPRequest.h
+ConnectivityParameters.c
+ConnectivityParametersError.c
+ConnectivityParametersError.h
+ConnectivityParameters.h
constraints.c
constraints.h
constr_CHOICE.c
@@ -411,6 +415,10 @@
GetCertsRequest.h
GetCertsResponse.c
GetCertsResponse.h
+GetConnectivityParametersRequest.c
+GetConnectivityParametersRequest.h
+GetConnectivityParametersResponse.c
+GetConnectivityParametersResponse.h
GetEimConfigurationDataRequest.c
GetEimConfigurationDataRequest.h
GetEimConfigurationDataResponse.c
diff --git a/src/ipa/libasn/ConnectivityParameters.c
b/src/ipa/libasn/ConnectivityParameters.c
new file mode 100644
index 0000000..37c2e43
--- /dev/null
+++ b/src/ipa/libasn/ConnectivityParameters.c
@@ -0,0 +1,52 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "ConnectivityParameters.h"
+
+asn_TYPE_member_t asn_MBR_ConnectivityParameters_1[] = {
+ { ATF_POINTER, 1, offsetof(struct ConnectivityParameters, httpParams),
+ (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_OCTET_STRING,
+ 0,
+ { 0, 0, 0 },
+ 0, 0, /* No default value */
+ "httpParams"
+ },
+};
+static const int asn_MAP_ConnectivityParameters_oms_1[] = { 0 };
+static const ber_tlv_tag_t asn_DEF_ConnectivityParameters_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_ConnectivityParameters_tag2el_1[] =
{
+ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 } /* httpParams */
+};
+asn_SEQUENCE_specifics_t asn_SPC_ConnectivityParameters_specs_1 = {
+ sizeof(struct ConnectivityParameters),
+ offsetof(struct ConnectivityParameters, _asn_ctx),
+ asn_MAP_ConnectivityParameters_tag2el_1,
+ 1, /* Count of tags in the map */
+ asn_MAP_ConnectivityParameters_oms_1, /* Optional members */
+ 1, 0, /* Root/Additions */
+ 1, /* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_ConnectivityParameters = {
+ "ConnectivityParameters",
+ "ConnectivityParameters",
+ &asn_OP_SEQUENCE,
+ asn_DEF_ConnectivityParameters_tags_1,
+ sizeof(asn_DEF_ConnectivityParameters_tags_1)
+ /sizeof(asn_DEF_ConnectivityParameters_tags_1[0]), /* 1 */
+ asn_DEF_ConnectivityParameters_tags_1, /* Same as above */
+ sizeof(asn_DEF_ConnectivityParameters_tags_1)
+ /sizeof(asn_DEF_ConnectivityParameters_tags_1[0]), /* 1 */
+ { 0, 0, SEQUENCE_constraint },
+ asn_MBR_ConnectivityParameters_1,
+ 1, /* Elements count */
+ &asn_SPC_ConnectivityParameters_specs_1 /* Additional specs */
+};
+
diff --git a/src/ipa/libasn/ConnectivityParameters.h
b/src/ipa/libasn/ConnectivityParameters.h
new file mode 100644
index 0000000..7174cea
--- /dev/null
+++ b/src/ipa/libasn/ConnectivityParameters.h
@@ -0,0 +1,44 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _ConnectivityParameters_H_
+#define _ConnectivityParameters_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <OCTET_STRING.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ConnectivityParameters */
+typedef struct ConnectivityParameters {
+ OCTET_STRING_t *httpParams /* OPTIONAL */;
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} ConnectivityParameters_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ConnectivityParameters;
+extern asn_SEQUENCE_specifics_t asn_SPC_ConnectivityParameters_specs_1;
+extern asn_TYPE_member_t asn_MBR_ConnectivityParameters_1[1];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ConnectivityParameters_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libasn/ConnectivityParametersError.c
b/src/ipa/libasn/ConnectivityParametersError.c
new file mode 100644
index 0000000..c42280c
--- /dev/null
+++ b/src/ipa/libasn/ConnectivityParametersError.c
@@ -0,0 +1,31 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "ConnectivityParametersError.h"
+
+/*
+ * This type is implemented using NativeInteger,
+ * so here we adjust the DEF accordingly.
+ */
+static const ber_tlv_tag_t asn_DEF_ConnectivityParametersError_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
+};
+asn_TYPE_descriptor_t asn_DEF_ConnectivityParametersError = {
+ "ConnectivityParametersError",
+ "ConnectivityParametersError",
+ &asn_OP_NativeInteger,
+ asn_DEF_ConnectivityParametersError_tags_1,
+ sizeof(asn_DEF_ConnectivityParametersError_tags_1)
+ /sizeof(asn_DEF_ConnectivityParametersError_tags_1[0]), /* 1 */
+ asn_DEF_ConnectivityParametersError_tags_1, /* Same as above */
+ sizeof(asn_DEF_ConnectivityParametersError_tags_1)
+ /sizeof(asn_DEF_ConnectivityParametersError_tags_1[0]), /* 1 */
+ { 0, 0, NativeInteger_constraint },
+ 0, 0, /* Defined elsewhere */
+ 0 /* No specifics */
+};
+
diff --git a/src/ipa/libasn/ConnectivityParametersError.h
b/src/ipa/libasn/ConnectivityParametersError.h
new file mode 100644
index 0000000..92f24b5
--- /dev/null
+++ b/src/ipa/libasn/ConnectivityParametersError.h
@@ -0,0 +1,49 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _ConnectivityParametersError_H_
+#define _ConnectivityParametersError_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <NativeInteger.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum ConnectivityParametersError {
+ ConnectivityParametersError_parametersNotAvailable = 1,
+ ConnectivityParametersError_undefinedError = 127
+} e_ConnectivityParametersError;
+
+/* ConnectivityParametersError */
+typedef long ConnectivityParametersError_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ConnectivityParametersError;
+asn_struct_free_f ConnectivityParametersError_free;
+asn_struct_print_f ConnectivityParametersError_print;
+asn_constr_check_f ConnectivityParametersError_constraint;
+ber_type_decoder_f ConnectivityParametersError_decode_ber;
+der_type_encoder_f ConnectivityParametersError_encode_der;
+xer_type_decoder_f ConnectivityParametersError_decode_xer;
+xer_type_encoder_f ConnectivityParametersError_encode_xer;
+oer_type_decoder_f ConnectivityParametersError_decode_oer;
+oer_type_encoder_f ConnectivityParametersError_encode_oer;
+per_type_decoder_f ConnectivityParametersError_decode_uper;
+per_type_encoder_f ConnectivityParametersError_encode_uper;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ConnectivityParametersError_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libasn/GetConnectivityParametersRequest.c
b/src/ipa/libasn/GetConnectivityParametersRequest.c
new file mode 100644
index 0000000..2abebd7
--- /dev/null
+++ b/src/ipa/libasn/GetConnectivityParametersRequest.c
@@ -0,0 +1,36 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "GetConnectivityParametersRequest.h"
+
+static const ber_tlv_tag_t asn_DEF_GetConnectivityParametersRequest_tags_1[] =
{
+ (ASN_TAG_CLASS_CONTEXT | (95 << 2)),
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static asn_SEQUENCE_specifics_t
asn_SPC_GetConnectivityParametersRequest_specs_1 = {
+ sizeof(struct GetConnectivityParametersRequest),
+ offsetof(struct GetConnectivityParametersRequest, _asn_ctx),
+ 0, /* No top level tags */
+ 0, /* No tags in the map */
+ 0, 0, 0, /* Optional elements (not needed) */
+ -1, /* First extension addition */
+};
+asn_TYPE_descriptor_t asn_DEF_GetConnectivityParametersRequest = {
+ "GetConnectivityParametersRequest",
+ "GetConnectivityParametersRequest",
+ &asn_OP_SEQUENCE,
+ asn_DEF_GetConnectivityParametersRequest_tags_1,
+ sizeof(asn_DEF_GetConnectivityParametersRequest_tags_1)
+ /sizeof(asn_DEF_GetConnectivityParametersRequest_tags_1[0]) -
1, /* 1 */
+ asn_DEF_GetConnectivityParametersRequest_tags_1, /* Same as
above */
+ sizeof(asn_DEF_GetConnectivityParametersRequest_tags_1)
+ /sizeof(asn_DEF_GetConnectivityParametersRequest_tags_1[0]), /*
2 */
+ { 0, 0, SEQUENCE_constraint },
+ 0, 0, /* No members */
+ &asn_SPC_GetConnectivityParametersRequest_specs_1 /* Additional
specs */
+};
+
diff --git a/src/ipa/libasn/GetConnectivityParametersRequest.h
b/src/ipa/libasn/GetConnectivityParametersRequest.h
new file mode 100644
index 0000000..70c4c8f
--- /dev/null
+++ b/src/ipa/libasn/GetConnectivityParametersRequest.h
@@ -0,0 +1,40 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _GetConnectivityParametersRequest_H_
+#define _GetConnectivityParametersRequest_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GetConnectivityParametersRequest */
+typedef struct GetConnectivityParametersRequest {
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} GetConnectivityParametersRequest_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_GetConnectivityParametersRequest;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GetConnectivityParametersRequest_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libasn/GetConnectivityParametersResponse.c
b/src/ipa/libasn/GetConnectivityParametersResponse.c
new file mode 100644
index 0000000..a7b547a
--- /dev/null
+++ b/src/ipa/libasn/GetConnectivityParametersResponse.c
@@ -0,0 +1,70 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#include "GetConnectivityParametersResponse.h"
+
+static asn_oer_constraints_t
asn_OER_type_GetConnectivityParametersResponse_constr_1 CC_NOTUSED = {
+ { 0, 0 },
+ -1};
+static asn_per_constraints_t
asn_PER_type_GetConnectivityParametersResponse_constr_1 CC_NOTUSED = {
+ { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...)
*/,
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ 0, 0 /* No PER value map */
+};
+static asn_TYPE_member_t asn_MBR_GetConnectivityParametersResponse_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct GetConnectivityParametersResponse,
choice.connectivityParameters),
+ (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_ConnectivityParameters,
+ 0,
+ { 0, 0, 0 },
+ 0, 0, /* No default value */
+ "connectivityParameters"
+ },
+ { ATF_NOFLAGS, 0, offsetof(struct GetConnectivityParametersResponse,
choice.connectivityParametersError),
+ (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_ConnectivityParametersError,
+ 0,
+ { 0, 0, 0 },
+ 0, 0, /* No default value */
+ "connectivityParametersError"
+ },
+};
+static const ber_tlv_tag_t asn_DEF_GetConnectivityParametersResponse_tags_1[]
= {
+ (ASN_TAG_CLASS_CONTEXT | (95 << 2))
+};
+static const asn_TYPE_tag2member_t
asn_MAP_GetConnectivityParametersResponse_tag2el_1[] = {
+ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* connectivityParameters
*/
+ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /*
connectivityParametersError */
+};
+static asn_CHOICE_specifics_t
asn_SPC_GetConnectivityParametersResponse_specs_1 = {
+ sizeof(struct GetConnectivityParametersResponse),
+ offsetof(struct GetConnectivityParametersResponse, _asn_ctx),
+ offsetof(struct GetConnectivityParametersResponse, present),
+ sizeof(((struct GetConnectivityParametersResponse *)0)->present),
+ asn_MAP_GetConnectivityParametersResponse_tag2el_1,
+ 2, /* Count of tags in the map */
+ 0, 0,
+ 2 /* Extensions start */
+};
+asn_TYPE_descriptor_t asn_DEF_GetConnectivityParametersResponse = {
+ "GetConnectivityParametersResponse",
+ "GetConnectivityParametersResponse",
+ &asn_OP_CHOICE,
+ asn_DEF_GetConnectivityParametersResponse_tags_1,
+ sizeof(asn_DEF_GetConnectivityParametersResponse_tags_1)
+ /sizeof(asn_DEF_GetConnectivityParametersResponse_tags_1[0]),
/* 1 */
+ asn_DEF_GetConnectivityParametersResponse_tags_1, /* Same as
above */
+ sizeof(asn_DEF_GetConnectivityParametersResponse_tags_1)
+ /sizeof(asn_DEF_GetConnectivityParametersResponse_tags_1[0]),
/* 1 */
+ { &asn_OER_type_GetConnectivityParametersResponse_constr_1,
&asn_PER_type_GetConnectivityParametersResponse_constr_1, CHOICE_constraint },
+ asn_MBR_GetConnectivityParametersResponse_1,
+ 2, /* Elements count */
+ &asn_SPC_GetConnectivityParametersResponse_specs_1 /* Additional
specs */
+};
+
diff --git a/src/ipa/libasn/GetConnectivityParametersResponse.h
b/src/ipa/libasn/GetConnectivityParametersResponse.h
new file mode 100644
index 0000000..940a2bc
--- /dev/null
+++ b/src/ipa/libasn/GetConnectivityParametersResponse.h
@@ -0,0 +1,56 @@
+/*
+ * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
+ * From ASN.1 module "SGP32Definitions"
+ * found in "../../../asn1/SGP32Definitions.asn"
+ * `asn1c -fcompound-names -no-gen-example`
+ */
+
+#ifndef _GetConnectivityParametersResponse_H_
+#define _GetConnectivityParametersResponse_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include "ConnectivityParameters.h"
+#include "ConnectivityParametersError.h"
+#include <constr_CHOICE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Dependencies */
+typedef enum GetConnectivityParametersResponse_PR {
+ GetConnectivityParametersResponse_PR_NOTHING, /* No components
present */
+ GetConnectivityParametersResponse_PR_connectivityParameters,
+ GetConnectivityParametersResponse_PR_connectivityParametersError
+ /* Extensions may appear below */
+
+} GetConnectivityParametersResponse_PR;
+
+/* GetConnectivityParametersResponse */
+typedef struct GetConnectivityParametersResponse {
+ GetConnectivityParametersResponse_PR present;
+ union GetConnectivityParametersResponse_u {
+ ConnectivityParameters_t connectivityParameters;
+ ConnectivityParametersError_t connectivityParametersError;
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+ } choice;
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} GetConnectivityParametersResponse_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_GetConnectivityParametersResponse;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GetConnectivityParametersResponse_H_ */
+#include <asn_internal.h>
diff --git a/src/ipa/libipa/CMakeLists.txt b/src/ipa/libipa/CMakeLists.txt
index d25b35b..e85d128 100644
--- a/src/ipa/libipa/CMakeLists.txt
+++ b/src/ipa/libipa/CMakeLists.txt
@@ -24,6 +24,7 @@
es10b_ret_from_fallback.c
es10b_en_emerg_prfle.c
es10b_dis_emerg_prfle.c
+ es10b_get_conn_params.c
es10c_delete_prfle.c
es10c_disable_prfle.c
es10c_enable_prfle.c
diff --git a/src/ipa/libipa/es10b_get_conn_params.c
b/src/ipa/libipa/es10b_get_conn_params.c
new file mode 100644
index 0000000..8805e54
--- /dev/null
+++ b/src/ipa/libipa/es10b_get_conn_params.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2026 sysmocom - s.f.m.c. GmbH. All rights reserved.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ *
+ * Author: Philipp Maier <[email protected]> / sysmocom - s.f.m.c. GmbH
+ * Andreas Eversberg <[email protected]> / sysmocom - s.f.m.c.
GmbH
+ *
+ * See also: GSMA SGP.22, 5.9.20: Function (ES10b): ExecuteFallbackMechanism
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <onomondo/ipa/utils.h>
+#include "context.h"
+#include "utils.h"
+#include "euicc.h"
+#include "es10x.h"
+#include "es10b_get_conn_params.h"
+#include <GetConnectivityParametersRequest.h>
+
+static const struct num_str_map error_code_strings[] = {
+ { ConnectivityParametersError_parametersNotAvailable,
"parametersNotAvailable" },
+ { ConnectivityParametersError_undefinedError, "undefinedError" },
+ { 0, NULL }
+};
+
+static int dec_get_conn_params_res(struct ipa_es10b_get_conn_params_res *res,
const struct ipa_buf *es10b_res)
+{
+ struct GetConnectivityParametersResponse *asn = NULL;
+
+ asn = ipa_es10x_res_dec(&asn_DEF_GetConnectivityParametersResponse,
es10b_res, "GetConnectivityParameters");
+ if (!asn)
+ return -EINVAL;
+
+ switch (asn->present) {
+ case GetConnectivityParametersResponse_PR_connectivityParameters:
+ IPA_LOGP_ES10X("GetConnectivityParametersResponse", LERROR,
"function succeeded!\n");
+ break;
+ case GetConnectivityParametersResponse_PR_connectivityParametersError:
+ IPA_LOGP_ES10X("GetConnectivityParametersResponse", LERROR,
"function failed with error code %ld=%s!\n",
+ asn->choice.connectivityParametersError,
+ ipa_str_from_num(error_code_strings,
asn->choice.connectivityParametersError, "(unknown)"));
+ break;
+ default:
+ IPA_LOGP_ES10X("GetConnectivityParametersRequest", LERROR,
"empty GetConnectivityParametersResponse response!\n");
+ break;
+ }
+
+ res->res = asn;
+ return 0;
+}
+
+static struct GetConnectivityParametersResponse *generate_conn_params_err(void)
+{
+ struct GetConnectivityParametersResponse *res = IPA_ALLOC_ZERO(struct
GetConnectivityParametersResponse);
+
+ assert(res);
+ res->present =
GetConnectivityParametersResponse_PR_connectivityParametersError;
+ res->choice.connectivityParametersError =
ConnectivityParametersError_undefinedError;
+ return res;
+}
+
+/*! Function (Es10b): GetConnectivityParameters.
+ * \param[inout] ctx pointer to ipa_context.
+ * \returns pointer newly allocated struct with function result, NULL on
error. */
+struct ipa_es10b_get_conn_params_res *ipa_es10b_get_conn_params(struct
ipa_context *ctx)
+{
+ struct ipa_buf *es10b_req = NULL;
+ struct ipa_buf *es10b_res = NULL;
+ struct GetConnectivityParametersRequest req = { 0 };
+ struct ipa_es10b_get_conn_params_res *res = IPA_ALLOC_ZERO(struct
ipa_es10b_get_conn_params_res);
+ int rc;
+
+ if (ctx->cfg->iot_euicc_emu_enabled) {
+ IPA_LOGP_ES10X("GetConnectivityParametersRequest", LERROR,
+ "Unable to emulate retrieval of connectivity
patameters.\n");
+ res->res = generate_conn_params_err();
+ return res;
+ }
+
+ es10b_req =
ipa_es10x_req_enc(&asn_DEF_GetConnectivityParametersRequest, &req,
"GetConnectivityParameters");
+ if (!es10b_req) {
+ IPA_LOGP_ES10X("GetConnectivityParametersRequest", LERROR,
"unable to encode Es10b request\n");
+ goto error;
+ }
+
+ es10b_res = ipa_euicc_transceive_es10x(ctx, es10b_req);
+ if (!es10b_res) {
+ IPA_LOGP_ES10X("GetConnectivityParametersRequest", LERROR, "no
Es10b response\n");
+ goto error;
+ }
+
+ rc = dec_get_conn_params_res(res, es10b_res);
+ if (rc < 0)
+ goto error;
+
+ IPA_FREE(es10b_req);
+ IPA_FREE(es10b_res);
+ return res;
+error:
+ IPA_FREE(es10b_req);
+ IPA_FREE(es10b_res);
+ ipa_es10b_get_conn_params_res_free(res);
+ return NULL;
+}
+
+/*! Free results of function (Es10b): GetConnectivityParameters.
+ * \param[in] res pointer to function result. */
+void ipa_es10b_get_conn_params_res_free(struct ipa_es10b_get_conn_params_res
*res)
+{
+ IPA_ES10X_RES_FREE(asn_DEF_GetConnectivityParametersResponse, res);
+}
diff --git a/src/ipa/libipa/es10b_get_conn_params.h
b/src/ipa/libipa/es10b_get_conn_params.h
new file mode 100644
index 0000000..75feeca
--- /dev/null
+++ b/src/ipa/libipa/es10b_get_conn_params.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2026 sysmocom - s.f.m.c. GmbH. All rights reserved.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#pragma once
+
+#include <GetConnectivityParametersResponse.h>
+struct ipa_context;
+
+struct ipa_es10b_get_conn_params_res {
+ struct GetConnectivityParametersResponse *res;
+};
+
+struct ipa_es10b_get_conn_params_res *ipa_es10b_get_conn_params(struct
ipa_context *ctx);
+void ipa_es10b_get_conn_params_res_free(struct ipa_es10b_get_conn_params_res
*res);
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 1798c37..180377e 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -29,6 +29,7 @@
#include "es10b_ret_from_fallback.h"
#include "es10b_en_emerg_prfle.h"
#include "es10b_dis_emerg_prfle.h"
+#include "es10b_get_conn_params.h"
#include "proc_euicc_pkg_dwnld_exec.h"
#include "proc_notif_delivery.h"
@@ -345,6 +346,40 @@
return rc;
}
+/*! Get connectivity parameters from active profile.
+ * \param[inout] ctx pointer to ipa_context.
+ * \param[out] http_params pointer to the HTTP parameters pointer to be
returned.
+ * \returns 0 on success, negative on error. */
+int ipa_get_connnectivity_parameters(struct ipa_context *ctx, struct ipa_buf
**http_params)
+{
+ struct ipa_es10b_get_conn_params_res *res;
+ int rc = -EINVAL;
+
+ *http_params = NULL;
+
+ res = ipa_es10b_get_conn_params(ctx);
+ if (!res)
+ return -EIO;
+ switch (res->res->present) {
+ case GetConnectivityParametersResponse_PR_connectivityParameters:
+ if (res->res->choice.connectivityParameters.httpParams) {
+ *http_params =
ipa_buf_alloc_data(res->res->choice.connectivityParameters.httpParams->size,
+
res->res->choice.connectivityParameters.httpParams->buf);
+ }
+ rc = 0;
+ break;
+ case GetConnectivityParametersResponse_PR_connectivityParametersError:
+ if (res->res->choice.connectivityParametersError ==
ConnectivityParametersError_parametersNotAvailable)
+ rc = 0;
+ break;
+ case GetConnectivityParametersResponse_PR_NOTHING:
+ ;
+ }
+ ipa_es10b_get_conn_params_res_free(res);
+
+ return rc;
+}
+
static int check_canaries(struct ipa_context *ctx)
{
if (ctx->check_http)
diff --git a/src/ipa/main.c b/src/ipa/main.c
index 4312a25..4a61762 100644
--- a/src/ipa/main.c
+++ b/src/ipa/main.c
@@ -32,6 +32,7 @@
OPER_RETURN_FROM_FALLBACK,
OPER_ENABLE_EMERG_PRFLE,
OPER_DISABLE_EMERG_PRFLE,
+ OPER_GET_CONN_PARAMS,
};
bool running = true;
@@ -76,6 +77,7 @@
printf(" return-from-fallback ........ Trigger return from fallback
profile to previous profile\n");
printf(" enable-emergency-profile .... Trigger enabling of emergency
profile\n");
printf(" disable-emergency-profile ... Trigger return from emergency
profile to previous profile\n");
+ printf(" get-connectivity-parameters . Get connectivity parameters from
acurrently active profile\n");
}
struct ipa_buf *load_ber_from_file(char *dir, char *file)
@@ -252,6 +254,8 @@
operation = OPER_ENABLE_EMERG_PRFLE;
} else if (!strcmp(argv[optind], "disable-emergency-profile")) {
operation = OPER_DISABLE_EMERG_PRFLE;
+ } else if (!strcmp(argv[optind],
"get-connectivity-parameters")) {
+ operation = OPER_GET_CONN_PARAMS;
} else if (!!strcmp(argv[optind], "get-eim-package")) {
printf("unknown operation: %s\n", argv[optind]);
exit(-1);
@@ -379,6 +383,19 @@
/* Trigger return from emergency profile to previous profile */
ipa_disable_emerg_prfle(ctx);
break;
+ case OPER_GET_CONN_PARAMS:
+ struct ipa_buf *http_params;
+ /* Get optional connectivity parameters to reach eIM. */
+ rc = ipa_get_connnectivity_parameters(ctx, &http_params);
+ if (rc < 0)
+ goto leave;
+ if (http_params) {
+ IPA_LOGP(SMAIN, LINFO, "HTTP paramms: %s\n",
ipa_buf_hexdump(http_params));
+ ipa_buf_free(http_params);
+ } else {
+ IPA_LOGP(SMAIN, LINFO, "No HTTP paramms available\n");
+ }
+ break;
}
leave:
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43054?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I075590e095dbbe05fa6cdb0a96d5b38c7a17ff78
Gerrit-Change-Number: 43054
Gerrit-PatchSet: 11
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>