sim: re-structure how we support cards + applications

Before this change, a card application (USIM, ISIM, ...) didn't
exist as a separate concept from a card profile.  This meant,
we had a manual combination of UICC card profile with USIM application,
and another one of UICC card profile and ISIM application.  But what
if there's a combined USIM+ISIM?

In reality, applications exist as separate objects, on top of an
ETSI UICC.  Lets therefore register all known applications to the
osim library core, and add code to osmo-sim-test which dynamically
detects all applications present on a given card (by reading EF.DIR).

Change-Id: Ic4b4ac433a9976842b30a017fb0fc347d87201cd
diff --git a/src/sim/sim_int.h b/src/sim/sim_int.h
index 885011e..99a2242 100644
--- a/src/sim/sim_int.h
+++ b/src/sim/sim_int.h
@@ -12,8 +12,6 @@
 element_alloc_sub(struct osim_decoded_element *ee, const char *name,
 	      enum osim_element_type type, enum osim_element_repr repr);
 
-extern const struct osim_card_sw ts102221_uicc_sw[0];
-
 int default_decode(struct osim_decoded_data *dd,
 		   const struct osim_file_desc *desc,
 		   int len, uint8_t *data);
@@ -26,11 +24,14 @@
 		const struct osim_file_desc *in, int num);
 
 struct osim_file_desc *
-add_adf_with_ef(struct osim_file_desc *parent,
-		const uint8_t *adf_name, uint8_t adf_name_len,
-		const char *name, const struct osim_file_desc *in,
-		int num);
+alloc_adf_with_ef(void *ctx, const uint8_t *adf_name, uint8_t adf_name_len,
+		  const char *name, const struct osim_file_desc *in, int num);
 
 extern const struct osim_reader_ops pcsc_reader_ops;
 
+void osim_app_profile_register(struct osim_card_app_profile *aprof);
+
+struct osim_card_app_profile *osim_aprof_usim(void *ctx);
+struct osim_card_app_profile *osim_aprof_isim(void *ctx);
+
 #endif