diff include/sm_record.h @ 0:9e364c18e0e8

beginning of architectural design spec
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 20 Dec 2023 03:50:06 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/sm_record.h	Wed Dec 20 03:50:06 2023 +0000
@@ -0,0 +1,55 @@
+/*
+ * 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];
+};