diff simtool/pbcommon.c @ 81:e89004a245ce

EF_LND code refactoring in prep for adding more lnd-* commands
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 17 Feb 2021 05:53:22 +0000
parents 2f697a8c5196
children
line wrap: on
line diff
--- a/simtool/pbcommon.c	Wed Feb 17 05:31:53 2021 +0000
+++ b/simtool/pbcommon.c	Wed Feb 17 05:53:22 2021 +0000
@@ -72,3 +72,29 @@
 	}
 	return(0);
 }
+
+select_ef_lnd()
+{
+	int rc;
+
+	rc = select_op(DF_TELECOM);
+	if (rc < 0)
+		return(rc);
+	rc = select_op(EF_LND);
+	if (rc < 0)
+		return(rc);
+	rc = parse_ef_select_response();
+	if (rc < 0)
+		return(rc);
+	if (curfile_structure != 0x03) {
+		fprintf(stderr, "error: EF_LND is not cyclic\n");
+		return(-1);
+	}
+	if (curfile_record_len < 14) {
+		fprintf(stderr,
+	"error: EF_LND has record length of %u bytes, less than minimum 14\n",
+			curfile_record_len);
+		return(-1);
+	}
+	return(0);
+}