view libutil/alpha_decode.c @ 99:97ba63d9361a

scripts/fcsim1-sst: turn off STK & OTA services In the initial unprogrammed state of the cards from Grcard, SST has services 25 through 29 set to allocated and activated. However, these cards appear to not actually support OTA, ENVELOPE commands do nothing (just return SW 9000), and they were never observed issuing any proactive SIM commands, even after a feature-generous TERMINAL PROFILE. Therefore, let's list these STK & OTA services as allocated, but not activated in our FCSIM1 SST.
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 05 May 2021 04:26:07 +0000
parents 34bbb0585cab
children
line wrap: on
line source

/*
 * This module contains functions for decoding and displaying alpha fields
 * that exist in various SIM files.
 */

#include <sys/types.h>
#include <stdio.h>

static void
print_alpha_field_hex(data, nbytes, outf)
	u_char *data;
	unsigned nbytes;
	FILE *outf;
{
	u_char *dp, *endp;

	fputs("HEX ", outf);
	dp = data;
	endp = data + nbytes;
	while (dp < endp)
		fprintf(outf, "%02X", *dp++);
}

void
print_alpha_field(data, nbytes, outf)
	u_char *data;
	unsigned nbytes;
	FILE *outf;
{
	if (!nbytes) {
		fputs("\"\"", outf);
		return;
	}
	if (data[0] & 0x80)
		print_alpha_field_hex(data, nbytes, outf);
	else
		print_gsm7_string_to_file(data, nbytes, outf);
}