view include/number_db_v2.h @ 12:1ebc312f4b69

add README
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 13 Dec 2023 05:53:17 +0000
parents 159dd90eeafe
children
line wrap: on
line source

/*
 * This header file defines version 2 of ThemWi number database
 * binary file format.
 */

#pragma once

#include <stdint.h>

struct numdb_file_hdr {
	uint32_t	owned_number_count;
	uint32_t	short_number_count;
};

struct owned_number_rec {
	uint16_t	number[3];	/* NPA-exchange-suffix breakdown */
	uint8_t		number_flags;	/* properties of outside number */
	uint8_t		usage;		/* usage inside ThemWi */
	uint16_t	remap[3];	/* secondary remap number */
};

#define	NUMBER_FLAG_SMSPROV	0x01	/* provisioned for outside SMS */
#define	NUMBER_FLAG_E911PROV	0x02	/* provisioned for E911 */

#define	NUMBER_USAGE_MASK		0x0F
#define	NUMBER_USAGE_TYPE_RSVD		0x00
#define	NUMBER_USAGE_TYPE_GSM_SUB	0x01
#define	NUMBER_USAGE_TYPE_ALIAS		0x02
#define	NUMBER_USAGE_FLAG_E911_VIA	0x10

struct short_number_rec {
	uint16_t	short_num;
	uint8_t		short_num_type;
	uint8_t		fullnum_flags;
	uint16_t	fullnum_prefix[2];
};

#define	SHORT_NUM_TYPE_ABBREV		0x01
#define	SHORT_NUM_TYPE_ITN		0x02
#define	SHORT_NUM_TYPE_TEST_SINK	0x03