view libcoding/alpha_addr.c @ 25:2a19b44c272e

convert to new ThemWi configure and build system
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 21 May 2024 01:59:17 +0000
parents 5854e48d0ef7
children c8cb05b69118
line wrap: on
line source

/*
 * This library module implements encoding of alphanumeric From addresses
 * that are allowed in SMS-DELIVER TPDUs.
 */

#include <sys/types.h>

u_char alpha_septets_to_digits[12] = {0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20};

encode_alpha_addr(arg, bin)
	char *arg;
	u_char *bin;
{
	u_char gsm7[11];
	int rc;

	rc = qstring_arg_to_gsm7(arg, gsm7, 11);
	if (rc < 0)
		return(rc);
	bin[0] = alpha_septets_to_digits[rc];
	bin[1] = 0x50;
	gsm7_pack(gsm7, bin + 2, (bin[0] + 1) >> 1);
	return(0);
}