view include/sm_record.h @ 6:acc5b1c3e07d default tip

doc/Arch-design: document Osmocom network interface plan
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 23 Dec 2023 08:07:33 +0000
parents 9e364c18e0e8
children
line wrap: on
line source

/*
 * This header file defines the message structure as stored in ThemWi-SMSC
 * persistent message store (PMS) binary files.
 */

#pragma once

#include <stdint.h>

struct sm_address {
	uint8_t		ndigits;
	uint8_t		ton_npi;
	uint8_t		bcd[10];
};

/* values for src_class and dest_class bytes */
#define	SME_CLASS_LOCAL			0
#define	SME_CLASS_GSM			1
#define	SME_CLASS_UPSTREAM		2
#define	SME_CLASS_DOWNSTREAM		3

/* values for disposition byte */
#define	SM_DISP_ACTIVE			0
#define	SM_DISP_DELIVERED		1
#define	SM_DISP_EXPIRED			2
#define	SM_DISP_IMSI_FAIL		3
#define	SM_DISP_SMPP_REJECT		4

struct sm_record {
	uint64_t	time_entry;	/* time entered in our SMSC */
	uint64_t	time_expiry;	/* end of validity period */
	uint64_t	time_disch;	/* discharge time */
	struct sm_address addr_from;
	struct sm_address addr_to_orig;
	struct sm_address addr_to_final;
	/*
	 * Each of the two IMSI fields is repurposed as system_id
	 * in the case of downstream SMPP peers.  The maximum length
	 * is conveniently the same.
	 */
	char		src_imsi[16];
	char		dest_imsi[16];
	uint32_t	src_extra_info;
	uint32_t	dest_extra_info;
	uint8_t		src_class;
	uint8_t		dest_class;
	uint8_t		disposition;
	uint8_t		gsm_src_mr;
	uint8_t		pid;
	uint8_t		dcs;
	uint8_t		udhi;
	uint8_t		udl;
	uint8_t		ud[140];
	uint8_t		reserved[8];
};